Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        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;
        }
Exemple #4
0
        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);
        }
Exemple #5
0
        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);
            }
        }