PDA

View Full Version : Changing the order of attributes



kdayman
2005-02-15, 03:01 PM
I have to set the order of some 75 attributes in 92 variation of a block. Therefore it would be much easier to write a routine to do this. So I can select each attribute by its tag name (.tagstring) however now I need a way to set its order, does it have an index number or some other property that I can set/manipulate to achieve this?

Thanks,

Kelly

Ed Jobe
2005-02-15, 11:38 PM
I havn't tried to automate such a task, but the order that an attribute appears in the attribute editor has always been determined by the order in which it was added to the block, i.e. selection order during the BLOCK command. In vba, all the block's entities are stored in it's Items collection. They do have an assosiated index, but you can't simply reorder a collection by changing the index number (i.e. readonly). You would have to iterate through the collection and temporarily remove the AcadAttribute objects to another collection or array, sort them, and then add them back to the block in the new sort order. If you use a collection as the temp container, you can use the InsertBefore/After methods to order the temp collection. This may vary somewhat depending on the criteria you need for sorting.

kdayman
2005-02-15, 11:46 PM
Thanks for the ideas Ed, I had not considered what you propose. I assumed that because the BATTMAN command allows you to sort them that there must be some sort index number or other property. I will explore this deeper.

Thanks,

Kelly