/// <summary> /// Get all properties from a steel object /// </summary> /// <param name="steelObject"> Steel object</param> /// <returns name="properties"> List with all properties extracted from the input object</returns> public static List <Property> GetObjectProperties(SteelDbObject steelObject) { List <Property> ret = new List <Property>() { }; using (var ctx = new SteelServices.DocContext()) { FilerObject filerObj = Utils.GetObject(steelObject.Handle); Dictionary <string, Property> allProperties = Utils.GetAllProperties(filerObj); foreach (KeyValuePair <string, Property> prop in allProperties) { if (prop.Value.ElementTypeList.Contains(filerObj.Type())) { Property extractionProperty = prop.Value; if (extractionProperty != null) { if (extractionProperty.EvaluateFromObject(filerObj)) { ret.Add(extractionProperty); } } } } } return(ret); }
/// <summary> /// Set a property for a Steel Object /// </summary> /// <param name="steelObject"> Steel Object</param> /// <param name="property"> Property object</param> /// <returns name="steelObject"> The updated steel object</returns> public static SteelDbObject SetObjectProperty(SteelDbObject steelObject, Property property) { if (property.IsReadOnly) { throw new System.Exception("property is readonly"); } using (var ctx = new SteelServices.DocContext()) { FilerObject fo = Utils.GetObject(steelObject.Handle); if (fo != null) { property.SetToObject(fo); return(steelObject); } else { throw new System.Exception("No Advance Steel Object Found"); } } }
/// <summary> /// Get a property from a steel object /// </summary> /// <param name="steelObject"> Steel object</param> /// <param name="propertyName"> Name of the property</param> /// <returns name="property">The desired property</returns> public static Property GetObjectProperty(SteelDbObject steelObject, string propertyName) { Property ret = null; using (var ctx = new SteelServices.DocContext()) { FilerObject filerObj = Utils.GetObject(steelObject.Handle); Property extractionProperty = Utils.GetProperty(propertyName); if (extractionProperty != null) { if (extractionProperty.EvaluateFromObject(filerObj)) { ret = extractionProperty; } } else { throw new System.Exception("No property found for the given name"); } } return(ret); }