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

how to get the true name of an anonymous block?

14 REPLIES 14
SOLVED
Reply
Message 1 of 15
swaywood
3775 Views, 14 Replies

how to get the true name of an anonymous block?

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.

Tags (1)
14 REPLIES 14
Message 2 of 15
jeff
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
Message 3 of 15
swaywood
in reply to: jeff

thack you for your reply,i will try as a dynamic block, but maybe it dosnt work.
Message 4 of 15
hgasty1001
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

 

 

Message 5 of 15
DouceDeux
in reply to: hgasty1001

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
Message 6 of 15
hgasty1001
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

 

 

Message 7 of 15
swaywood
in reply to: hgasty1001

hi i have tried, but allway get the "*uxxx" name.
my block is not a dynamic block
Message 8 of 15
_gile
in reply to: swaywood

Hi,

 

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



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 9 of 15
swaywood
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.

Message 10 of 15
_gile
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
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 11 of 15
swaywood
in reply to: _gile

could you tell me how to get the block description?
Message 12 of 15
swaywood
in reply to: _gile

hi,gile

thank you, i have get the block description by blocktablerecord.comments.

 

Message 13 of 15
swaywood
in reply to: _gile

hi,gile

I solved my problem,thank you.

but how can you know the 'comments' property is the same with block description, is there any dictionary descripe this?

i want to know the skill, then i can solve some other problem by myself.

Message 14 of 15
_gile
in reply to: swaywood

I use the ObjectARX docs (here) and/or the Visual Studio Object Browser.



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 15 of 15
swaywood
in reply to: _gile

hi,gile,I found the 'comments' property in the arxdocs, thanks again!

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