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

true name of dynamic block?

4 REPLIES 4
Reply
Message 1 of 5
Anonymous
403 Views, 4 Replies

true name of dynamic block?

I want to use the blockname of a given id. With normal blocks it works fine, but dynamic blocks return an anonymous name like *Uxxx. How can i find the true name of the dynamic block?
Dim Btr As BlockTableRecord = CType(ta.GetObject(curBlockRef.BlockTableRecord.ConvertToRedirectedId, OpenMode.ForRead, False), BlockTableRecord)
Dim ProductNo As String = Btr.Name
4 REPLIES 4
Message 2 of 5
Anonymous
in reply to: Anonymous

EffectiveName property?

wrote in message news:5214891@discussion.autodesk.com...
I want to use the blockname of a given id. With normal blocks it works fine,
but dynamic blocks return an anonymous name like *Uxxx. How can i find the
true name of the dynamic block?
Dim Btr As BlockTableRecord =
CType(ta.GetObject(curBlockRef.BlockTableRecord.ConvertToRedirectedId,
OpenMode.ForRead, False), BlockTableRecord)
Dim ProductNo As String = Btr.Name
Message 3 of 5
Anonymous
in reply to: Anonymous

Thanks, but EffectiveName works in VBA only.
Message 4 of 5
Anonymous
in reply to: Anonymous

If the IsDynamicBlock property of the BlockReference returns
true, then you use the DynamicBlockTableRecord property to
get the id of the BlockTableRecord, open that and get its name.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com

wrote in message news:5214891@discussion.autodesk.com...
I want to use the blockname of a given id. With normal blocks it works fine, but dynamic blocks return an anonymous name like *Uxxx. How can i find the true name of the dynamic block?
Dim Btr As BlockTableRecord = CType(ta.GetObject(curBlockRef.BlockTableRecord.ConvertToRedirectedId, OpenMode.ForRead, False), BlockTableRecord)
Dim ProductNo As String = Btr.Name
Message 5 of 5
Anonymous
in reply to: Anonymous

Thanks a lot Tony, it works!

I have a little problem with the property IsDynamicBlock, because it sometimes was false though it was a dynamic block, so i use the anonymous blockname.
For other users i complete my code:

Dim Btr As BlockTableRecord = CType(ta.GetObject(curBlockRef.BlockTableRecord.ConvertToRedirectedId, OpenMode.ForRead, False), BlockTableRecord)
Dim ProductNo As String
If Left(Btr.Name, 1) = "*U" Then
Dim dynObjectID As ObjectId = curBlockRef.DynamicBlockTableRecord
ProductNo = Left(Btr.Name, Len(Btr.Name) - 1)
Dim dynBtr As BlockTableRecord = CType(ta.GetObject(dynObjectID, OpenMode.ForRead, False), BlockTableRecord)
ProductNo = dynBtr.Name
Else
ProductNo = Btr.Name
End If

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