Author Topic: List inserted blocks  (Read 2490 times)

0 Members and 1 Guest are viewing this topic.

Matt__W

  • Seagull
  • Posts: 12955
  • I like my water diluted.
List inserted blocks
« on: October 22, 2008, 10:19:10 AM »
Okay, so I'm having a brain melt-down this morning and can't seem to figure this stupid thing out.  I need to list the blocks that are inserted in MS.  The code I've got so far lists ALL of the blocks inserted.  In other words, if BLOCK_A is inserted 5 times, I get BLOCK_A, BLOCK_A, BLOCK_A, etc...  I simply want BLOCK_A - nothing else.  I only need to know that it exists in MS, I don't care how MANY exist.  So, that being said... what's the best way to to approach this?  Should I add all of the blocks to an array, and as I encounter a block with a name that already exists, skip it and move to the next?  I thought there was a really stupid-simple way to just list the block names.   Hmmmm....  maybe I'm getting AcadBlock and AcadBlockReference mixed up again.  :|
Autodesk Expert Elite
Revit Subject Matter Expert (SME)
Owner/FAA sUAS Pilot @ http://skyviz.io

Jeff_M

  • King Gator
  • Posts: 4094
  • C3D user & customizer
Re: List inserted blocks
« Reply #1 on: October 22, 2008, 10:37:52 AM »
I'm not sure which would be quicker.....

Option A: Get a selection set of all MS blocks, loop through the SS and remove duplicates.

Option B: Loop through the Blocks collection (omitting Layouts) and use each block name in a filtered SS (filtering with the name and MS flag) keeping track of which ones return a SS.Count > 0


Matt__W

  • Seagull
  • Posts: 12955
  • I like my water diluted.
Re: List inserted blocks
« Reply #2 on: October 22, 2008, 10:39:54 AM »
I'm not sure which would be quicker.....

Option A: Get a selection set of all MS blocks, loop through the SS and remove duplicates.

Option B: Loop through the Blocks collection (omitting Layouts) and use each block name in a filtered SS (filtering with the name and MS flag) keeping track of which ones return a SS.Count > 0

That's what I'm leaning towards.  Thanks.
Autodesk Expert Elite
Revit Subject Matter Expert (SME)
Owner/FAA sUAS Pilot @ http://skyviz.io

Matt__W

  • Seagull
  • Posts: 12955
  • I like my water diluted.
Re: List inserted blocks
« Reply #3 on: October 22, 2008, 01:05:48 PM »
There's been a slight change in plans.

I'm now gathering the list of blocks via ObjectDBX (sniffing multiple drawings now) and storing them in a Dictionary (the MS Scripting kind) and sorting them alphabetically using a BubbleSort function.
Autodesk Expert Elite
Revit Subject Matter Expert (SME)
Owner/FAA sUAS Pilot @ http://skyviz.io