question re sortents table and draw order
CADForums.net Forum Index CADForums.net
Discussion of AutoCAD and other CAD software.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web cadforums.net
question re sortents table and draw order

 
Post new topic   Reply to topic    CADForums.net Forum Index -> VBA
Author Message
ericky
Guest





Posted: Sat Dec 04, 2004 5:51 am    Post subject: question re sortents table and draw order Reply with quote

No one has responded to my missives concerning draw order and the sortents table. Is the sortents table new in 2005? Can anyone shed any light why the code below doesn't work? It is intended to list out the drawing entities in draw order, but it doesn't.

Dim e as AcadEntity
Dim b as AcadBlock
Dim eDictionary As Object
Dim sentityObj As AcadSortentsTable

Set eDictionary = _
ThisDrawing.ModelSpace.GetExtensionDictionary
Set sentityObj = eDictionary.GetObject("ACAD_SORTENTS")
Set b = ThisDrawing.ModelSpace

sentityObj.GetFullDrawOrder b, True
For Each e In sentityObj.Block
MsgBox e.ObjectName
Next e

Thanks for any help you can provide.

- ej

Back to top
Jeff Mishler
Guest





Posted: Sat Dec 04, 2004 6:52 am    Post subject: Re: question re sortents table and draw order Reply with quote

Well, I can answer I of your questions....No, the sortents table is not new
to 2005 BUT the access to it via VBA is new.
I don't have 2005 to test any code with, sorry.

--
Jeff
check out www.cadvault.com
"ericky" <nospam@address.withheld> wrote in message
news:24089557.1102121523667.JavaMail.jive@jiveforum1.autodesk.com...
Quote:
No one has responded to my missives concerning draw order and the sortents
table. Is the sortents table new in 2005? Can anyone shed any light why
the code below doesn't work? It is intended to list out the drawing
entities in draw order, but it doesn't.

Dim e as AcadEntity
Dim b as AcadBlock
Dim eDictionary As Object
Dim sentityObj As AcadSortentsTable

Set eDictionary = _
ThisDrawing.ModelSpace.GetExtensionDictionary
Set sentityObj = eDictionary.GetObject("ACAD_SORTENTS")
Set b = ThisDrawing.ModelSpace

sentityObj.GetFullDrawOrder b, True
For Each e In sentityObj.Block
MsgBox e.ObjectName
Next e

Thanks for any help you can provide.

- ej
Back to top
Jorge Jimenez
Guest





Posted: Sat Dec 04, 2004 11:50 pm    Post subject: Re: question re sortents table and draw order Reply with quote

Sortents in NOT new in 2005.
Don't really know if there have been changes made to it since acad2002
But if I recall correctly, this table has a list of entity handles plus a
long
indicating the position for each.

--
Saludos, Ing. Jorge Jimenez, SICAD S.A., Costa Rica


"ericky" <nospam@address.withheld> wrote in message
news:24089557.1102121523667.JavaMail.jive@jiveforum1.autodesk.com...
Quote:
No one has responded to my missives concerning draw order and the sortents
table. Is the sortents table new in 2005? Can anyone shed any light why
the code below doesn't work? It is intended to list out the drawing
entities in draw order, but it doesn't.

Dim e as AcadEntity
Dim b as AcadBlock
Dim eDictionary As Object
Dim sentityObj As AcadSortentsTable

Set eDictionary = _
ThisDrawing.ModelSpace.GetExtensionDictionary
Set sentityObj = eDictionary.GetObject("ACAD_SORTENTS")
Set b = ThisDrawing.ModelSpace

sentityObj.GetFullDrawOrder b, True
For Each e In sentityObj.Block
MsgBox e.ObjectName
Next e

Thanks for any help you can provide.

- ej


Back to top
Nathan Taylor
Guest





Posted: Mon Dec 06, 2004 3:13 am    Post subject: Re: question re sortents table and draw order Reply with quote

From Jeff's post I think it may be possible that the new methods have not been implemented correctly by Autodesk. This is purely a stab in the dark. Try manually cycling the sortents table checking the index as indicated by Jorge.
Regards - Nathan
Back to top
fantum
Guest





Posted: Mon Dec 06, 2004 6:24 pm    Post subject: Re: question re sortents table and draw order Reply with quote

