public override void Parse(int propIndex, IPropertyValue value, int[] nestedIndex)
        {
            switch (propIndex)
            {
            case 0:
            case 1:
                base.Parse(propIndex, value, nestedIndex);
                return;

            case 2:
                _definingValues.InternalAdd((IfcValue)value.EntityVal);
                return;

            case 3:
                _definedValues.InternalAdd((IfcValue)value.EntityVal);
                return;

            case 4:
                _expression = value.StringVal;
                return;

            case 5:
                _definingUnit = (IfcUnit)(value.EntityVal);
                return;

            case 6:
                _definedUnit = (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. 2
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;
 }
        public override void Parse(int propIndex, IPropertyValue value, int[] nestedIndex)
        {
            switch (propIndex)
            {
            case 0:
                _identifier = value.StringVal;
                return;

            case 1:
                _name = value.StringVal;
                return;

            case 2:
                _description = value.StringVal;
                return;

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

            case 4:
                _referencePath = (IfcReference)(value.EntityVal);
                return;

            default:
                throw new XbimParserException(string.Format("Attribute index {0} is out of range for {1}", propIndex + 1, GetType().Name.ToUpper()));
            }
        }
        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;
            }
        }
Esempio n. 5
0
        public override void IfcParse(int propIndex, IPropertyValue value)
        {
            switch (propIndex)
            {
            case 0:
            case 1:
                base.IfcParse(propIndex, value);
                break;

            case 2:
                _definingValues.Add((IfcValue)value.EntityVal);
                break;

            case 3:
                _definedValues.Add((IfcValue)value.EntityVal);
                break;

            case 4:
                _expression = value.StringVal;
                break;

            case 5:
                _definingUnit = (IfcUnit)value.EntityVal;
                break;

            case 6:
                _definedUnit = (IfcUnit)value.EntityVal;
                break;

            default:
                this.HandleUnexpectedAttribute(propIndex, value); break;
            }
        }
Esempio n. 6
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()));
            }
        }
 public static IfcDimensionalExponents DeriveDimensionalExponents(IfcUnit unit)
 {
     if (unit is IfcDerivedUnit)
     {
         return(DeriveDimensionalExponents((unit as IfcDerivedUnit).Elements));
     }
     throw new NotImplementedException();
 }
Esempio n. 8
0
		public IfcTableColumn(IfcIdentifier? __Identifier, IfcLabel? __Name, IfcText? __Description, IfcUnit __Unit, IfcReference __ReferencePath)
		{
			this._Identifier = __Identifier;
			this._Name = __Name;
			this._Description = __Description;
			this._Unit = __Unit;
			this._ReferencePath = __ReferencePath;
		}
Esempio n. 9
0
 public IfcPropertyTableValue(IfcIdentifier __Name, IfcText?__Description, IfcValue[] __DefiningValues, IfcValue[] __DefinedValues, IfcText?__Expression, IfcUnit __DefiningUnit, IfcUnit __DefinedUnit)
     : base(__Name, __Description)
 {
     this._DefiningValues = new List <IfcValue>(__DefiningValues);
     this._DefinedValues  = new List <IfcValue>(__DefinedValues);
     this._Expression     = __Expression;
     this._DefiningUnit   = __DefiningUnit;
     this._DefinedUnit    = __DefinedUnit;
 }
Esempio n. 10
0
        public static XbimDimensionalExponents DeriveDimensionalExponents(IfcUnit unit)
        {
            var derivedUnit = unit as IfcDerivedUnit;

            if (derivedUnit != null)
            {
                return(DeriveDimensionalExponents(derivedUnit.Elements));
            }
            throw new NotImplementedException();
        }
