Esempio n. 1
0
 public IfcPropertyBoundedValue(IfcIdentifier __Name, IfcText?__Description, IfcValue __UpperBoundValue, IfcValue __LowerBoundValue, IfcUnit __Unit)
     : base(__Name, __Description)
 {
     this._UpperBoundValue = __UpperBoundValue;
     this._LowerBoundValue = __LowerBoundValue;
     this._Unit            = __Unit;
 }
Esempio n. 2
0
        public override void Parse(int propIndex, IPropertyValue value, int[] nestedIndex)
        {
            switch (propIndex)
            {
            case 0:
            case 1:
                base.Parse(propIndex, value, nestedIndex);
                return;

            case 2:
                _upperBoundValue = (IfcValue)(value.EntityVal);
                return;

            case 3:
                _lowerBoundValue = (IfcValue)(value.EntityVal);
                return;

            case 4:
                _unit = (IfcUnit)(value.EntityVal);
                return;

            case 5:
                _setPointValue = (IfcValue)(value.EntityVal);
                return;

            default:
                throw new XbimParserException(string.Format("Attribute index {0} is out of range for {1}", propIndex + 1, GetType().Name.ToUpper()));
            }
        }
Esempio n. 3
0
        public static void SetExtendedSingleValue(this IfcMaterial material, string pSetName, string propertyName,
                                                  IfcValue value)
        {
            IModel model = material.Model;

            SetExtendedSingleValue(material, model, pSetName, propertyName, value);
        }
Esempio n. 4
0
        internal ElementTypeIfcProperties(IfcElementType type) : base(type)
        {
            string keyword  = type.KeyWord;
            bool   readOnly = true;

            foreach (IfcPropertySet pset in type.HasPropertySets.OfType <IfcPropertySet>())
            {
                foreach (IfcPropertySingleValue psv in pset.HasProperties.Values.ToList().OfType <IfcPropertySingleValue>())
                {
                    IfcValue val = psv.NominalValue;
                    if (val == null)
                    {
                        Add(new CustomProperty(psv.Name, "", typeof(string), readOnly, true)
                        {
                            Group = pset.Name
                        });
                    }
                    else
                    {
                        Object obj = val.Value;
                        Add(new CustomProperty(psv.Name, obj, obj.GetType(), readOnly, true)
                        {
                            Group = pset.Name
                        });
                    }
                }
            }
        }
        public override void IfcParse(int propIndex, IPropertyValue value)
        {
            switch (propIndex)
            {
            case 0:
            case 1:
                base.IfcParse(propIndex, value);
                break;

            case 2:
                _upperBoundValue = (IfcValue)value.EntityVal;
                break;

            case 3:
                _lowerBoundValue = (IfcValue)value.EntityVal;
                break;

            case 4:
                _unit = (IfcUnit)value.EntityVal;
                break;

            default:
                this.HandleUnexpectedAttribute(propIndex, value); break;
            }
        }
 internal static XmlNode convert(XmlDocument doc, IfcValue value,string name)
 {
     string keyword = value.GetType().Name;
     XmlElement v = doc.CreateElement(keyword + "-wrapper");
     v.InnerText = value.Value.ToString();
     if (string.IsNullOrEmpty(name))
         return v;
     XmlElement element = doc.CreateElement(name);
     element.AppendChild(v);
     return element;
 }
Esempio n. 7
0
 //private IfcUnit _ifcUnit;
 protected BbSingleProperty(string name, string value, Type type)
 {
     Name = name;
     _ifcValue = new IfcValue ();
     var iValue =  Activator.CreateInstance(type) as STRING;
     iValue.Value = value;
     _ifcValue.Value = iValue;
     _ifcPropertySingleValue = new IfcPropertySingleValue{
         Name = this.Name,
         NominalValue = _ifcValue,
     };
 }
Esempio n. 8
0
 protected BbSingleProperty(string name, bool value)
 {
     Name = name;
     _ifcValue = new IfcValue();
     var iValue = new IfcBoolean {Value = value};
     _ifcValue.Value = iValue;
     _ifcPropertySingleValue = new IfcPropertySingleValue
         {
             Name = this.Name,
             NominalValue = _ifcValue,
         };
 }
Esempio n. 9
0
 protected BbSingleProperty(string name, DateTime value)
 {
     Name = name;
     _ifcValue = new IfcValue();
     var iValue = IfcTimeStamp.GetTimeStamp(value);
     _ifcValue.Value = iValue;
     _ifcPropertySingleValue = new IfcPropertySingleValue
     {
         Name = this.Name,
         NominalValue = _ifcValue,
     };
 }