Try iterating the array of entities returned in the variant "b".

On Sat, 04 Dec 2004 00:51:33 GMT, ericky <nospam@address.withheld> wrote:

» No one has responded to my missives concerning draw order and the sortents table. Is the sortents table new in 2005? Can anyone shed any light why the code below doesn't work? It is intended to list out the drawing entities in draw order, but it doesn't.
»
» Dim e as AcadEntity
» Dim b as AcadBlock
» Dim eDictionary As Object
» Dim sentityObj As AcadSortentsTable
»
» Set eDictionary = _
» ThisDrawing.ModelSpace.GetExtensionDictionary
» Set sentityObj = eDictionary.GetObject("ACAD_SORTENTS")
» Set b = ThisDrawing.ModelSpace
»
» sentityObj.GetFullDrawOrder b, True
» For Each e In sentityObj.Block
» MsgBox e.ObjectName
» Next e
»
» Thanks for any help you can provide.
»
» - ej
Back to top
ericky
Guest





Posted: Mon Dec 06, 2004 10:49 pm    Post subject: Re: question re sortents table and draw order Reply with quote

No, that doesn't work either. It lists them out in creation order (lowest handle or lowest objectid first), but if you have changed the draw order using the draworder commands (bring above, send below, et al) the order does not change in b.
Back to top
ericky
Guest





Posted: Mon Dec 06, 2004 10:53 pm    Post subject: Re: question re sortents table and draw order Reply with quote

Where, or in what structure or property is the long indicating the position?
Back to top
fantum
Guest





Posted: Mon Dec 06, 2004 11:24 pm    Post subject: Re: question re sortents table and draw order Reply with quote

This works for me:

Public Sub test()
Dim e As AcadEntity
Dim b As Variant 'AcadBlock
Dim eDictionary As Object
Dim sentityObj As AcadSortentsTable

Set eDictionary = _
ThisDrawing.ModelSpace.GetExtensionDictionary
Set sentityObj = eDictionary.GetObject("ACAD_SORTENTS")
Set b = ThisDrawing.ModelSpace

sentityObj.GetFullDrawOrder b, True
Dim x As Long
'For Each e In sentityObj.Block
For x = LBound(b) To UBound(b)
MsgBox b(x).ObjectName
'Next e
Next x

End Sub
Back to top
ericky
Guest





Posted: Tue Dec 07, 2004 6:21 am    Post subject: Re: question re sortents table and draw order Reply with quote

Bullseye. Thank you >>very much<<, indeed.

- ej
Back to top
fantum
Guest





Posted: Tue Dec 07, 2004 5:08 pm    Post subject: Re: question re sortents table and draw order Reply with quote

A couple of things to be aware of. The ACAD_SORTENTS dictionary may not exist which would cause an error on the call to .GetObject. Also, you may not get what you want if the SORTENTS system variable is not 127 - depends on what it is you want in that case.
Back to top
HJohn
Guest





Posted: Tue Dec 07, 2004 8:24 pm    Post subject: Re: question re sortents table and draw order Reply with quote

I am working in Acad2004 and I can't find the AcadSortents table. I can't find it in either the Main dictionary or the extension dictionary of the model space. Any suggestion on how to access this table in 2004? Thanks in advance.
Back to top
Nathan Taylor
Guest





Posted: Wed Dec 08, 2004 2:46 am    Post subject: Re: question re sortents table and draw order Reply with quote

I don't think the table gets added until the draworder is changed from the order it was drawn. The following is part of the only example in 2005.
Code:

    'Gxet an extension dictionary and, if necessary, add a SortentsTable object
    Dim eDictionary As Object
    Set eDictionary = ThisDrawing.ModelSpace.GetExtensionDictionary
    ' Prevent failed GetObject calls from throwing an exception
    On Error Resume Next
    Dim sentityObj As Object
    Set sentityObj = eDictionary.GetObject("ACAD_SORTENTS")
    On Error GoTo 0
    If sentityObj Is Nothing Then
         ' No SortentsTable object, so add one
         Set sentityObj = eDictionary.AddObject("ACAD_SORTENTS", "AcDbSortentsTable")
    End If
Back to top
 
Post new topic   Reply to topic    CADForums.net Forum Index -> VBA All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server DSP VoIP Electronics New Topics
Powered by phpBB