Esempio n. 11
0
 public IfcTimeSeries(IfcLabel __Name, IfcText?__Description, IfcDateTime __StartTime, IfcDateTime __EndTime, IfcTimeSeriesDataTypeEnum __TimeSeriesDataType, IfcDataOriginEnum __DataOrigin, IfcLabel?__UserDefinedDataOrigin, IfcUnit __Unit)
 {
     this._Name                  = __Name;
     this._Description           = __Description;
     this._StartTime             = __StartTime;
     this._EndTime               = __EndTime;
     this._TimeSeriesDataType    = __TimeSeriesDataType;
     this._DataOrigin            = __DataOrigin;
     this._UserDefinedDataOrigin = __UserDefinedDataOrigin;
     this._Unit                  = __Unit;
 }
Esempio n. 12
0
 public IfcSimplePropertyTemplate(IfcGloballyUniqueId __GlobalId, IfcOwnerHistory __OwnerHistory, IfcLabel?__Name, IfcText?__Description, IfcSimplePropertyTemplateTypeEnum?__TemplateType, IfcLabel?__PrimaryMeasureType, IfcLabel?__SecondaryMeasureType, IfcPropertyEnumeration __Enumerators, IfcUnit __PrimaryUnit, IfcUnit __SecondaryUnit, IfcLabel?__Expression, IfcStateEnum?__AccessState)
     : base(__GlobalId, __OwnerHistory, __Name, __Description)
 {
     this._TemplateType         = __TemplateType;
     this._PrimaryMeasureType   = __PrimaryMeasureType;
     this._SecondaryMeasureType = __SecondaryMeasureType;
     this._Enumerators          = __Enumerators;
     this._PrimaryUnit          = __PrimaryUnit;
     this._SecondaryUnit        = __SecondaryUnit;
     this._Expression           = __Expression;
     this._AccessState          = __AccessState;
 }
        private static string GetMeasureWithUnitAsString(IfcMeasureWithUnit ifcMeasureWithUnit)
        {
            string  value   = string.Format("{0,0:N2}", ifcMeasureWithUnit.ValueComponent.Value);
            IfcUnit ifcUnit = ifcMeasureWithUnit.UnitComponent;
            string  unit    = ifcUnit.GetSymbol();

            if (!string.IsNullOrEmpty(unit))
            {
                value += unit;
            }

            return(value);
        }
Esempio n. 14
0
        protected override void setJSON(JObject obj, BaseClassIfc host, SetJsonOptions options)
        {
            base.setJSON(obj, host, options);
            IfcValue value = NominalValue;

            if (value != null)
            {
                obj["NominalValue"] = DatabaseIfc.extract(value);
            }
            IfcUnit unit = Unit;

            if (unit != null)
            {
                obj["Unit"] = unit.getJson(this, options);
            }
        }
Esempio n. 15
0
        protected override void setJSON(JObject obj, BaseClassIfc host, SetJsonOptions options)
        {
            base.setJSON(obj, host, options);
            IfcValue value = mValueComponent;

            if (value != null)
            {
                obj["ValueComponent"] = DatabaseIfc.extract(value);
            }
            IfcUnit unit = UnitComponent;

            if (unit != null)
            {
                obj["UnitComponent"] = mUnitComponent.getJson(this, options);
            }
        }
Esempio n. 16
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. 17
0
        protected override void setJSON(JObject obj, BaseClassIfc host, HashSet <int> processed)
        {
            base.setJSON(obj, host, processed);
            IfcValue value = mValueComponent;

            if (value != null)
            {
                obj["ValueComponent"] = DatabaseIfc.extract(value);
            }
            IfcUnit unit = UnitComponent;

            if (unit != null)
            {
                obj["UnitComponent"] = mDatabase[mUnitComponent].getJson(this, processed);
            }
        }
Esempio n. 18
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()));
            }
        }
        public override void Parse(int propIndex, IPropertyValue value, int[] nestedIndex)
        {
            switch (propIndex)
            {
            case 0:
            case 1:
            case 2:
            case 3:
                base.Parse(propIndex, value, nestedIndex);
                return;

            case 4:
                _templateType = (IfcSimplePropertyTemplateTypeEnum)System.Enum.Parse(typeof(IfcSimplePropertyTemplateTypeEnum), value.EnumVal, true);
                return;

            case 5:
                _primaryMeasureType = value.StringVal;
                return;

            case 6:
                _secondaryMeasureType = value.StringVal;
                return;

            case 7:
                _enumerators = (IfcPropertyEnumeration)(value.EntityVal);
                return;

            case 8:
                _primaryUnit = (IfcUnit)(value.EntityVal);
                return;

            case 9:
                _secondaryUnit = (IfcUnit)(value.EntityVal);
                return;

            case 10:
                _expression = value.StringVal;
                return;

            case 11:
                _accessState = (IfcStateEnum)System.Enum.Parse(typeof(IfcStateEnum), value.EnumVal, true);
                return;

            default:
                throw new XbimParserException(string.Format("Attribute index {0} is out of range for {1}", propIndex + 1, GetType().Name.ToUpper()));
            }
        }
Esempio n. 20
0
        /// <summary>
        /// Get the symbol of the IfcUnit
        /// </summary>
        /// <returns>string holding symbol</returns>
        public static string GetSymbol(this IfcUnit ifcUnit)
        {
            if (ifcUnit is IfcDerivedUnit)
            {
                return((ifcUnit as IfcDerivedUnit).GetName());
            }
            else if (ifcUnit is IfcNamedUnit)
            {
                return((ifcUnit as IfcNamedUnit).GetSymbol());
            }
            else if (ifcUnit is IfcMonetaryUnit)
            {
                return((ifcUnit as IfcMonetaryUnit).GetSymbol());
            }

            return(string.Empty);
        }
Esempio n. 21
0
        /// <summary>
        /// Get the full name of the IfcUnit
        /// </summary>
        /// <returns>string holding full name</returns>
        public static string Name(this IfcUnit ifcUnit)
        {
            var unit = ifcUnit as IfcDerivedUnit;

            if (unit != null)
            {
                return(unit.FullName);
            }
            var namedUnit = ifcUnit as IfcNamedUnit;

            if (namedUnit != null)
            {
                return(namedUnit.FullName);
            }
            var monetaryUnit = ifcUnit as IfcMonetaryUnit;

            return(monetaryUnit != null ? monetaryUnit.FullEnglishName : string.Empty);
        }
