.NET

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

Block Name - Please help

71 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 (71 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 (71 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.
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!