Esempio n. 10
0
        internal ObjectIfcProperties(IfcElement element)
        {
            bool readOnly = true;

            Add(new CustomProperty("GlobalId", element.GlobalId, typeof(string), true, true)
            {
                Group = "Element"
            });
            Add(new CustomProperty("Name", element.Name, typeof(string), readOnly, true)
            {
                Group = "Element"
            });
            Add(new CustomProperty("Description", element.Description, typeof(string), readOnly, true)
            {
                Group = "Element"
            });
            Add(new CustomProperty("ObjectType", element.ObjectType, typeof(string), readOnly, true)
            {
                Group = "Element"
            });
            Add(new CustomProperty("Type", element.GetType().Name, typeof(string), true, true)
            {
                Group = "Element"
            });
            Add(new CustomProperty("Tag", element.Tag, typeof(string), readOnly, true)
            {
                Group = "Element"
            });

            foreach (IfcPropertySet pset in element.IsDefinedBy.ToList().ConvertAll(x => x.RelatingPropertyDefinition).OfType <IfcPropertySet>())
            {
                foreach (IfcPropertySingleValue psv in pset.HasProperties.Values.ToList().OfType <IfcPropertySingleValue>())
                {
                    IfcValue val = psv.NominalValue;
                    if (val == null)
                    {
                        Add(new CustomProperty(psv.Name, "", typeof(string), readOnly, true)
                        {
                            Group = pset.Name
                        });
                    }
                    else
                    {
                        Object obj = val.Value;
                        Add(new CustomProperty(psv.Name, obj, obj.GetType(), readOnly, true)
                        {
                            Group = pset.Name
                        });
                    }
                }
            }
        }
