public static IfcExtendedMaterialProperties GetExtendedProperties(this IfcMaterial material, IModel model, string pSetName, bool caseSensitive = true) { IfcExtendedMaterialProperties result = caseSensitive ? model.Instances.Where <IfcExtendedMaterialProperties>(pSet => pSet.Name == pSetName && pSet.Material == material).FirstOrDefault() : model.Instances.Where <IfcExtendedMaterialProperties>(pSet => pSet.Name.ToString().ToLower() == pSetName.ToLower() && pSet.Material == material).FirstOrDefault(); return(result); }
public static IfcPropertySingleValue GetExtendedSingleValue(this IfcMaterial material, IModel model, string pSetName, string propertyName) { IfcExtendedMaterialProperties pSet = GetExtendedProperties(material, model, pSetName); if (pSet == null) { return(null); } IfcPropertySingleValue result = pSet.ExtendedProperties.Where <IfcPropertySingleValue>(sv => sv.Name == propertyName).FirstOrDefault(); return(result); }
public static void DeleteExtendedSingleValue(this IfcMaterial material, IModel model, string pSetName, string propertyName) { IfcExtendedMaterialProperties pSet = GetExtendedProperties(material, model, pSetName); if (pSet == null) { return; } IfcPropertySingleValue singleValue = GetExtendedSingleValue(material, model, pSetName, propertyName); if (singleValue == null) { return; } singleValue.NominalValue = null; }
public static IfcValue GetExtendedSingleValueValue(this IfcMaterial material, IModel model, string pSetName, string propertyName) { IfcExtendedMaterialProperties pSet = GetExtendedProperties(material, model, pSetName); if (pSet == null) { return(null); } IfcPropertySingleValue singleValue = GetExtendedSingleValue(material, model, pSetName, propertyName); if (singleValue == null) { return(null); } IfcValue result = singleValue.NominalValue; return(result); }
public static void SetExtendedSingleValue(this IfcMaterial material, IModel model, string pSetName, string propertyName, IfcValue value) { IfcExtendedMaterialProperties pSet = GetExtendedProperties(material, model, pSetName) ?? model.Instances.New <IfcExtendedMaterialProperties>(ps => { ps.Material = material; ps.Name = pSetName; }); IfcPropertySingleValue singleValue = GetExtendedSingleValue(material, model, pSetName, propertyName); if (singleValue == null) { singleValue = model.Instances.New <IfcPropertySingleValue>(sv => { sv.Name = propertyName; sv.NominalValue = value; }); pSet.ExtendedProperties.Add(singleValue); } }