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"}
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
These codes are part of the .rc file and not accessible via .NET, sorry.
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