Know which AttributeDefinition does an AttributeReference relates to?

Know which AttributeDefinition does an AttributeReference relates to?

Anonymous
Not applicable
1,459 Views
3 Replies
Message 1 of 4

Know which AttributeDefinition does an AttributeReference relates to?

Anonymous
Not applicable

I know i'ts an odd question but here's my problem:

 

I am making this application that automates the filling of Attributed Blocks (Drawing Titles) within several layouts in the same drawing.

The thing is that I'm having trouble to recognize each AttributeReference in a unique way:

 

 - Blocks can have several attributes with the same tag so that property won't do;

 - The user can mess up the entire BlockReference AttributeCollection via the command BATTMAN, what makes the ORDER not the best option neither;

 - I thought about deleting and recreating every AttributeReference but some changes made by the user such as position, textstyle, rotation, etc will be lost.

 

Here's the few properties a AttributeReference have:

Capture.PNG

And here's a glimpse on how my app for editing these Attributes looks like:

 

Capture2.PNG

 As you can see in the example above the Title block has 4 Attributes with the same tag - "DASD" (ignore the brackets). So how can I be sure of which is which when applying user changes?

 

 

 Should I use Xdata?

 

 

 

 

 

Accepted solutions (2)
1,460 Views
3 Replies
Replies (3)
Message 2 of 4

_gile
Consultant
Consultant
Accepted solution

chavesgalinari a écrit :
 - Blocks can have several attributes with the same tag so that property won't do;

 - The user can mess up the entire BlockReference AttributeCollection via the command BATTMAN, what makes the ORDER not the best option neither;

 


If so, and if attribute positions are locked, perhaps you can use the attributes positions (attribute definition position transformed by block reference transform).

 

I never understood why AutoCAD allows attributes with the same tag. It is a heresy.



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 3 of 4

FRFR1426
Collaborator
Collaborator
Accepted solution

This is a good question... In fact there are no real link between an attribute reference and an attribute definition. The definition is only a template for creating the reference. After that, the attribute reference can live its own life (its attributes can change). The Tag property is only there to handle exploding.

 

In your case (title blocks), attribute position should be locked (I think users will have no interest in moving the block's attributes) and use, like @_gile suggested, the position to match reference to definition. If there are a fixed set of title block, you can also display in your column header the label which is near the attribute. And there is also the prompt which can be different.

Maxence DELANNOY
Manager
Add-ins development for Autodesk software products
http://wiip.fr
0 Likes
Message 4 of 4

Anonymous
Not applicable

Thanks _gile and FRFR1426. I'll follow your suggestions and go with the Attribute position.

0 Likes