Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Where is the DRAWORDER of an object stored?

8 REPLIES 8
Reply
Message 1 of 9
wai1954
1357 Views, 8 Replies

Where is the DRAWORDER of an object stored?

G'day,

 

Where is the DRAWORDER of an object stored?

 

I have an item bubble block that has a WIPEOUT as part of it so that it can be placed over an object to hide part of it. The text of this blockcan be edited so that the bubble (and wipeout) automatically grows or shrinks if the text increases or decreases in length. The bubble is created as an anonymous block.

 

The problem is that when the bubble is edited, the result is that anew anonymous block is created, and this ends up on top of the objects it was previously behind.

 

This is why I would like to know where the DRAWORDER of the bock object is stored so that I can maintain this when the edited block is created.

 

Any pointers?

 

Thanks.

wai1954 (Ian A. White)
8 REPLIES 8
Message 2 of 9
jcourtne
in reply to: wai1954

I haven't found it in the standard vlax-dump-object list or the regular entget list of an entity.

There may be some assoc # that grabs it from entity space, as the method i use to doesn't seem to show all the numbers that return values.

Sorry I have been no help, I'm also curious to know.

Message 3 of 9
Shneuph
in reply to: wai1954

It's stored in a dictionary object.  I wanted to edit the draworder of objects before similarly to how you want to but when I found this I decided not to take the time to figure out how to edit the ACAD_SORTENTS extension dictionary.  Maybe someone else knows how and can share with both of us...

 

From ACAD Help:   DXF Reference > OBJECTS Section >

"If the SORTENTS Regen flag (bit-code value 16) is set, AutoCAD regenerates entities in ascending handle order. When the DRAWORDER command is used, a SORTENTSTABLE object is attached to the *Model_Space or *Paper_Space block's extension dictionary under the name ACAD_SORTENTS. The SORTENTSTABLE object related to this dictionary associates a different handle with each entity, which redefines the order in which the entities are regenerated."

---sig---------------------------------------
'(83 104 110 101 117 112 104 64 71 109 97 105 108 46 99 111 109)
Message 4 of 9
Jeff_M
in reply to: wai1954

See this thread: http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/Manipulate-object-draworder/m-p/14635... I'm pretty sure it all still applies through 2012. That thread talks only about Model & Paper space, but blocks use the same dictionary tools.

Jeff_M, also a frequent Swamper
EESignature
Message 5 of 9
wai1954
in reply to: Jeff_M

 


@Jeff_M wrote:

See this thread: http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/Manipulate-object-draworder/m-p/14635... I'm pretty sure it all still applies through 2012. That thread talks only about Model & Paper space, but blocks use the same dictionary tools.



Thanks for the link. It provides some information on where it is stored. I have to play with it to see how things can be made to work.

 

Take an example. I have a line with an object (my bubble) with a wipeout that I want to be above the line, so I modify it with the DRAWORDER command and send the line to the back. I also have another line (or other object) that I want to be seen in front of the bubble. If this is a newly drawn object I have to do nothing. If it is a previously drawn object, I run the DRAWORDER command and send the object to be in front.

 

Now I have to edit my bubble. This is the dilema. How do I get the edited bubble (which ends up becoming a newly created object) to maintain its order as for the bubble before it was edited? It is in front of the line but behind the other object. How is that set?

 

Thanks again.

wai1954 (Ian A. White)
Message 6 of 9
Jeff_M
in reply to: wai1954

Can you poste an example drawing, Ian? I think I follow what you are saying, but in a test drawing/block I just setup I'm not seeing a problem that needs correcting (2010).

Jeff_M, also a frequent Swamper
EESignature
Message 7 of 9
wai1954
in reply to: Jeff_M

@Jeff_M wrote:

Can you poste an example drawing, Ian? I think I follow what you are saying, but in a test drawing/block I just setup I'm not seeing a problem that needs correcting (2010).


Actually, I don;t think a drawing file will do much because it is a proprietary item tagging routine that is used to edit the bubble.

 

The routine (actually a series of routines that produce circular, square, hexagonal and octagonal bubbles) are used to store a whole lot of information that can be used by a bill of materials routine to get item quantaties and details and prepare a BoM table. To stop a build up of blocks that have to be manually purged, these bubbles are created as anonymous blocks. To do this, they are (entmake)d. They may need to be updated to have the displayed text changed, and so the respective routine allows the user to edit the anonymous bubble block. When the changes have been made, the routine cnecks the physical length of the new displayed text, compares it to the length of the original displayed text, and then asks the user if they want the bubble to grow to the left, right, or remain centred. The routine then creates a new block based on this, deletes the old one and places the new one there. It also prompts for editing any of the attribute information.

 

The block created comprises a wipeout, then the displayed text, and then the bubble outline. The additional information stored are invisible attributes and so the order of their creation is not important.

 

The bubble has to be in front of the leader line as the leader line has to terminate at the edge of the bubble outline, but the bubble has to be behind any other drawn objects. Unfortunately, when the bubble is edited, it ends up in front of everything.

 

It does not use the Block Editor because the block is an anonymous block.

 

I can inherit all the other properties of the original bubble and can (entmake) the new updated bubble...except the DRAWORDER of the INSERTed bubble.

 

The reason for the complexity of the routine is so that the bubble can grow or shrink and change justification based on the physical length of the text, and because I did not want to end up with a whole lot (in some machine assemblies the number of item bubbles can go into the hundreds) of bubbles that would have to be purged if the item it was associated with was deleted.

 

I have attached a simple drawing to illustrate things. It is not how I do things, but somewhat explains things. In this example, the item tag changes from 200A to 200D. For whatever reason, the tag had to be placed where the bubble crossed the outline of another part of the assembly. To ensure that it was made correctly, the machine assembly was brought to the front. The drawing gets revised and the bubble edited and updated, and now part of the assembly outline is obscured by the bubble and the queries from the workshop start flowing.

 

This is a very simple exampe that could be addressed by other means, but illoustrates the issue of trying to inherit the original object draw order. These bubbles are also used to simply display text that is suitably enclosed, and unless careful can end up obscuring parts you do not want obscured.

 

Anyhow, I hope this helps.

wai1954 (Ian A. White)
Message 8 of 9
Jeff_M
in reply to: wai1954

OK, yes, that clears things up. Thanks for the detailed explanation! Now, I think this will work but I can't test it to be sure....

 

The VLA-OBJECT SortentsTable has a method SwapOrder. So what I think will work is to create the new block & insert, but before deleting the old block you can use the swaporder to get the new one at the same place in the table as the old was, THEN delete the old block.

 

So, something like this, where the old & new blocks are the insert enames:

 

(setq oldblkobj (vlax-ename->vla-object oldblkename)
        newblkobj (vlax-ename->vla-object newblkename)
)
;;from the link I posted before
(setq doc (vla-get-activedocument (vlax-get-acad-object))
        space (vla-get-block (vla-get-activelayout doc))
        extdict (vla-getextensiondictionary space)
)
(if (not (zerop (vla-get-count extdict)))
  (setq sorttbl (vla-getobject extdict "ACAD_SORTENTS"))
  (setq sorttbl (vla-addobject extdict "ACAD_SORTENTS" "AcDbSortentsTable"))
)
(vla-swapobjects sorttbl newblkobj oldblkobj)

 Again, this is untested but it seems like it should do what you want.

Jeff_M, also a frequent Swamper
EESignature
Message 9 of 9
wai1954
in reply to: Jeff_M

Thanks for that Jeff. I will see what I can do and report back.

wai1954 (Ian A. White)

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost