.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Block Name - Please help

2 REPLIES 2
Reply
Message 1 of 3
Natalie-C
166 Views, 2 Replies

Block Name - Please help

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!
2 REPLIES 2
Message 2 of 3
Mikko
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
Message 3 of 3
Natalie-C
in reply to: Natalie-C

THANK YOU SOOO much! That's exactly what I needed.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost