TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: DanB on August 02, 2007, 03:06:20 PM
-
I have created a Dynamic Block that is a shrub (landscaping) with the ability to linear array the shrub at 4ft intervals (shrubs are shown as 4ft on centers). Now I would like the ability to count all the shrubs shown on the plan. Now keep in mind the dynamic block is used throughout the drawing. I have tested adding an attribute with a field (distance divided by 4) this gives a total per dyn block insert but then I need to account for each insert and still total them up. Select similar is not very kind when using dymamic blocks as well. Any ideas on being able to account for the array of shrubs within each block? I have also tried defining the shrub as a block and then inserting (nesting) that inside the dynamic block..not any better.
-
Are you comfortable with ActiveX through Lisp? If so, then I think you can code up what you want. I don't use dynamic blocks, so I'm not the best to help, but I can give you a start. The problem with dynamic blocks is once you change a property they become an anonymous block, so you have to gather all blocks within the drawing, and then check their 'EffectiveName' property.
(if (ssget '((0 . "INSERT")))
(vlax-for obj (vla-get-ActiveSelectionSet (vla-get-ActiveDocument (vlax-get-Acad-Object)))
(if (= (vla-get-EffectiveName obj) "BlockNameHere")
(setq BlkList (cons obj BlkList))
)
)
)
Then you can check the dynamic properties of the blocks within the list. Hope that helps.
-
The problem with dynamic blocks is once you change a property they become an anonymous block
Yes, I think this is what hinders the select similar or any filter process. I will try to piece something together with what you have given me.
Thanks.
-
Dan, see this thread for help with selecting Dyn. Blocks:
http://www.theswamp.org/index.php?topic=10054.msg129042#msg129042
-
Thanks for the link.