.NET

Reply
Contributor
Natalie-C
Posts: 19
Registered: ‎07-11-2006
Message 1 of 3 (67 Views)

Block Name - Please help

67 Views, 2 Replies
07-11-2006 07:43 AM
OK, this is the code I have......

For Each id In btr
Dim ent As Entity = CType(trans.GetObject(id, OpenMode.ForRead, False), Entity)
If TypeOf ent Is BlockReference Then
Dim br As BlockReference = CType(ent, BlockReference)
If br.Layer() = "WantedLayer" Then

'DO STUFF

End If
End If

I know I can get the layer id by br.LayerID and I can get the block id by br.BlockID. What I really need is the Block Name. Can anyone point me in the right direction??

Thanks in advance!
Distinguished Contributor
Mikko
Posts: 212
Registered: ‎10-03-2003
Message 2 of 3 (67 Views)

Re: Block Name - Please help

07-11-2006 11:34 AM in reply to: Natalie-C
Something similar to this:

If TypeOf ent Is BlockReference Then
Dim blkRef As BlockReference
blkRef = ent
Dim BRId As ObjectId = blkRef.BlockTableRecord
Dim btr As BlockTableRecord
btr = CType(trans.GetObject(BRId, OpenMode.ForRead), BlockTableRecord)
MsgBox("Your Block Name Is " + btr.Name() + vbCrLf)
End If
Contributor
Natalie-C
Posts: 19
Registered: ‎07-11-2006
Message 3 of 3 (67 Views)

Re: Block Name - Please help

07-11-2006 12:57 PM in reply to: Natalie-C
THANK YOU SOOO much! That's exactly what I needed.

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community