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

Acessing an entities attributes, in particular subassemblies

3 REPLIES 3
Reply
Message 1 of 4
jhdempsey
402 Views, 3 Replies

Acessing an entities attributes, in particular subassemblies

HI All

 

There are two parts to my question

 

The first is a general question about accessing any type of attribute that may exist on an object (eg a block or a Civil 3D assembly)

All the posts ive seen (such as this one https://forums.autodesk.com/t5/net/block-attributes/m-p/2966116#M23057) seem to suggest that the only way for me to extract a particular attribute from an object is to cycle through the objects AttributeCollection and check each attribute until i find the name of the attribute i want. Given that i already know the name of the attribute i want, is there no way of directly accessing it by doing something like obj.AttributeCollection("AttributeName")

 

My second question specifically involves the parameters on a Civil 3D subassembly. Ive already written the code to access the attribute i want, but this attribute in the subassembly properties dialogue box is selected by a drop down list. The value this is currently set as in my subassembly is "Working Width W2" but accessing this value via the API returns a value of "316" which i assume is an ID number of that value in an enumearation list stored somewhere. If i query the attribute object in the immediate window, i get the output shown below

 

So how do i return the value "Working Width W2"?

 

?param
{Autodesk.Civil.DatabaseServices.AppliedSubassemblyParam(Of Integer)}
    Comment: ""
    DesignValue: 316
    DesignValueAsObject: 316
    DisplayName: "Select Working Width"
    IsOverriden: False
    KeyName: "WWidth"
    Value: 316
    ValueAsObject: 316
    ValueType: {Name = "Int32" FullName = "System.Int32"}
3 REPLIES 3
Message 2 of 4
norman.yuan
in reply to: jhdempsey

For your first question, you are confusing the "entity attribute" in most general meanings (any kind of data attached to an AutoCAD entity in various ways) with AutoCAD's block attribute: they are completely different things and you cannot treat block attribute as general data attributes. So, the mentioning of "AttributeClooection" property of an BlockReference object in AutoCAD would not have anything to do with what you asked in your second question.

 

As for your second question, it is purely Civil3D API issue, while this forum is dedicated to plain AutoCAD API. While someones here may also program Civil3D, and may be able to respond to your question, you may get better responses in Civil3D forum here

Norman Yuan

Drive CAD With Code

EESignature

Message 3 of 4

These codes are part of the .rc file and not accessible via .NET, sorry.

Regards,



Augusto Goncalves
Twitter @augustomaia
Autodesk Developer Network
Message 4 of 4

If all other means fail, and the 'attribute' you're trying to access appears in AutoCAD's properties palette when the object is selected, you can use code like that posted in this topic, to access values that appear in the properties palette.

 


@norman.yuanwrote:

For your first question, you are confusing the "entity attribute" in most general meanings (any kind of data attached to an AutoCAD entity in various ways) with AutoCAD's block attribute: they are completely different things and you cannot treat block attribute as general data attributes. So, the mentioning of "AttributeClooection" property of an BlockReference object in AutoCAD would not have anything to do with what you asked in your second question.

 

As for your second question, it is purely Civil3D API issue, while this forum is dedicated to plain AutoCAD API. While someones here may also program Civil3D, and may be able to respond to your question, you may get better responses in Civil3D forum here


 

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