Esempio n. 11
0
        /// <summary>
        /// Returns the Reference ID for this specified type in this project (e.g. type 'A-1'), if known
        /// </summary>
        /// <param name="window"></param>
        /// <returns></returns>
        public static IfcIdentifier?GetReference(this IfcWindow window)
        {
            IfcValue val = window.GetPropertySingleNominalValue("Pset_WindowCommon", "Reference ");

            if (val != null && val is IfcIdentifier)
            {
                return((IfcIdentifier)val);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 12
0
        /// <summary>
        /// Returns if the door is external, default is false if not specified
        /// </summary>
        /// <param name="window"></param>
        /// <returns></returns>
        public static IfcBoolean GetIsExternal(this IfcWindow window)
        {
            IfcValue val = window.GetPropertySingleNominalValue("Pset_WindowCommon", "IsExternal");

            if (val != null && val is IfcBoolean)
            {
                return((IfcBoolean)val);
            }
            else
            {
                return(new IfcBoolean(false)); //default is to return false
            }
        }
 public Sorting_IFCSpace(IfcLabel?Name, int EntityLabel, IfcValue CoolingLoad, IfcValue HeatingLoad, IfcValue LightingLoad, IfcValue PowerLoad, IfcValue CoolingLoad_pa, IfcValue HeatingLoad_pa, IfcValue LightingLoad_pa, IfcValue PowerLoad_pa)
 {
     this.Name            = Name;
     this.EntityLabel     = EntityLabel;
     this.CoolingLoad     = CoolingLoad;
     this.HeatingLoad     = HeatingLoad;
     this.LightingLoad    = LightingLoad;
     this.PowerLoad       = PowerLoad;
     this.CoolingLoad_pa  = CoolingLoad_pa;
     this.HeatingLoad_pa  = HeatingLoad_pa;
     this.LightingLoad_pa = LightingLoad_pa;
     this.PowerLoad_pa    = PowerLoad_pa;
 }
Esempio n. 14
0
 protected BbListProperty(string name, int value, Type type)
 {
     Name = name;
     var _ifcValue = new IfcValue();
     var iValue = Activator.CreateInstance(type) as INTEGER;
     iValue.Value = value;
     _ifcValue.Value = iValue;
     _ifcPropertyListValue = new IfcPropertyListValue
     {
         Name = this.Name,
         ListValues = new List<IfcValue> { _ifcValue },
     };
 }
Esempio n. 15
0
        /// <summary>
        /// Returns whether the door is a Fire Exit or not, null if not known
        /// </summary>
        /// <param name="door"></param>
        /// <returns></returns>
        public static IfcBoolean?GetFireExit(this IfcDoor door)
        {
            IfcValue val = door.GetPropertySingleNominalValue("Pset_DoorCommon", "FireExit ");

            if (val != null && val is IfcBoolean)
            {
                return((IfcBoolean)val);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 16
0
        //private IfcUnit _ifcUnit;

        protected BbSingleProperty(string name, string value, Type type)
        {
            Name      = name;
            _ifcValue = new IfcValue();
            var iValue = Activator.CreateInstance(type) as STRING;

            iValue.Value            = value;
            _ifcValue.Value         = iValue;
            _ifcPropertySingleValue = new IfcPropertySingleValue {
                Name         = this.Name,
                NominalValue = _ifcValue,
            };
        }
Esempio n. 17
0
        protected BbSingleProperty(string name, DateTime value)
        {
            Name      = name;
            _ifcValue = new IfcValue();
            var iValue = IfcTimeStamp.GetTimeStamp(value);

            _ifcValue.Value         = iValue;
            _ifcPropertySingleValue = new IfcPropertySingleValue
            {
                Name         = this.Name,
                NominalValue = _ifcValue,
            };
        }
Esempio n. 18
0
        /// <summary>
        /// Returns the fire rating if defined
        /// </summary>
        /// <param name="window"></param>
        /// <returns></returns>
        public static IfcLabel?GetFireRating(this IfcWindow window)
        {
            IfcValue val = window.GetPropertySingleNominalValue("Pset_WindowCommon", "FireRating ");

            if (val != null && val is IfcLabel)
            {
                return((IfcLabel)val);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 19
0
        /// <summary>
        /// Returns the fire rating if defined
        /// </summary>
        /// <param name="door"></param>
        /// <returns></returns>
        public static IfcLabel?GetFireRating(this IfcDoor door)
        {
            IfcValue val = door.GetPropertySingleNominalValue("Pset_DoorCommon", "FireRating ");

            if (val != null && val is IfcLabel)
            {
                return((IfcLabel)val);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 20
0
        /// <summary>
        /// True if the wall is external
        /// </summary>
        /// <param name="wall"></param>
        /// <returns></returns>
        public static IfcBoolean?GetIsExternal(this IfcWall wall)
        {
            IfcValue val = wall.GetPropertySingleNominalValue("Pset_WallCommon", "IsExternal");

            if (val != null && val is IfcBoolean)
            {
                return((IfcBoolean)val);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 21
0
        protected BbSingleProperty(string name, double value, Type type)
        {
            Name = name;
            _ifcValue = new IfcValue ();
            var iValue =  Activator.CreateInstance(type) as REAL;
            if (iValue == null) throw new InvalidOperationException();
            iValue.Value = value;

            _ifcValue.Value = iValue;
            _ifcPropertySingleValue = new IfcPropertySingleValue{
                Name = this.Name,
                NominalValue = _ifcValue,
            };
        }
Esempio n. 22
0
        public void AddMoreList(string value)
        {
            if (_ifcPropertyListValue.ListValues.Count < 1)
            {
                return;
            }

            var _ifcValue = new IfcValue();
            var iValue    = Activator.CreateInstance(_ifcPropertyListValue.ListValues[0].GetType()) as STRING;

            iValue.Value    = value;
            _ifcValue.Value = iValue;
            _ifcPropertyListValue.ListValues.Add(_ifcValue);
        }
Esempio n. 23
0
        public static void SetPropertyTableItemValue(this Xbim.Ifc2x3.Kernel.IfcObject obj, string pSetName, string propertyTableName, IfcValue definingValue, IfcValue definedValue, IfcUnit definingUnit, IfcUnit definedUnit)
        {
            IfcPropertySet pset  = GetPropertySet(obj, pSetName);
            IModel         model = null;

            if (pset == null)
            {
                model     = obj.ModelOf;
                pset      = model.Instances.New <IfcPropertySet>();
                pset.Name = pSetName;
                IfcRelDefinesByProperties relDef = model.Instances.New <IfcRelDefinesByProperties>();
                relDef.RelatingPropertyDefinition = pset;
                relDef.RelatedObjects.Add(obj);
            }
            IfcPropertyTableValue table = GetPropertyTableValue(obj, pSetName, propertyTableName);

            if (table == null)
            {
                model = obj.ModelOf;
                table = model.Instances.New <IfcPropertyTableValue>(tb => { tb.Name = propertyTableName; });
                pset.HasProperties.Add(table);
                table.DefinedUnit  = definedUnit;
                table.DefiningUnit = definingUnit;
            }
            if (table.DefiningUnit != definingUnit || table.DefinedUnit != definedUnit)
            {
                throw new Exception("Inconsistent definition of the units in the property table.");
            }

            IfcValue itemValue = GetPropertyTableItemValue(obj, pSetName, propertyTableName, definingValue);

            if (itemValue != null)
            {
                itemValue = definedValue;
            }
            else
            {
                //if (table.DefiningValues == null) table.DefiningValues = new XbimList<IfcValue>();
                table.DefiningValues.Add(definingValue);
                //if (table.DefinedValues == null) table.DefinedValues = new XbimList<IfcValue>();
                table.DefinedValues.Add(definedValue);

                //check of integrity
                if (table.DefinedValues.Count != table.DefiningValues.Count)
                {
                    throw new Exception("Inconsistent state of the property table. Number of defined and defining values are not the same.");
                }
            }
        }
Esempio n. 24
0
        protected BbListProperty(string name, DateTime value)
        {
            Name = name;
            var _ifcValue = new IfcValue();
            var iValue    = IfcTimeStamp.GetTimeStamp(value);

            _ifcValue.Value       = iValue;
            _ifcPropertyListValue = new IfcPropertyListValue
            {
                Name       = this.Name,
                ListValues = new List <IfcValue> {
                    _ifcValue
                },
            };
        }
Esempio n. 25
0
        protected BbSingleProperty(string name, bool value)
        {
            Name      = name;
            _ifcValue = new IfcValue();
            var iValue = new IfcBoolean {
                Value = value
            };

            _ifcValue.Value         = iValue;
            _ifcPropertySingleValue = new IfcPropertySingleValue
            {
                Name         = this.Name,
                NominalValue = _ifcValue,
            };
        }
Esempio n. 26
0
        protected BbListProperty(string name, double value, Type type)
        {
            Name = name;
            var _ifcValue = new IfcValue();
            var iValue = Activator.CreateInstance(type) as REAL;
            if (iValue == null) throw new InvalidOperationException();
            iValue.Value = value;

            _ifcValue.Value = iValue;
            _ifcPropertyListValue = new IfcPropertyListValue
            {
                Name = this.Name,
                ListValues = new List<IfcValue> { _ifcValue },
            };
        }
Esempio n. 27
0
        public override void Parse(int propIndex, IPropertyValue value, int[] nestedIndex)
        {
            switch (propIndex)
            {
            case 0:
                _valueComponent = (IfcValue)(value.EntityVal);
                return;

            case 1:
                _unitComponent = (IfcUnit)(value.EntityVal);
                return;

            default:
                throw new XbimParserException(string.Format("Attribute index {0} is out of range for {1}", propIndex + 1, GetType().Name.ToUpper()));
            }
        }
Esempio n. 28
0
        protected BbListProperty(string name, int value, Type type)
        {
            Name = name;
            var _ifcValue = new IfcValue();
            var iValue    = Activator.CreateInstance(type) as INTEGER;

            iValue.Value          = value;
            _ifcValue.Value       = iValue;
            _ifcPropertyListValue = new IfcPropertyListValue
            {
                Name       = this.Name,
                ListValues = new List <IfcValue> {
                    _ifcValue
                },
            };
        }
Esempio n. 29
0
        public virtual void IfcParse(int propIndex, IPropertyValue value)
        {
            switch (propIndex)
            {
            case 0:
                _valueComponent = (IfcValue)value.EntityVal;
                break;

            case 1:
                _unitComponent = (IfcUnit)value.EntityVal;
                break;

            default:
                this.HandleUnexpectedAttribute(propIndex, value); break;
            }
        }
Esempio n. 30
0
        public static void SetPropertyTableItemValue(this Xbim.Ifc2x3.Kernel.IfcTypeObject obj, string pSetName, string propertyTableName, IfcValue definingValue, IfcValue definedValue, IfcUnit definingUnit, IfcUnit definedUnit)
        {
            IfcPropertySet pset  = GetPropertySet(obj, pSetName);
            IModel         model = null;

            if (pset == null)
            {
                IPersistIfcEntity ent = obj as IPersistIfcEntity;
                model     = ent != null ? ent.ModelOf : obj.ModelOf;
                pset      = model.Instances.New <IfcPropertySet>();
                pset.Name = pSetName;
                obj.AddPropertySet(pset);
            }
            IfcPropertyTableValue table = GetPropertyTableValue(obj, pSetName, propertyTableName);

            if (table == null)
            {
                IPersistIfcEntity ent = obj as IPersistIfcEntity;
                model = ent != null ? ent.ModelOf : obj.ModelOf;
                table = model.Instances.New <IfcPropertyTableValue>(tb => { tb.Name = propertyTableName; });
                pset.HasProperties.Add(table);
                table.DefinedUnit  = definedUnit;
                table.DefiningUnit = definingUnit;
            }
            if (table.DefiningUnit != definingUnit || table.DefinedUnit != definedUnit)
            {
                throw new Exception("Inconsistent definition of the units in the property table.");
            }

            IfcValue itemValue = GetPropertyTableItemValue(obj, pSetName, propertyTableName, definingValue);

            if (itemValue != null)
            {
                itemValue = definedValue;
            }
            else
            {
                table.DefiningValues.Add(definingValue);
                table.DefinedValues.Add(definedValue);

                //check of integrity
                if (table.DefinedValues.Count != table.DefiningValues.Count)
                {
                    throw new Exception("Inconsistent state of the property table. Number of defined and defining values are not the same.");
                }
            }
        }
Esempio n. 31
0
        internal ElementIfcProperties(IfcElement element) : base(element)
        {
            string keyword  = element.KeyWord;
            bool   readOnly = true;

            Add(new CustomProperty("ObjectType", element.ObjectType, typeof(string), readOnly, true)
            {
                Group = keyword
            });
            Add(new CustomProperty("Type", element.GetType().Name, typeof(string), true, true)
            {
                Group = keyword
            });
            Add(new CustomProperty("Tag", element.Tag, typeof(string), readOnly, true)
            {
                Group = keyword
            });

            IfcElementType elementType = element.RelatingType as IfcElementType;

            if (elementType != null)
            {
                List.Add(new ElementTypeIfcProperties(elementType));
            }
            foreach (IfcPropertySet pset in element.IsDefinedBy.ToList().ConvertAll(x => x.RelatingPropertyDefinition).OfType <IfcPropertySet>())
            {
                foreach (IfcPropertySingleValue psv in pset.HasProperties.Values.ToList().OfType <IfcPropertySingleValue>())
                {
                    IfcValue val = psv.NominalValue;
                    if (val == null)
                    {
                        Add(new CustomProperty(psv.Name, "", typeof(string), readOnly, true)
                        {
                            Group = pset.Name
                        });
                    }
                    else
                    {
                        Object obj = val.Value;
                        Add(new CustomProperty(psv.Name, obj, obj.GetType(), readOnly, true)
                        {
                            Group = pset.Name
                        });
                    }
                }
            }
        }
Esempio n. 32
0
        protected BbListProperty(string name, bool value)
        {
            Name = name;
            var _ifcValue = new IfcValue();
            var iValue    = new IfcBoolean {
                Value = value
            };

            _ifcValue.Value       = iValue;
            _ifcPropertyListValue = new IfcPropertyListValue
            {
                Name       = this.Name,
                ListValues = new List <IfcValue> {
                    _ifcValue
                },
            };
        }
Esempio n. 33
0
        static private AttributeValueType GetAttributeValue(IfcPropertyBoundedValue ifcPropertyBoundedValue)
        {
            var      attributeValueType = new AttributeValueType();
            IfcValue ifcValue           = ifcPropertyBoundedValue.LowerBoundValue;

            //only upper and lowwer bounds are supported by COBie on integer and decimal values
            if (ifcValue.UnderlyingSystemType == typeof(int) || ifcValue.UnderlyingSystemType == typeof(long) || ifcValue.UnderlyingSystemType == typeof(short) || ifcValue.UnderlyingSystemType == typeof(byte) ||
                ifcValue.UnderlyingSystemType == typeof(int?) || ifcValue.UnderlyingSystemType == typeof(long?) || ifcValue.UnderlyingSystemType == typeof(short?) || ifcValue.UnderlyingSystemType == typeof(byte?))
            {
                var integerValue = new AttributeIntegerValueType();
                if (ifcPropertyBoundedValue.UpperBoundValue != null)
                {
                    integerValue.MaxValueInteger = Convert.ToInt32(ifcPropertyBoundedValue.UpperBoundValue.Value);
                }
                if (ifcPropertyBoundedValue.LowerBoundValue != null)
                {
                    integerValue.MinValueInteger = Convert.ToInt32(ifcPropertyBoundedValue.LowerBoundValue.Value);
                }
                attributeValueType.Item            = integerValue;
                attributeValueType.ItemElementName = ItemChoiceType.AttributeIntegerValue;
            }
            else if (ifcValue.UnderlyingSystemType == typeof(double) || ifcValue.UnderlyingSystemType == typeof(float) ||
                     ifcValue.UnderlyingSystemType == typeof(double?) || ifcValue.UnderlyingSystemType == typeof(float?))
            {
                var decimalValue = new AttributeDecimalValueType();
                if (ifcPropertyBoundedValue.UpperBoundValue != null)
                {
                    decimalValue.MaxValueDecimal          = (double)ifcPropertyBoundedValue.UpperBoundValue.Value;
                    decimalValue.MaxValueDecimalSpecified = true;
                }
                if (ifcPropertyBoundedValue.LowerBoundValue != null)
                {
                    decimalValue.MinValueDecimal          = (double)ifcPropertyBoundedValue.LowerBoundValue.Value;
                    decimalValue.MinValueDecimalSpecified = true;
                }
                attributeValueType.Item            = decimalValue;
                attributeValueType.ItemElementName = ItemChoiceType.AttributeDecimalValue;
            }
            else
            {
                attributeValueType = null;
            }

            return(attributeValueType);
        }
Esempio n. 34
0
        protected BbSingleProperty(string name, double value, Type type)
        {
            Name      = name;
            _ifcValue = new IfcValue();
            var iValue = Activator.CreateInstance(type) as REAL;

            if (iValue == null)
            {
                throw new InvalidOperationException();
            }
            iValue.Value = value;

            _ifcValue.Value         = iValue;
            _ifcPropertySingleValue = new IfcPropertySingleValue {
                Name         = this.Name,
                NominalValue = _ifcValue,
            };
        }
Esempio n. 35
0
        protected BbListProperty(string name, IList <string> values, Type type)
        {
            Name = name;
            _ifcPropertyListValue = new IfcPropertyListValue
            {
                Name       = this.Name,
                ListValues = new List <IfcValue>(),
            };

            foreach (var value in values)
            {
                var _ifcValue = new IfcValue();
                var iValue    = Activator.CreateInstance(type) as STRING;
                iValue.Value    = value;
                _ifcValue.Value = iValue;
                _ifcPropertyListValue.ListValues.Add(_ifcValue);
            }
        }
Esempio n. 36
0
        protected BbListProperty(string name, IList<string> values, Type type)
        {
            Name = name;
            _ifcPropertyListValue = new IfcPropertyListValue
            {
                Name = this.Name,
                ListValues = new List<IfcValue>(),
            };

            foreach(var value in values)
            {
                var _ifcValue = new IfcValue();
            var iValue = Activator.CreateInstance(type) as STRING;
            iValue.Value = value;
            _ifcValue.Value = iValue;
            _ifcPropertyListValue.ListValues.Add(_ifcValue);
            }
        }
Esempio n. 37
0
        bool HasPropertyLikeExternalTrue(IfcWall wall)
        {
            //get relations property
            IEnumerable <IfcRelDefinesByProperties> rels = wall.IsDefinedByProperties;

            foreach (var rel in rels)
            {
                //get property set
                IfcPropertySet pSet = rel.RelatingPropertyDefinition as IfcPropertySet;
                if (pSet == null)
                {
                    continue;
                }
                foreach (IfcProperty prop in pSet.HasProperties)
                {
                    //get properties
                    IfcPropertySingleValue singleVal = prop as IfcPropertySingleValue;
                    if (singleVal == null)
                    {
                        continue;
                    }
                    if (singleVal.Name == "Wall Function")
                    {
                        //check value of the property
                        IfcValue val = singleVal.NominalValue;
                        if (val.UnderlyingSystemType == typeof(int))
                        {
                            if ((int)val.Value == 1)
                            {
                                return(true);
                            }
                        }
                        else if (val.UnderlyingSystemType == typeof(int?))
                        {
                            if ((int?)val.Value == 1)
                            {
                                return(true);
                            }
                        }
                    }
                }
            }
            return(false);
        }
 private void AddProperty(IfcObject ifcObject, IfcValue value, string cobiePropertyName, IfcPropertySet propertySet,
                          NamedProperty namedProperty)
 {
     try
     {
         var property = TargetRepository.Instances.New <IfcPropertySingleValue>();
         property.NominalValue = value;
         property.Description  = "Converted from COBie " + cobiePropertyName;
         property.Name         = namedProperty.PropertyName;
         propertySet.HasProperties.Add(property);
         var relDef = TargetRepository.Instances.New <IfcRelDefinesByProperties>();
         relDef.RelatingPropertyDefinition = propertySet;
         relDef.RelatedObjects.Add(ifcObject);
     }
     catch (Exception e)
     {
         throw new Exception("Failed to convert a COBie Value to and Ifc Single Value Property. " + e.Message);
     }
 }
Esempio n. 39
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);
     }
 }
 public override void IfcParse(int propIndex, IPropertyValue value)
 {
     switch (propIndex)
     {
         case 0:
         case 1:
             base.IfcParse(propIndex, value);
             break;
         case 2:
             _nominalValue = (IfcValue) value.EntityVal;
             break;
         case 3:
             _unit = (IfcUnit) value.EntityVal;
             break;
         default:
             this.HandleUnexpectedAttribute(propIndex, value); break;
     }
 }
Esempio n. 41
0
        public void AddMoreList(string value)
        {
            if( _ifcPropertyListValue.ListValues.Count < 1) return;

            var _ifcValue = new IfcValue();
            var iValue = Activator.CreateInstance(_ifcPropertyListValue.ListValues[0].GetType()) as STRING;
            iValue.Value = value;
            _ifcValue.Value = iValue;
            _ifcPropertyListValue.ListValues.Add(_ifcValue);
        }
Esempio n. 42
0
		internal IfcAppliedValue(IfcAppliedValue v) : base()
		{
			mName = v.mName; mDescription = v.mDescription; mAppliedValue = v.mAppliedValue; mAppliedValueValue = v.mAppliedValueValue; mUnitBasis = v.mUnitBasis; mApplicableDate = v.mApplicableDate;
			mFixedUntilDate = v.mFixedUntilDate; mCategory = v.mCategory; mCondition = v.mCondition; mArithmeticOperator = v.mArithmeticOperator; mComponents.AddRange(v.mComponents);
		}
Esempio n. 43
0
		public IfcTableRow(DatabaseIfc m, IfcValue val) : this(m, new List<IfcValue>() { val }, false) { }
Esempio n. 44
0
 public virtual void IfcParse(int propIndex, IPropertyValue value)
 {
     switch (propIndex)
     {
         case 0:
             _valueComponent = (IfcValue) value.EntityVal;
             break;
         case 1:
             _unitComponent = (IfcUnit) value.EntityVal;
             break;
         default:
             this.HandleUnexpectedAttribute(propIndex, value); break;
     }
 }
Esempio n. 45
0
 protected BbListProperty(string name, DateTime value)
 {
     Name = name;
     var _ifcValue = new IfcValue();
     var iValue = IfcTimeStamp.GetTimeStamp(value);
     _ifcValue.Value = iValue;
     _ifcPropertyListValue = new IfcPropertyListValue
     {
         Name = this.Name,
         ListValues = new List<IfcValue> { _ifcValue },
     };
 }
 public static void SetPropertyTableItemValue(this Xbim.Ifc2x3.Kernel.IfcTypeObject obj, string pSetName, string propertyTableName, IfcValue definingValue, IfcValue definedValue)
 {
     SetPropertyTableItemValue(obj, pSetName, propertyTableName, definingValue, definedValue, null, null);
 }
        public static IfcValue GetPropertyTableItemValue(this Xbim.Ifc2x3.Kernel.IfcTypeObject obj, string pSetName, string propertyTableName, IfcValue definingValue)
        {
            IfcPropertyTableValue table = GetPropertyTableValue(obj, pSetName, propertyTableName);
            if (table == null) return null;
            IList<IfcValue> definingValues = table.DefiningValues;
            if (definingValues == null) return null;
            if (!definingValues.Contains(definingValue)) return null;
            int index = definingValues.IndexOf(definingValue);

            if (table.DefinedValues.Count < index + 1) return null;
            return table.DefinedValues[index];
        }
Esempio n. 48
0
		internal IfcMetric(IfcMetric m) : base(m) { mBenchMark = m.mBenchMark; mValueSource = m.mValueSource; mDataValue = m.mDataValue; mDataValueValue = m.mDataValueValue; mReferencePath = m.mReferencePath; }
Esempio n. 49
0
		internal IfcMeasureWithUnit(IfcValue v, IfcUnit u) : base(u.Database) { mValueComponent = v; mUnitComponent = u.Index; }
Esempio n. 50
0
		internal IfcMeasureWithUnit(double value, IfcUnit u) : base(u.Database) { mValueComponent = new IfcReal(value); mUnitComponent = u.Index;  }
Esempio n. 51
0
		public IfcPropertySingleValue(DatabaseIfc m, string name, string desc, IfcValue val, IfcUnit unit) : this(m, name, desc,val) {  Unit = unit; }
        public static void SetPropertyTableItemValue(this Xbim.Ifc2x3.Kernel.IfcTypeObject obj, string pSetName, string propertyTableName, IfcValue definingValue, IfcValue definedValue, IfcUnit definingUnit, IfcUnit definedUnit)
        {
            IfcPropertySet pset = GetPropertySet(obj, pSetName);
            IModel model = null;
            if (pset == null)
            {
                IPersistIfcEntity ent = obj as IPersistIfcEntity;
                model = ent != null ? ent.ModelOf : obj.ModelOf;
                pset = model.Instances.New<IfcPropertySet>();
                pset.Name = pSetName;
                obj.AddPropertySet(pset);
            }
            IfcPropertyTableValue table = GetPropertyTableValue(obj, pSetName, propertyTableName);
            if (table == null)
            {
                IPersistIfcEntity ent = obj as IPersistIfcEntity;
                model = ent != null ? ent.ModelOf : obj.ModelOf;
                table = model.Instances.New<IfcPropertyTableValue>(tb => { tb.Name = propertyTableName; });
                pset.HasProperties.Add(table);
                table.DefinedUnit = definedUnit;
                table.DefiningUnit = definingUnit;
            }
            if (table.DefiningUnit != definingUnit || table.DefinedUnit != definedUnit)
                throw new Exception("Inconsistent definition of the units in the property table.");

            IfcValue itemValue = GetPropertyTableItemValue(obj, pSetName, propertyTableName, definingValue);
            if (itemValue != null)
            {
                itemValue = definedValue;
            }
            else
            {
                table.DefiningValues.Add(definingValue);
                table.DefinedValues.Add(definedValue);

                //check of integrity
                if (table.DefinedValues.Count != table.DefiningValues.Count)
                    throw new Exception("Inconsistent state of the property table. Number of defined and defining values are not the same.");
            }
        }
Esempio n. 53
0
		public IfcPropertySingleValue(DatabaseIfc m, string name, string desc, IfcValue value) : base(m, name, desc) { mNominalValue = value; }
        public static IfcPropertySingleValue SetPropertySingleValue(this Xbim.Ifc2x3.Kernel.IfcTypeObject obj, string pSetName, string propertyName, IfcValue value)
        {
            IfcPropertySet pset = GetPropertySet(obj, pSetName);
            IfcPropertySingleValue property = null;
            IModel model = null;
            if (pset == null)
            {
                //if (value == null) return;
                IPersistIfcEntity ent = obj as IPersistIfcEntity;
                model = ent!= null? ent.ModelOf : obj.ModelOf;
                pset = model.Instances.New<IfcPropertySet>();
                pset.Name = pSetName;
                obj.AddPropertySet(pset);
            }

            //change existing property of the same name from the property set
            IfcPropertySingleValue singleVal = GetPropertySingleValue(obj, pSetName, propertyName);
            if (singleVal != null)
            {
                property = singleVal;
                singleVal.NominalValue = value;
            }
            else
            {
                //if (value == null) return;
                IPersistIfcEntity ent = obj as IPersistIfcEntity;
                model = ent != null ? ent.ModelOf : obj.ModelOf;
                property = model.Instances.New<IfcPropertySingleValue>(psv => { psv.Name = propertyName; psv.NominalValue = value; });
                pset.HasProperties.Add(property);
            }
            return property;
        }
Esempio n. 55
0
 protected BbListProperty(string name, bool value)
 {
     Name = name;
     var _ifcValue = new IfcValue();
     var iValue = new IfcBoolean { Value = value };
     _ifcValue.Value = iValue;
     _ifcPropertyListValue = new IfcPropertyListValue
         {
             Name = this.Name,
             ListValues = new List<IfcValue> { _ifcValue },
         };
 }
 public void SetProperty(string propertySetName, string propertyName, IfcValue value)
 {
     if (value == null) { _object.DeletePropertySingleValueValue(propertySetName, propertyName); return; }
     _object.SetPropertySingleValue(propertySetName, propertyName, value);
 }
Esempio n. 57
0
		public IfcMetric(DatabaseIfc db, string name, IfcConstraintEnum constraint, IfcValue dataValue) : base(db, name, constraint) { mDataValueValue = dataValue; }
Esempio n. 58
0
 public IfcMeasureWithUnit(IfcValue val, IfcUnit unit)
 {
     _valueComponent = val;
     _unitComponent = unit;
 }
Esempio n. 59
0
 public static void SetExtendedSingleValue(this IfcMaterial material, string pSetName, string propertyName,
                                           IfcValue value)
 {
     IModel model = material.ModelOf;
     SetExtendedSingleValue(material, model, pSetName, propertyName, value);
 }
Esempio n. 60
0
		internal IfcMeasureWithUnit(IfcMeasureWithUnit m) : base() { mValueComponent = m.mValueComponent; mUnitComponent = m.mUnitComponent; }