Find blocks with ObjectDbx

Find blocks with ObjectDbx

Anonymous
Not applicable
247 Views
2 Replies
Message 1 of 3

Find blocks with ObjectDbx

Anonymous
Not applicable
I need to find all blockreferences in a drawing using ObjectDbx but my
blocks can be in the paperspace or in the modelspace.
I am using 2 For/Next (one for Layouts and one for modelspace) but is there
a faster way?

Thanks


For Each layout In dwgX.Layouts
For Each objAcad In layout
If StrComp(objAcad.EntityName, "AcDbBlockReference", 1) = 0 Then

........................

End If
Next
Next
0 Likes
248 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Try this way
dim oEnt as AcadEntity
Dim oLayout as AcadLayout
Dim blkRef as acadBlockReference

For Each oLayout In dwgX.Layouts
For Each oEnt In oLayout.Block
If TypeOf oEnt Is AcadBlockReference Then
Set blkRef = oEnt
If blkRef.Name="Desired Name" then
(do something with this block here)
end If
End If
Next
Next

Hth

~'J'~
0 Likes
Message 3 of 3

Anonymous
Not applicable
Modelspace is included in the Layouts collection, it is the "Model"
Layout......no need to do 2 For/Next's. Try what Fatty shows, it should do
just what you want.

"Bux" wrote in message
news:5411974@discussion.autodesk.com...
I need to find all blockreferences in a drawing using ObjectDbx but my
blocks can be in the paperspace or in the modelspace.
I am using 2 For/Next (one for Layouts and one for modelspace) but is there
a faster way?

Thanks


For Each layout In dwgX.Layouts
For Each objAcad In layout
If StrComp(objAcad.EntityName, "AcDbBlockReference", 1) = 0 Then

........................

End If
Next
Next
0 Likes