.NET

Reply
Active Member
ManfredM
Posts: 10
Registered: ‎04-26-2006
Message 1 of 5 (241 Views)

true name of dynamic block?

241 Views, 4 Replies
06-22-2006 01:54 AM
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
*Joe Sutphin
Message 2 of 5 (241 Views)

Re: true name of dynamic block?

06-22-2006 04:02 AM in reply to: ManfredM
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
Active Member
ManfredM
Posts: 10
Registered: ‎04-26-2006
Message 3 of 5 (241 Views)

Re: true name of dynamic block?

06-22-2006 05:50 AM in reply to: ManfredM
Thanks, but EffectiveName works in VBA only.
*Tony Tanzillo
Message 4 of 5 (241 Views)

Re: true name of dynamic block?

06-22-2006 12:04 PM in reply to: ManfredM
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
Active Member
ManfredM
Posts: 10
Registered: ‎04-26-2006
Message 5 of 5 (241 Views)

Re: true name of dynamic block?

06-25-2006 03:32 AM in reply to: ManfredM
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
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.