This method adds or modifies feature attributes on an entity of a feature layer. If the field exists on the entity, and the specified field type matches the supplied value, it overwrites the existing value.
Note:
Some fields may be read-only. See the Field attributes topic for more information.
Declaration
public bool Esri.ArcGISForAutoCAD.Attributes.Set(Document doc, ObjectId objId, string flName, Dictionary<String, IConvertible> data)
Parameters
| Type | Name | Description | Required |
|---|---|---|---|
Document | doc | The AutoCAD document to act on. | required |
ObjectId | objId | The AutoCAD ObjectId of the feature. | required |
string | flName | An existing feature layer name in the drawing. | required |
Dictionary<string, IConvertible> | data | A dictionary of field names and values. Note:When working with fields that have coded domain values, use the field description value and not the code. | required |
Returns
| Type | Description |
|---|---|
bool | true if the attributes were set successfully |
Remarks on error conditions
This method may throw an exception or return false or null if a parameter is invalid.
Example
Print the success of setting the StreetName, Pavement, and Rating attribute values of the designated Centerlines feature entity.// Initialize
var doc = Application.DocumentManager.MdiActiveDocument;
var objectId = Esri.ArcGISForAutoCAD.FeatureLayer.SelectEntity(doc, "Centerlines");
var data = new Dictionary<string, IConvertible> { {"StreetName", "Main"}, {"Pavement", 2}, {"Rating", 0.852} };
// Set the designated attribute values
var success = Esri.ArcGISForAutoCAD.Attributes.Set(doc, objectId, "Centerlines", data);
// Print the success
doc.Editor.WriteMessage(success.ToString());
/* Example output
True
*/
See also
FeatureLayer.SelectEntity —A .NET method that prompts for the selection of one entity and returns its AutoCAD ObjectId.
esri_attributes_set —An AutoLISP function that modifies feature attributes on an entity of a feature layer.