.NET

Reply
Contributor
19 Posts
1 Kudo
Registered: ‎07-11-2006
Post 1 of 3

Block Name - Please help

73 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
212 Posts
6 Kudos
Registered: ‎10-03-2003
Post 2 of 3

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
19 Posts
1 Kudo
Registered: ‎07-11-2006
Post 3 of 3

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 interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!