// Set/create a custom sheet or sheet set property private void SetCustomProperty(IAcSmPersist owner, string propertyName, object propertyValue, PropertyFlags sheetSetFlag) { // Create a reference to the Custom Property Bag AcSmCustomPropertyBag customPropertyBag = default(AcSmCustomPropertyBag); if (owner.GetTypeName() == "AcSmSheet") { AcSmSheet sheet = (AcSmSheet)owner; customPropertyBag = sheet.GetCustomPropertyBag(); } else { AcSmSheetSet sheetSet = (AcSmSheetSet)owner; customPropertyBag = sheetSet.GetCustomPropertyBag(); } // Create a reference to a Custom Property Value AcSmCustomPropertyValue customPropertyValue = new AcSmCustomPropertyValue(); customPropertyValue.InitNew(owner); // Set the flag for the property customPropertyValue.SetFlags(sheetSetFlag); // Set the value for the property customPropertyValue.SetValue(propertyValue); // Create the property customPropertyBag.SetProperty(propertyName, customPropertyValue); }
public void CreateProps(List <SSProp> props) { using (new SSLock(ssDb)) { Update(); ss.GetCustomProperties(true, this); if (props?.Any() == true) { var bag = ss.GetCustomPropertyBag(); foreach (var prop in props.AsEnumerable().Reverse()) { bag.AddCustomProperty(ss, prop, this); } } Update(); } }