Esempio n. 22
0
 internal override void ParseXml(XmlElement xml)
 {
     base.ParseXml(xml);
     foreach (XmlNode child in xml.ChildNodes)
     {
         string name = child.Name;
         if (string.Compare(name, "Units") == 0)
         {
             foreach (XmlNode cn in child.ChildNodes)
             {
                 IfcUnit u = mDatabase.ParseXml <IfcUnit>(cn as XmlElement);
                 if (u != null)
                 {
                     AddUnit(u);
                 }
             }
         }
     }
 }
        public void IfcParse(int propIndex, IPropertyValue value)
        {
            switch (propIndex)
            {
            case 0:
                _name = value.StringVal;
                break;

            case 1:
                ((IXbimNoNotifyCollection)_enumerationValues).Add((IfcValue)value.EntityVal);
                break;

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

            default:
                this.HandleUnexpectedAttribute(propIndex, value); break;
            }
        }
        public override void Parse(int propIndex, IPropertyValue value, int[] nestedIndex)
        {
            switch (propIndex)
            {
            case 0:
                _name = value.StringVal;
                return;

            case 1:
                _enumerationValues.InternalAdd((IfcValue)value.EntityVal);
                return;

            case 2:
                _unit = (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. 25
0
        public virtual void IfcParse(int propIndex, IPropertyValue value)
        {
            switch (propIndex)
            {
            case 0:
                _name = value.StringVal;
                break;

            case 1:
                _description = value.StringVal;
                break;

            case 2:
                _startTime = (IfcDateTimeSelect)value.EntityVal;
                break;

            case 3:
                _endTime = (IfcDateTimeSelect)value.EntityVal;
                break;

            case 4:
                _timeSeriesDataType =
                    (IfcTimeSeriesDataTypeEnum)Enum.Parse(typeof(IfcTimeSeriesDataTypeEnum), value.EnumVal, true);
                break;

            case 5:
                _dataOrigin = (IfcDataOriginEnum)Enum.Parse(typeof(IfcDataOriginEnum), value.EnumVal, true);
                break;

            case 6:
                _userDefinedDataOrigin = value.StringVal;
                break;

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

            default:
                this.HandleUnexpectedAttribute(propIndex, value); break;
            }
        }
Esempio n. 26
0
 internal override void ParseXml(XmlElement xml)
 {
     base.ParseXml(xml);
     foreach (XmlNode child in xml.ChildNodes)
     {
         string name = child.Name;
         if (string.Compare(name, "Units") == 0)
         {
             List <IfcUnit> units = new List <IfcUnit>(child.ChildNodes.Count);
             foreach (XmlNode cn in child.ChildNodes)
             {
                 IfcUnit ri = mDatabase.ParseXml <IfcUnit>(cn as XmlElement);
                 if (ri != null)
                 {
                     units.Add(ri);
                 }
             }
             Units = units;
         }
     }
 }
Esempio n. 27
0
        public override void Parse(int propIndex, IPropertyValue value, int[] nestedIndex)
        {
            switch (propIndex)
            {
            case 0:
                _name = value.StringVal;
                return;

            case 1:
                _description = value.StringVal;
                return;

            case 2:
                _startTime = (IfcDateTimeSelect)(value.EntityVal);
                return;

            case 3:
                _endTime = (IfcDateTimeSelect)(value.EntityVal);
                return;

            case 4:
                _timeSeriesDataType = (IfcTimeSeriesDataTypeEnum)System.Enum.Parse(typeof(IfcTimeSeriesDataTypeEnum), value.EnumVal, true);
                return;

            case 5:
                _dataOrigin = (IfcDataOriginEnum)System.Enum.Parse(typeof(IfcDataOriginEnum), value.EnumVal, true);
                return;

            case 6:
                _userDefinedDataOrigin = value.StringVal;
                return;

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

            default:
                throw new XbimParserException(string.Format("Attribute index {0} is out of range for {1}", propIndex + 1, GetType().Name.ToUpper()));
            }
        }
 public void IfcParse(int propIndex, IPropertyValue value)
 {
     switch (propIndex)
     {
         case 0:
             _name = value.StringVal;
             break;
         case 1:
             _enumerationValues.Add_Reversible((IfcValue) value.EntityVal);
             break;
         case 2:
             _unit = (IfcUnit) value.EntityVal;
             break;
         default:
             this.HandleUnexpectedAttribute(propIndex, value); break;
     }
 }
 public void IfcParse(int propIndex, IPropertyValue value)
 {
     switch (propIndex)
     {
         case 0:
             _name = value.StringVal;
             break;
         case 1:
             ((IXbimNoNotifyCollection)_enumerationValues).Add((IfcValue) value.EntityVal);
             break;
         case 2:
             _unit = (IfcUnit) value.EntityVal;
             break;
         default:
             this.HandleUnexpectedAttribute(propIndex, value); break;
     }
 }
Esempio n. 30
0
 public IfcRegularTimeSeries(IfcLabel __Name, IfcText?__Description, IfcDateTimeSelect __StartTime, IfcDateTimeSelect __EndTime, IfcTimeSeriesDataTypeEnum __TimeSeriesDataType, IfcDataOriginEnum __DataOrigin, IfcLabel?__UserDefinedDataOrigin, IfcUnit __Unit, IfcTimeMeasure __TimeStep, IfcTimeSeriesValue[] __Values)
     : base(__Name, __Description, __StartTime, __EndTime, __TimeSeriesDataType, __DataOrigin, __UserDefinedDataOrigin, __Unit)
 {
     this._TimeStep = __TimeStep;
     this._Values   = new List <IfcTimeSeriesValue>(__Values);
 }
Esempio n. 31
0
		internal void AddUnit(IfcUnit u) { mUnits.Add(u.Index); }
 public override void IfcParse(int propIndex, IPropertyValue value)
 {
     switch (propIndex)
     {
         case 0:
         case 1:
             base.IfcParse(propIndex, value);
             break;
         case 2:
             _definingValues.Add((IfcValue) value.EntityVal);
             break;
         case 3:
             _definedValues.Add((IfcValue)value.EntityVal);
             break;
         case 4:
             _expression = value.StringVal;
             break;
         case 5:
             _definingUnit = (IfcUnit) value.EntityVal;
             break;
         case 6:
             _definedUnit = (IfcUnit) value.EntityVal;
             break;
         default:
             this.HandleUnexpectedAttribute(propIndex, value); break;
     }
 }
Esempio n. 33
0
 public IfcUnitAssignment(IfcUnit unit) : base(unit.Database)
 {
     AddUnit(unit);
 }
Esempio n. 34
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="bbUnitBase"></param>
        public void SetUnit(
             BbUnit bbUnitBase)
        {
            _bbUnit = bbUnitBase;
            IfcUnitAssignment = new IfcUnitAssignment { Units = new List<IfcUnit>() };
            switch (_bbUnit)
            {
                case BbUnit.Metric:
                    #region metric

                    IfcUnitAssignment.Units.Add(
                        new IfcUnit
                        {
                            Value = new IfcSIUnit(
                                IfcUnitEnum.LENGTHUNIT, IfcSIPrefix.MILLI, IfcSIUnitName.METRE)
                        });
                    IfcUnitAssignment.Units.Add(
                        new IfcUnit
                        {
                            Value = new IfcSIUnit(
                                IfcUnitEnum.AREAUNIT, IfcSIUnitName.SQUARE_METRE)
                        });
                    IfcUnitAssignment.Units.Add(
                        new IfcUnit
                        {
                            Value = new IfcSIUnit(
                                IfcUnitEnum.VOLUMEUNIT, IfcSIUnitName.CUBIC_METRE)
                        });

                    #endregion
                    break;
                case BbUnit.Imperial:
                    #region imperial
                    var leng = new IfcConversionBasedUnit
                    {
                        Dimensions = new IfcDimensionalExponents
                        {
                            LengthExponent = 1,
                            MassExponent = 0,
                            TimeExponent = 0,
                            ElectricCurrentExponent = 0,
                            ThermodynamicTemperatureExponent = 0,
                            AmountOfSubstanceExponent = 0,
                            LuminousIntensityExponent = 0,
                        },
                        UnitType = IfcUnitEnum.LENGTHUNIT,
                        Name = "FOOT",
                        ConversionFactor = new IfcMeasureWithUnit
                        {
                            ValueComponent = new IfcValue
                            {
                                Value = new IfcRatioMeasure { Value = 0.3048 }
                            },
                            UnitComponent = new IfcUnit { Value = new IfcSIUnit(IfcUnitEnum.LENGTHUNIT, IfcSIUnitName.METRE) }
                        }
                    };
                    var length = new IfcUnit { Value = leng };
                    IfcUnitAssignment.Units.Add(length);

                    var area = new IfcConversionBasedUnit
                    {
                        Dimensions = new IfcDimensionalExponents
                        {
                            LengthExponent = 2,
                            MassExponent = 0,
                            TimeExponent = 0,
                            ElectricCurrentExponent = 0,
                            ThermodynamicTemperatureExponent = 0,
                            AmountOfSubstanceExponent = 0,
                            LuminousIntensityExponent = 0,
                        },
                        UnitType = IfcUnitEnum.AREAUNIT,
                        Name = "SQUARE FOOT",
                        ConversionFactor = new IfcMeasureWithUnit
                        {
                            ValueComponent = new IfcValue
                            {
                                Value
                                = new IfcRatioMeasure { Value = 0.09290304 }
                            },
                            UnitComponent = new IfcUnit { Value = new IfcSIUnit(IfcUnitEnum.AREAUNIT, IfcSIUnitName.SQUARE_METRE) }
                        }
                    };

                    var areaUnit = new IfcUnit { Value = area };
                    IfcUnitAssignment.Units.Add(areaUnit);

                    var volume = new IfcConversionBasedUnit
                    {
                        Dimensions = new IfcDimensionalExponents
                        {
                            LengthExponent = 3,
                            MassExponent = 0,
                            TimeExponent = 0,
                            ElectricCurrentExponent = 0,
                            ThermodynamicTemperatureExponent = 0,
                            AmountOfSubstanceExponent = 0,
                            LuminousIntensityExponent = 0,

                        },
                        UnitType = IfcUnitEnum.VOLUMEUNIT,
                        Name = "CUBIC FOOT",
                        ConversionFactor = new IfcMeasureWithUnit
                        {
                            ValueComponent = new IfcValue
                            {
                                Value = new IfcRatioMeasure { Value = 0.02831685 }
                            },
                            UnitComponent = new IfcUnit { Value = new IfcSIUnit(IfcUnitEnum.VOLUMEUNIT, IfcSIUnitName.CUBIC_METRE) }
                        }
                    };

                    var volumeUnit = new IfcUnit { Value = volume };
                    IfcUnitAssignment.Units.Add(volumeUnit);
                    #endregion
                    break;
            }

            var degree = new IfcConversionBasedUnit
            {
                Dimensions = new IfcDimensionalExponents
                {
                    LengthExponent = 0,
                    MassExponent = 0,
                    TimeExponent = 0,
                    ElectricCurrentExponent = 0,
                    ThermodynamicTemperatureExponent = 0,
                    AmountOfSubstanceExponent = 0,
                    LuminousIntensityExponent = 0,
                },
                UnitType = IfcUnitEnum.PLANEANGLEUNIT,
                Name = "DEGREE",
                ConversionFactor = new IfcMeasureWithUnit
                {
                    ValueComponent = new IfcValue
                    {
                        Value = new IfcPlaneAngleMeasure
                        {
                            Value = 0.01745329
                        }
                    },
                    UnitComponent = new IfcUnit
                    {
                        Value = new IfcSIUnit(IfcUnitEnum.PLANEANGLEUNIT, IfcSIUnitName.RADIAN)
                    }
                }
            };
            var angle = new IfcUnit { Value = degree };
            IfcUnitAssignment.Units.Add(angle);

            IfcUnitAssignment.Units.Add(
                new IfcUnit()
                {
                    Value = new IfcSIUnit(IfcUnitEnum.SOLIDANGLEUNIT, IfcSIUnitName.STERADIAN)
                });
            IfcUnitAssignment.Units.Add(
                new IfcUnit()
                {
                    Value = new IfcSIUnit(IfcUnitEnum.MASSUNIT, IfcSIUnitName.GRAM)
                });
            IfcUnitAssignment.Units.Add(
                new IfcUnit()
                {
                    Value = new IfcSIUnit(IfcUnitEnum.TIMEUNIT, IfcSIUnitName.SECOND)
                });
            IfcUnitAssignment.Units.Add(
                new IfcUnit()
                {
                    Value = new IfcSIUnit(IfcUnitEnum.THERMODYNAMICTEMPERATUREUNIT, IfcSIUnitName.DEGREE_CELSIUS)
                });
            IfcUnitAssignment.Units.Add(
                new IfcUnit()
                {
                    Value = new IfcSIUnit(IfcUnitEnum.LUMINOUSINTENSITYUNIT, IfcSIUnitName.LUMEN)
                });
        }
        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. 36
0
 public void AddUnit(IfcUnit u)
 {
     mUnits.Add(u.Index);
 }
Esempio n. 37
0
 public IfcMeasureWithUnit(IfcValue val, IfcUnit unit)
 {
     _valueComponent = val;
     _unitComponent = unit;
 }
Esempio n. 38
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;
     }
 }
 public override void IfcParse(int propIndex, IPropertyValue value)
 {
     switch (propIndex)
     {
         case 0:
         case 1:
             base.IfcParse(propIndex, value);
             break;
         case 2:
             _listValues.Add((IfcValue) value.EntityVal);
             break;
         case 3:
             _unit = (IfcUnit) value.EntityVal;
             break;
         default:
             this.HandleUnexpectedAttribute(propIndex, value); break;
     }
 }
Esempio n. 40
0
		public IfcPropertySingleValue(DatabaseIfc m, string name, string desc, IfcValue val, IfcUnit unit) : this(m, name, desc,val) {  Unit = unit; }
 public static IfcDimensionalExponents DeriveDimensionalExponents(IfcUnit unit)
 {
     if (unit is IfcDerivedUnit)
           return DeriveDimensionalExponents((unit as IfcDerivedUnit).Elements);
        throw new NotImplementedException();
 }
Esempio n. 42
0
		internal IfcMeasureWithUnit(IfcValue v, IfcUnit u) : base(u.Database) { mValueComponent = v; mUnitComponent = u.Index; }
Esempio n. 43
0
 public void AddUnit(IfcUnit u)
 {
     mUnits.Add(u.Index);
 }
Esempio n. 44
0
        /// <summary>
        /// Get the unit abbreviation html friendly
        /// </summary>
        /// <param name="ifcUnit">IfcUnit unit to abbreviate</param>
        /// <param name="ifcGlobalUnits">global unit dictionary</param>
        /// <returns>string as abbreviation</returns>
        public static string GetUnitAbbreviation(IfcUnit ifcUnit, ConcurrentDictionary<string, string> ifcGlobalUnits)
        {
            string unit = string.Empty;
            if (ifcUnit == null)
                unit = string.Empty;
            else if (ifcUnit is IfcNamedUnit)
            {
                unit = GetUnitAbbreviation(ifcUnit as IfcNamedUnit);
                //get global unit
                if (string.IsNullOrEmpty(unit))
                {
                    if (!ifcGlobalUnits.TryGetValue((ifcUnit as IfcNamedUnit).UnitType.ToString(), out unit))
                        unit = string.Empty;
                }

            }
            else if (ifcUnit is IfcMonetaryUnit)
            {
                unit = (ifcUnit as IfcMonetaryUnit).GetSymbol(); //get abbreviation
                if (string.IsNullOrEmpty(unit))
                {
                    if (!ifcGlobalUnits.TryGetValue("MonetaryUnit", out unit))
                        unit = string.Empty;
                }

            }
            else if (ifcUnit is IfcDerivedUnit)
                unit = GetDerivedUnitName((ifcUnit as IfcDerivedUnit));

            unit = AbbreviationToHTML(unit);
            return unit.ToLower(); ;
        }
Esempio n. 45
0
		internal IfcMeasureWithUnit(double value, IfcUnit u) : base(u.Database) { mValueComponent = new IfcReal(value); mUnitComponent = u.Index;  }
Esempio n. 46
0
 public virtual void IfcParse(int propIndex, IPropertyValue value)
 {
     switch (propIndex)
     {
         case 0:
             _name = value.StringVal;
             break;
         case 1:
             _description = value.StringVal;
             break;
         case 2:
             _startTime = (IfcDateTimeSelect) value.EntityVal;
             break;
         case 3:
             _endTime = (IfcDateTimeSelect) value.EntityVal;
             break;
         case 4:
             _timeSeriesDataType =
                 (IfcTimeSeriesDataTypeEnum) Enum.Parse(typeof (IfcTimeSeriesDataTypeEnum), value.EnumVal, true);
             break;
         case 5:
             _dataOrigin = (IfcDataOriginEnum) Enum.Parse(typeof (IfcDataOriginEnum), value.EnumVal, true);
             break;
         case 6:
             _userDefinedDataOrigin = value.StringVal;
             break;
         case 7:
             _unit = (IfcUnit) value.EntityVal;
             break;
         default:
             this.HandleUnexpectedAttribute(propIndex, value); break;
     }
 }