.NET

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

Block Name - Please help

72 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 (72 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 (72 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
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.