Faster Way to Find Specific Block?

Faster Way to Find Specific Block?

Anonymous
Not applicable
336 Views
2 Replies
Message 1 of 3

Faster Way to Find Specific Block?

Anonymous
Not applicable
I want to find a block in PaperSpace called TitleBlock. If there will always be only one instance of it, is there a quicker way to find it than cycling thru all of the entities?

Dim objFndIN As AcadEntity
Dim attsIN As Variant

For Each objFndIN In ThisDrawing.PaperSpace
If TypeOf objFndIN Is AcadBlockReference Then
Set oblkRefIN = objFndIN
If StrComp(UCase(oblkRefIN.Name), "TITLEBLOCK", 1) = 0 Then
'/// FOUND IT
Exit For
End If
End If
Next objFndIN


If it's a complex drawing, this may take a while, and if I have to repeat it a hundred times or more, it really takes a long time.

Seems like if you know its name, there should be a quicker way to find it.

Any ideas?

Thanks.
0 Likes
337 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Use SelectionSet.Select() with proper filters - type: "INSERT", name:
TITLEBLOCK


wrote in message news:5741788@discussion.autodesk.com...
I want to find a block in PaperSpace called TitleBlock. If there will
always be only one instance of it, is there a quicker way to find it than
cycling thru all of the entities?

Dim objFndIN As AcadEntity
Dim attsIN As Variant

For Each objFndIN In ThisDrawing.PaperSpace
If TypeOf objFndIN Is AcadBlockReference Then
Set oblkRefIN = objFndIN
If StrComp(UCase(oblkRefIN.Name), "TITLEBLOCK", 1) = 0 Then
'/// FOUND IT
Exit For
End If
End If
Next objFndIN


If it's a complex drawing, this may take a while, and if I have to repeat it
a hundred times or more, it really takes a long time.

Seems like if you know its name, there should be a quicker way to find it.

Any ideas?

Thanks.
0 Likes
Message 3 of 3

Anonymous
Not applicable
Thanks, Norman.

I went thru the posts and amassed quite a batch of source code of all the different flavors of selectionsets. Gonna digest them on the plane Monday.
0 Likes