.NET

.NET

Reply
Valued Contributor
91 Posts
1 Kudo
Registered: ‎08-22-2013
Post 1 of 15
Accepted Solution

how to get the true name of an anonymous block?

591 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
341 Posts
53 Kudos
Registered: ‎05-12-2009
Post 2 of 15

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
91 Posts
1 Kudo
Registered: ‎08-22-2013
Post 3 of 15

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
582 Posts
91 Kudos
Registered: ‎04-11-2010
Post 4 of 15

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
47 Posts
4 Kudos
Registered: ‎09-04-2012
Post 5 of 15

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
582 Posts
91 Kudos
Registered: ‎04-11-2010
Post 6 of 15

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
91 Posts
1 Kudo
Registered: ‎08-22-2013
Post 7 of 15

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*
2,142 Posts
255 Kudos
Registered: ‎04-29-2006
Post 8 of 15

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
91 Posts
1 Kudo
Registered: ‎08-22-2013
Post 9 of 15

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*
2,142 Posts
255 Kudos
Registered: ‎04-29-2006
Post 10 of 15

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 interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!