.NET

Reply
Valued Contributor
swaywood
Posts: 90
Registered: ‎08-22-2013
Message 1 of 15 (451 Views)
Accepted Solution

how to get the true name of an anonymous block?

451 Views, 14 Replies
12-27-2013 06:41 AM

now i can get the anonymous blockname like 'uxxx', but i want to know the original block name before the insert changed to an anonymous block.

ps,the block is not a dynamic block.

Valued Mentor
jeff
Posts: 322
Registered: ‎05-12-2009
Message 2 of 15 (447 Views)

Re: how to get the true name of an anonymous block?

12-27-2013 06:54 AM in reply to: swaywood

You can use BlockReference.DynamicBlockTableRecord to open the BlockTableRecord and get its name property but if it is not dynamic not sure how that will help.

You can also find your answers @ TheSwamp
Valued Contributor
swaywood
Posts: 90
Registered: ‎08-22-2013
Message 3 of 15 (435 Views)

Re: how to get the true name of an anonymous block?

12-27-2013 07:27 AM in reply to: jeff
thack you for your reply,i will try as a dynamic block, but maybe it dosnt work.
Valued Mentor
gasty1001
Posts: 448
Registered: ‎04-11-2010
Message 4 of 15 (417 Views)

Re: how to get the true name of an anonymous block?

12-27-2013 09:27 AM in reply to: swaywood

Hi,

 

This has been asked before, something like this should help:

 

Public Shared Function GetEffectiveName(ByVal blkref As BlockReference, ByVal acTrans As Transaction) As String
        Dim btr As BlockTableRecord
        btr = acTrans.GetObject(blkref.DynamicBlockTableRecord, OpenMode.ForRead)
        Return btr.Name
    End Function

 Gaston Nunez

 

 

Active Contributor
DouceDeux
Posts: 46
Registered: ‎09-04-2012
Message 5 of 15 (411 Views)

Re: how to get the true name of an anonymous block?

12-27-2013 10:06 AM in reply to: gasty1001
Think you can help me with this Gaston?
It's related to this topic.

http://forums.autodesk.com/t5/NET/Dynamic-Block-Programatic-creation/td-p/4715109
Valued Mentor
gasty1001
Posts: 448
Registered: ‎04-11-2010
Message 6 of 15 (401 Views)

Re: how to get the true name of an anonymous block?

12-27-2013 11:35 AM in reply to: DouceDeux

Hi,

 

I think you should take a look to the developer documentation, this link will help you to understand the object hierarchy in AutoCAD: Hierarchy

 

May be I'm wrong, but I think you can't create create a dynamic block definition with .NET API. Another thing is a block reference, and there is no problem creating one and driving its parameters with the .NET API.

 

Gaston Nunez

 

 

Valued Contributor
swaywood
Posts: 90
Registered: ‎08-22-2013
Message 7 of 15 (376 Views)

Re: how to get the true name of an anonymous block?

12-28-2013 01:19 AM in reply to: gasty1001
hi i have tried, but allway get the "*uxxx" name.
my block is not a dynamic block
*Expert Elite*
_gile
Posts: 2,077
Registered: ‎04-29-2006
Message 8 of 15 (372 Views)

Re: how to get the true name of an anonymous block?

12-28-2013 01:30 AM in reply to: swaywood

Hi,

 

If you could attach a little dwg file with one or more of these anonymous blocks.

Gilles Chanteau
Valued Contributor
swaywood
Posts: 90
Registered: ‎08-22-2013
Message 9 of 15 (365 Views)

Re: how to get the true name of an anonymous block?

12-28-2013 04:15 AM in reply to: swaywood

i attached the dwg file

the block name contains "ISO A1"

and the block description contains "ISO A1" too

i just want to get the blockreforence which contains 'ISO A1" , by block name or by block descrption.

*Expert Elite*
_gile
Posts: 2,077
Registered: ‎04-29-2006
Message 10 of 15 (359 Views)

Re: how to get the true name of an anonymous block?

12-28-2013 05:12 AM in reply to: swaywood

Hi,

 

I don't know how it is possible to get this kind of non-dynamic anonymous block table record...

Anyway, you can get the block table record description using the BlockTableRecord.Comments property.

Gilles Chanteau

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community