Author Topic: Dynamic Blocks and Count  (Read 3108 times)

0 Members and 1 Guest are viewing this topic.

DanB

  • Bull Frog
  • Posts: 367
Dynamic Blocks and Count
« 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.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Dynamic Blocks and Count
« Reply #1 on: August 02, 2007, 03:16:22 PM »
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.

Code: [Select]
(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.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

DanB

  • Bull Frog
  • Posts: 367
Re: Dynamic Blocks and Count
« Reply #2 on: August 02, 2007, 03:56:28 PM »
Quote

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.

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: Dynamic Blocks and Count
« Reply #3 on: August 02, 2007, 04:38:03 PM »
Dan, see this thread for help with selecting Dyn. Blocks:

http://www.theswamp.org/index.php?topic=10054.msg129042#msg129042

DanB

  • Bull Frog
  • Posts: 367
Re: Dynamic Blocks and Count
« Reply #4 on: August 03, 2007, 07:51:57 AM »
Thanks for the link.