Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Kycau on February 22, 2023, 09:56:59 AM
Title: Retrieve info about a lwpolyline in a dynamic block.
Post by: Kycau on February 22, 2023, 09:56:59 AM
Hello,
I have a dynamic block, with Visibility parameter, Lookup parameter and plenty of Linear parameters with stretch actions. A certain LWPOLYLINE inside my dynamic block, is stretch by around 7-8 stretch parameters, with different opposite directions (like 180° to each other). Some are with different ratio.
I have multiple blocks like this in my DWG, and for each, individual settings for parameters are set. I need to retrieve this certain lwpolyline's length, from every dynamic block. I can't do it through info of linear parameters, because they do not always behave correctly.
Lets name the length of this specific LWPOLYLINE = X. I need from selection of 10 dynamic blocks, retrieve length of X for each case.
Any tips how to do it?
Title: Re: Retrieve info about a lwpolyline in a dynamic block.
Post by: ribarm on February 22, 2023, 10:18:32 AM
Have you tried EXPLODE temporarily, iterate through newly appended entities, find LWPOLY - get info, store info, do UNDO before EXPLODE... This all from iteration through all dynamic blocks...
If not working - set visibility correctly, iterate, but firstly convert dynamic to static, again temp. EXPLODE, and so on, so on, ...
Title: Re: Retrieve info about a lwpolyline in a dynamic block.
Post by: dexus on February 22, 2023, 11:04:08 AM
You could also duplicate the block and explode that one. That way you don't have to rely on undo.
Here is a function to explode an object and then retrieve the resulting objects. Seems like a good place to start if you ask me.
Title: Re: Retrieve info about a lwpolyline in a dynamic block.
Post by: Lee Mac on February 22, 2023, 02:41:04 PM
An explode operation is not necessary, you can simply iterate over the components held by the anonymous block definition generated when the dynamic parameters are changed.
Title: Re: Retrieve info about a lwpolyline in a dynamic block.
Post by: steve.carson on February 22, 2023, 03:11:34 PM
If you just need the number, you can add a field to the block definition to always display the length of the polyline.