This could go in the ' show your stuff ' area I guess, but I don't think it is done yet. This will let you select nested items ( not attributes, didn't want that for this function ) as if you are using ssget. I have used a lot of gile's code because he understands matrix math a whole lot better than I, and I'm not ashamed to admit it. There is also a test function at the bottom ' efb ' ( erase from block ) that will show what I'm talking about.
Doesn't really work in 3d space, or when the UCS isn't world. That is one issue that makes this a work in progress. Another one was maybe limiting the nesting level, as of right now it grabs the most basic items no matter how low they are nested.
Comment / concerns / opinions all welcomed.
Maybe I should add the work flow of it.
It uses ' grread ' to start. If you select an item, it will see if it is nested. If so, it will copy the nested item to the current space, and add the copied item into a list that will delete all such objects when the code is finished running. Did it this way because I couldn't figure out how to show a nested item as highlighted. If no nested item is selected, it will show the dragging motion of a window. Once it has the window, then it uses ' ssget ' with a crossing polygon to select all inserts in that area. Then it copies the window, as a polyline, to each block, and tests each object within the block. If it finds another insert, then it will step through that blocks definition, and so forth. When it finds an item that matches the search criteria ( honoring window or crossing only ), then it will add it to a list of list, along with the matrix to represent it correctly in the current space. All that uses the matrix functions from gile ( Thanks again gile for all that work! ). What it returns is a flat list of objects from whatever block they happen to be in. The objects should only be listed once in the list. It will honor layer properties, and visibility of objects within the blocks.
Edit: Updated code - 2009-03-11. Also attached it as file, since it is too large for the message.
Edit: Updated code - 2009-03-18. Changed the calling functions of the routine ( now ssgetNested ), and added an option for depth. Right now the depth option is giving me problems with xrefs when set to 1. If set to 0 it will go as deep as it can, otherwise it will just go as deep as the option. I tested it on straight blocks, and the depth option works. I don't know if I have to go with an ObjectDBX version, as that seems like it would work, as I can't figure out the option. It errors saying that the object is not in the database, but it is. So frustrating! I also changed what it returns. ie:
Command: (ssgetNested 1)
Select entity:
(
(
<Entity name: 7e3cf1a8>
(
(36.3689 20.1553 0.0)
(38.6465 21.6041 0.0)
)
(
(1.0 0.0 0.0 26.8625)
(0.0 1.0 0.0 17.4983)
(0.0 0.0 1.0 0.0)
(0.0 0.0 0.0 1.0)
)
(
<Entity name: 7e3cf230>
)
)
)
It is a list of lists. Each list is like what is returned by ' nentsel ', except that they second item will either be a point or a list of points. List items:
1. The nested entity name
2. Point or list of points
3. Real 4x4 matrix ( if copying into the current drawing, you would apply this matrix to have it show in the correct location )
4. The nesting path of the entity in item 1
Edit: Forgot to add the depth option for the single selection option. Will add and then repost the code.
Edit: Attached updated code.