Group code of Dynamic Block for SelectionSet filtering

Group code of Dynamic Block for SelectionSet filtering

Anonymous
Not applicable
403 Views
3 Replies
Message 1 of 4

Group code of Dynamic Block for SelectionSet filtering

Anonymous
Not applicable
Is there any group code for selectionset filtering in VBA ?
0 Likes
404 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
Perhaps vba is one up on dxf for once, I cant find one. Hopefully there is a better way than below
Set oBlocks = ThisDrawing.Blocks
Set SS = ThisDrawing.SelectionSets.Add("SS")
SS.Select 5, , , FilterType, FilterData

For i = 0 To SS.Count - 1
If Not oBlocks(SS(i).Name).IsXRef Then
Set oBref = SS(i)
If oBref.IsDynamicBlock Then
Debug.Print oBref.Name
End If
End If
Next
0 Likes
Message 3 of 4

Anonymous
Not applicable
i use a similiar approach but to first make a selectionset with filter only
to block reference and then remove all static blocks
but it seem it is quite slow to do what i want when no. of static block
compare to no. of dynamic block is quite large


here is my code

Set sset = ThisDrawing.SelectionSets.Add("temp")
intcodes(0) = 0
varCodeValues(0) = "INSERT"
sset.SelectOnScreen intcodes, varCodeValues

i = 0
For Each ent In sset
If Not ent.IsDynamicBlock Then
i = i + 1
ReDim Preserve ents(0 To i - 1)
Set ents(i - 1) = ent
End If
Next
If i > 0 Then sset.RemoveItems ents




wrote in message news:5022853@discussion.autodesk.com...
Perhaps vba is one up on dxf for once, I cant find one. Hopefully there is a
better way than below
Set oBlocks = ThisDrawing.Blocks
Set SS = ThisDrawing.SelectionSets.Add("SS")
SS.Select 5, , , FilterType, FilterData

For i = 0 To SS.Count - 1
If Not oBlocks(SS(i).Name).IsXRef Then
Set oBref = SS(i)
If oBref.IsDynamicBlock Then
Debug.Print oBref.Name
End If
End If
Next
0 Likes
Message 4 of 4

Anonymous
Not applicable
redim preserve is slow, better to add to a new collection
0 Likes