Author Topic: Block selection set filtering but for multiple blocknames..  (Read 1300 times)

0 Members and 1 Guest are viewing this topic.

hardwired

  • Guest
Hi,

I'm trying to create a selection set of blocks in modelspace but there are 3 or 4 types of block i want to search for, so each one will have a different blockname obviously - how do i code to search for all blocks that i want? Here's what i have so far:

Code: [Select]
Dim ssBlockZ As AcadSelectionSet  'Selection set for blocks..
Dim blockname(0 To 3) As String  'Name of block picked..

For Each ssBlockZ In ThisDrawing.SelectionSets
    If ssBlockZ.Name = "SSBLOCKZ" Then
        ssBlockZ.Delete
        Exit For
    End If
Next ssBlockZ

blockname(0) = "A1": blockname(1) = "A2": blockname(2) = "A3": blockname(3) = "A4"


Dim FilterType(0 To 3) As Integer  'Selection Set - Filter type..
Dim FilterData(0 To 3) As Variant  'Selection Set - Filter data..

' Create a selection set..
Set ssBlockZ = ThisDrawing.SelectionSets.Add("SSBLOCKZ")
' Set Filters and Add entities (if any) to the Selection Set..
FilterType(0) = 0: FilterData(0) = "INSERT"
FilterType(1) = 2: FilterData(1) = blockname
FilterType(2) = 0: FilterData(2) = 67 'Check what space the block is in..
FilterType(3) = 2: FilterData(3) = 0 'Modelspace..
ssBlockZ.Select acSelectionSetAll, , , FilterType, FilterData

...any ideas?

Glenn R

  • Water Moccasin
  • Posts: 1932
  • What idiot child of married cousins wrote this?!
Re: Block selection set filtering but for multiple blocknames..
« Reply #1 on: July 23, 2008, 07:17:26 AM »
Just string the names together, separating them with commas; don't use an array as you've done.
Me

Glenn R

  • Water Moccasin
  • Posts: 1932
  • What idiot child of married cousins wrote this?!
Re: Block selection set filtering but for multiple blocknames..
« Reply #2 on: July 23, 2008, 07:18:07 AM »
Like so:

"A1,A2,A3"
Me