p7q Posted August 11 Posted August 11 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 August 11 Posted August 11 Maybe something in my post or the one of Lee Mac's I linked... 1 Quote
Lee Mac Posted August 15 Posted August 15 You can obtain the transformation matrix directly from an nentsel/nentselp call. Quote
Danielm103 Posted August 16 Posted August 16 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
Koz Posted 8 hours ago Posted 8 hours ago if you want to copy a non-block object, it can be done by ncopy command. Using VLISP, can call nentsel and pick a nest object, you can directly get the nest object and transform matrix as Lee mentioned, then rebuild the nest object and apply the matrix to it to "extract" the nest object out. 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.