Hello,
could someone tell me how to add new Properties/PropertySets to an object?
There is the Function “api.AddOrChangeObjectProperty(def, data);” but I’m unable to use it.
best regards
Alex
Hello,
This code should add property to the selected object. New Property and property set should appear at the bottom of property list.
if (api.GetSelected().Length > 0)
{
string exampleSetName = “New set name”;
string examplePropertyName = “New property name”;
string examplePropertyValue = “65”;
string examplePropertyUnit = “cm”;
PropertyData newData = new PropertyData();
newData.name = examplePropertyName;
newData.value_num = Int32.Parse(examplePropertyValue);
newData.value_type = ValueType.vt_int;
newData.unit = examplePropertyUnit;
PropertyDef newDef = new PropertyDef();
newDef.object_id = api.GetSelected()[0];
newDef.set_name = exampleSetName;
newDef.name = examplePropertyName;
api.AddOrChangeObjectProperty(newDef, newData);
api.Invalidate();
}
Best regards,
BIMvision Team