p7q Posted Monday at 02:35 PM Posted Monday at 02:35 PM Hi everyone, I’ve been working on modifying Lee Mac’s “Extract Nested Block” routine. @Lee Mac By default, his code only extracts a nested block reference. I have expanded it so that it can also extract non-block objects (lines, arcs, etc.) located inside a nested block reference. The problem occurs when the selected object is inside one or more parent blocks that have been scaled or mirrored. In these cases, the extracted object is placed in the wrong position in model space. I know the “correct” way to solve this is to traverse the block reference hierarchy and apply all transformation matrices (scale, rotation, mirror) step by step until we reach world coordinates. However, in large DWG files with many nested blocks, this approach becomes very slow and hurts performance significantly. My question is: Is there a more efficient way to get the final WCS coordinates of a nested object, including all scaling/mirroring effects from its parent blocks, without manually multiplying all transformation matrices? Any suggestions or examples would be greatly appreciated. Thanks in advance! Quote
SLW210 Posted Monday at 05:35 PM Posted Monday at 05:35 PM Maybe something in my post or the one of Lee Mac's I linked... 1 Quote
Lee Mac Posted 12 hours ago Posted 12 hours ago You can obtain the transformation matrix directly from an nentsel/nentselp call. Quote
Danielm103 Posted 1 hour ago Posted 1 hour ago ARX would use AcDbBlockReference::blockTransform() to get the matrix, then call transformBy on the entity in one operation. You should be able to construct a vlax-tmatrix from the reference, then call vla-transformby on the objects you wish to transform. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.