- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
This snapshot shows 3 blocks: the red B1, the white B2 containing one instance of B3, and the cyan B3. The 3 blocks are shown on the top just to make it clear who's who, and on the bottom to show an example of how they would be used. There are 1 instance of B1, 2 instances of B2 and 1 instance of B3 (looking at the orientation of the B3 text helps understanding which instance is at the top level and which is inside B2):
I need to temporarily explode all the blocks and work with their entities as if they were in the world UCS. In the snapshot I am looking for all the intersections, but I may be looking for other kinds of analysis.
In a previous version of the add-in I'm working on now, I was using groups instead of blocks, because that add-in was working on another CAD where I can use thousands of groups without problems. I have done a few tests with AutoCAD and it turns out groups are unusable, so I am trying to use blocks. In the old add-in I have seen cases with 3000 groups and 350,000 intersections.
In the old add-in I was using a Line2 wrapper of the official Line class, because the Line class was too slow at calculating intersections and because I needed some methods that were not available.
What is the best approach with AutoCAD?
I was thinking of creating a Line2 wrapper, then scan all the blocks, scan all the lines in each block and create a list of Line2 objects. Each Line2 object refers to a Line that can be inside a block, sub-block, or at the top level, knows how to transform from block UCS to top level world UCS, and knows how to calculate intersections and has all the goodies that I need.
So my question is:
1. Does AutoCAD have a standard way to deal with entities inside blocks and sub-blocks as if they were at the top level?
2. If not, is the Line2 wrapper approach I mentioned above the correct approach?
3. Can you please point me to an example that shows how to apply the inverse transformation of the block to each line, so I can manage them as if they were at the top level world UCS?
Solved! Go to Solution.