.NET

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

how to get the true name of an anonymous block?

548 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.

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.

Valued Mentor
jeff
Posts: 335
Registered: ‎05-12-2009
Message 2 of 15 (544 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: 91
Registered: ‎08-22-2013
Message 3 of 15 (532 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.
Distinguished Mentor
gasty1001
Posts: 577
Registered: ‎04-11-2010
Message 4 of 15 (514 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 (508 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
Distinguished Mentor
gasty1001
Posts: 577
Registered: ‎04-11-2010
Message 6 of 15 (498 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: 91
Registered: ‎08-22-2013
Message 7 of 15 (473 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,114
Registered: ‎04-29-2006
Message 8 of 15 (469 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: 91
Registered: ‎08-22-2013
Message 9 of 15 (462 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,114
Registered: ‎04-29-2006
Message 10 of 15 (456 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
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!