.NET

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

Block Name - Please help

66 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
Posts: 209
Registered: ‎10-03-2003
Message 2 of 3 (66 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
Posts: 19
Registered: ‎07-11-2006
Message 3 of 3 (66 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
Welcome to the new Autodesk Community!
If this is your first visit, click here to get started and make the most of the Community. Let us know what you think of the new experience in the Community Feedback Forum.

Need installation help?

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

Ask the Community