Exemplo n.º 1
0
        private IfcDimensionalExponents GetOrCreateExponents(IList <int> exponents)
        {
            var result = Model.Instances.FirstOrDefault <IfcDimensionalExponents>(e =>
                                                                                  e.LengthExponent == exponents[0] &&
                                                                                  e.MassExponent == exponents[1] &&
                                                                                  e.TimeExponent == exponents[2] &&
                                                                                  e.ElectricCurrentExponent == exponents[3] &&
                                                                                  e.ThermodynamicTemperatureExponent == exponents[4] &&
                                                                                  e.AmountOfSubstanceExponent == exponents[5] &&
                                                                                  e.LuminousIntensityExponent == exponents[6]
                                                                                  );

            if (result != null)
            {
                return(result);
            }

            result = new IfcDimensionalExponents(null, -1, true);
            for (var i = 0; i < 7; i++)
            {
                result.Parse(i, new PropVal(exponents[i]), null);
            }

            return(result);
        }
        public static IfcDimensionalExponents DeriveDimensionalExponents(DerivedUnitElementSet UnitElements)
        {
            if (UnitElements.Count == 0)
            {
                throw new ArgumentNullException();
            }
            IModel model = UnitElements.FirstOrDefault().ModelOf;

            #region Strict Implementation
            IfcDimensionalExponents Result = new IfcDimensionalExponents(0, 0, 0, 0, 0, 0, 0);
            Result._model = model;
            foreach (IfcDerivedUnitElement unitElement in UnitElements)
            {
                Result.LengthExponent = Result.LengthExponent +
                                        (unitElement.Exponent * unitElement.Unit.Dimensions.LengthExponent);
                Result.MassExponent = +Result.MassExponent +
                                      (unitElement.Exponent * unitElement.Unit.Dimensions.MassExponent);
                Result.TimeExponent = Result.TimeExponent +
                                      (unitElement.Exponent * unitElement.Unit.Dimensions.TimeExponent);
                Result.ElectricCurrentExponent = Result.ElectricCurrentExponent +
                                                 (unitElement.Exponent * unitElement.Unit.Dimensions.ElectricCurrentExponent);
                Result.ThermodynamicTemperatureExponent = Result.ThermodynamicTemperatureExponent +
                                                          (unitElement.Exponent * unitElement.Unit.Dimensions.ThermodynamicTemperatureExponent);
                Result.AmountOfSubstanceExponent = Result.AmountOfSubstanceExponent +
                                                   (unitElement.Exponent * unitElement.Unit.Dimensions.AmountOfSubstanceExponent);
                Result.LuminousIntensityExponent = Result.LuminousIntensityExponent +
                                                   (unitElement.Exponent * unitElement.Unit.Dimensions.LuminousIntensityExponent);
            }
            return(Result);

            #endregion Strict Implementation
        }
Exemplo n.º 3
0
 public virtual string WhereRule()
 {
     if (!IfcDimensionalExponents.CorrectDimensions(_unitType, Dimensions))
     {
         return(string.Format("WR1 NamedUnit : The dimensions of the named unit {0} are not correct\n",
                              _unitType.ToString()));
     }
     else
     {
         return("");
     }
 }
 private static void SetConversionUnitsParameters(IModel model, IfcConversionBasedUnit unit, IfcLabel name,
                                                  IfcRatioMeasure ratio, IfcUnitEnum unitType, IfcSIUnitName siUnitName,
                                                  IfcSIPrefix?siUnitPrefix, IfcDimensionalExponents dimensions)
 {
     unit.Name             = name;
     unit.ConversionFactor = model.Instances.New <IfcMeasureWithUnit>();
     unit.ConversionFactor.ValueComponent = ratio;
     unit.ConversionFactor.UnitComponent  = model.Instances.New <IfcSIUnit>(s =>
     {
         s.UnitType = unitType;
         s.Name     = siUnitName;
         s.Prefix   = siUnitPrefix;
     });
     unit.Dimensions = dimensions;
 }
Exemplo n.º 5
0
        public override void Parse(int propIndex, IPropertyValue value, int[] nestedIndex)
        {
            switch (propIndex)
            {
            case 0:
                _dimensions = (IfcDimensionalExponents)(value.EntityVal);
                return;

            case 1:
                _unitType = (IfcUnitEnum)System.Enum.Parse(typeof(IfcUnitEnum), value.EnumVal, true);
                return;

            default:
                throw new XbimParserException(string.Format("Attribute index {0} is out of range for {1}", propIndex + 1, GetType().Name.ToUpper()));
            }
        }
Exemplo n.º 6
0
        public virtual void IfcParse(int propIndex, IPropertyValue value)
        {
            switch (propIndex)
            {
            case 0:
                _dimensions = (IfcDimensionalExponents)value.EntityVal;
                break;

            case 1:
                _unitType = (IfcUnitEnum)Enum.Parse(typeof(IfcUnitEnum), value.EnumVal, true);
                break;

            default:
                this.HandleUnexpectedAttribute(propIndex, value); break;
            }
        }
        public override bool Equals(object obj)
        {
            // Check for null
            if (obj == null)
            {
                return(false);
            }

            // Check for type
            if (this.GetType() != obj.GetType())
            {
                return(false);
            }

            // Cast as IfcRoot
            IfcDimensionalExponents root = (IfcDimensionalExponents)obj;

            return(this == root);
        }
 private static void SetConversionUnitsParameters(IModel model, IfcConversionBasedUnit unit, IfcLabel name,
                                                  IfcRatioMeasure ratio, IfcUnitEnum unitType, IfcSIUnitName siUnitName,
                                                  IfcSIPrefix? siUnitPrefix, IfcDimensionalExponents dimensions)
 {
     unit.Name = name;
     unit.ConversionFactor = model.Instances.New<IfcMeasureWithUnit>();
     unit.ConversionFactor.ValueComponent = ratio;
     unit.ConversionFactor.UnitComponent = model.Instances.New<IfcSIUnit>(s =>
                                                                    {
                                                                        s.UnitType = unitType;
                                                                        s.Name = siUnitName;
                                                                        s.Prefix = siUnitPrefix;
                                                                    });
     unit.Dimensions = dimensions;
 }
        public static IfcDimensionalExponents DimensionsForUnit(IfcUnitEnum unit, IfcDimensionalExponents Dim)
        {
            switch (unit)
            {
            case IfcUnitEnum.LENGTHUNIT:
                return(new IfcDimensionalExponents(1, 0, 0, 0, 0, 0, 0));

            case IfcUnitEnum.MASSUNIT:
                return(new IfcDimensionalExponents(0, 1, 0, 0, 0, 0, 0));

            case IfcUnitEnum.TIMEUNIT:
                return(new IfcDimensionalExponents(0, 0, 1, 0, 0, 0, 0));

            case IfcUnitEnum.ELECTRICCURRENTUNIT:
                return(new IfcDimensionalExponents(0, 0, 0, 1, 0, 0, 0));

            case IfcUnitEnum.THERMODYNAMICTEMPERATUREUNIT:
                return(new IfcDimensionalExponents(0, 0, 0, 0, 1, 0, 0));

            case IfcUnitEnum.AMOUNTOFSUBSTANCEUNIT:
                return(new IfcDimensionalExponents(0, 0, 0, 0, 0, 1, 0));

            case IfcUnitEnum.LUMINOUSINTENSITYUNIT:
                return(new IfcDimensionalExponents(0, 0, 0, 0, 0, 0, 1));

            case IfcUnitEnum.PLANEANGLEUNIT:
                return(new IfcDimensionalExponents(0, 0, 0, 0, 0, 0, 0));

            case IfcUnitEnum.SOLIDANGLEUNIT:
                return(new IfcDimensionalExponents(0, 0, 0, 0, 0, 0, 0));

            case IfcUnitEnum.AREAUNIT:
                return(new IfcDimensionalExponents(2, 0, 0, 0, 0, 0, 0));

            case IfcUnitEnum.VOLUMEUNIT:
                return(new IfcDimensionalExponents(3, 0, 0, 0, 0, 0, 0));

            case IfcUnitEnum.ABSORBEDDOSEUNIT:
                return(new IfcDimensionalExponents(2, 0, -2, 0, 0, 0, 0));

            case IfcUnitEnum.RADIOACTIVITYUNIT:
                return(new IfcDimensionalExponents(0, 0, -1, 0, 0, 0, 0));

            case IfcUnitEnum.ELECTRICCAPACITANCEUNIT:
                return(new IfcDimensionalExponents(-2, 1, 4, 1, 0, 0, 0));

            case IfcUnitEnum.DOSEEQUIVALENTUNIT:
                return(new IfcDimensionalExponents(2, 0, -2, 0, 0, 0, 0));

            case IfcUnitEnum.ELECTRICCHARGEUNIT:
                return(new IfcDimensionalExponents(0, 0, 1, 1, 0, 0, 0));

            case IfcUnitEnum.ELECTRICCONDUCTANCEUNIT:
                return(new IfcDimensionalExponents(-2, -1, 3, 2, 0, 0, 0));

            case IfcUnitEnum.ELECTRICVOLTAGEUNIT:
                return(new IfcDimensionalExponents(2, 1, -3, -1, 0, 0, 0));

            case IfcUnitEnum.ELECTRICRESISTANCEUNIT:
                return(new IfcDimensionalExponents(2, 1, -3, -2, 0, 0, 0));

            case IfcUnitEnum.ENERGYUNIT:
                return(new IfcDimensionalExponents(2, 1, -2, 0, 0, 0, 0));

            case IfcUnitEnum.FORCEUNIT:
                return(new IfcDimensionalExponents(1, 1, -2, 0, 0, 0, 0));

            case IfcUnitEnum.FREQUENCYUNIT:
                return(new IfcDimensionalExponents(0, 0, -1, 0, 0, 0, 0));

            case IfcUnitEnum.INDUCTANCEUNIT:
                return(new IfcDimensionalExponents(2, 1, -2, -2, 0, 0, 0));

            case IfcUnitEnum.ILLUMINANCEUNIT:
                return(new IfcDimensionalExponents(-2, 0, 0, 0, 0, 0, 1));

            case IfcUnitEnum.LUMINOUSFLUXUNIT:
                return(new IfcDimensionalExponents(0, 0, 0, 0, 0, 0, 1));

            case IfcUnitEnum.MAGNETICFLUXUNIT:
                return(new IfcDimensionalExponents(2, 1, -2, -1, 0, 0, 0));

            case IfcUnitEnum.MAGNETICFLUXDENSITYUNIT:
                return(new IfcDimensionalExponents(0, 1, -2, -1, 0, 0, 0));

            case IfcUnitEnum.POWERUNIT:
                return(new IfcDimensionalExponents(2, 1, -3, 0, 0, 0, 0));

            case IfcUnitEnum.PRESSUREUNIT:
                return(new IfcDimensionalExponents(-1, 1, -2, 0, 0, 0, 0));

            default:
                return(new IfcDimensionalExponents(0, 0, 0, 0, 0, 0, 0));
            }
        }
Exemplo n.º 10
0
 public virtual void IfcParse(int propIndex, IPropertyValue value)
 {
     switch (propIndex)
     {
         case 0:
             _dimensions = (IfcDimensionalExponents) value.EntityVal;
             break;
         case 1:
             _unitType = (IfcUnitEnum) Enum.Parse(typeof (IfcUnitEnum), value.EnumVal, true);
             break;
         default:
             this.HandleUnexpectedAttribute(propIndex, value); break;
     }
 }
 public static IfcDimensionalExponents DimensionsForUnit(IfcUnitEnum unit, IfcDimensionalExponents Dim)
 {
     switch (unit)
     {
         case IfcUnitEnum.LENGTHUNIT:
             return new IfcDimensionalExponents(1, 0, 0, 0, 0, 0, 0);
         case IfcUnitEnum.MASSUNIT:
             return new IfcDimensionalExponents(0, 1, 0, 0, 0, 0, 0);
         case IfcUnitEnum.TIMEUNIT:
             return new IfcDimensionalExponents(0, 0, 1, 0, 0, 0, 0);
         case IfcUnitEnum.ELECTRICCURRENTUNIT:
             return new IfcDimensionalExponents(0, 0, 0, 1, 0, 0, 0);
         case IfcUnitEnum.THERMODYNAMICTEMPERATUREUNIT:
             return new IfcDimensionalExponents(0, 0, 0, 0, 1, 0, 0);
         case IfcUnitEnum.AMOUNTOFSUBSTANCEUNIT:
             return new IfcDimensionalExponents(0, 0, 0, 0, 0, 1, 0);
         case IfcUnitEnum.LUMINOUSINTENSITYUNIT:
             return new IfcDimensionalExponents(0, 0, 0, 0, 0, 0, 1);
         case IfcUnitEnum.PLANEANGLEUNIT:
             return new IfcDimensionalExponents(0, 0, 0, 0, 0, 0, 0);
         case IfcUnitEnum.SOLIDANGLEUNIT:
             return new IfcDimensionalExponents(0, 0, 0, 0, 0, 0, 0);
         case IfcUnitEnum.AREAUNIT:
             return new IfcDimensionalExponents(2, 0, 0, 0, 0, 0, 0);
         case IfcUnitEnum.VOLUMEUNIT:
             return new IfcDimensionalExponents(3, 0, 0, 0, 0, 0, 0);
         case IfcUnitEnum.ABSORBEDDOSEUNIT:
             return new IfcDimensionalExponents(2, 0, -2, 0, 0, 0, 0);
         case IfcUnitEnum.RADIOACTIVITYUNIT:
             return new IfcDimensionalExponents(0, 0, -1, 0, 0, 0, 0);
         case IfcUnitEnum.ELECTRICCAPACITANCEUNIT:
             return new IfcDimensionalExponents(-2, 1, 4, 1, 0, 0, 0);
         case IfcUnitEnum.DOSEEQUIVALENTUNIT:
             return new IfcDimensionalExponents(2, 0, -2, 0, 0, 0, 0);
         case IfcUnitEnum.ELECTRICCHARGEUNIT:
             return new IfcDimensionalExponents(0, 0, 1, 1, 0, 0, 0);
         case IfcUnitEnum.ELECTRICCONDUCTANCEUNIT:
             return new IfcDimensionalExponents(-2, -1, 3, 2, 0, 0, 0);
         case IfcUnitEnum.ELECTRICVOLTAGEUNIT:
             return new IfcDimensionalExponents(2, 1, -3, -1, 0, 0, 0);
         case IfcUnitEnum.ELECTRICRESISTANCEUNIT:
             return new IfcDimensionalExponents(2, 1, -3, -2, 0, 0, 0);
         case IfcUnitEnum.ENERGYUNIT:
             return new IfcDimensionalExponents(2, 1, -2, 0, 0, 0, 0);
         case IfcUnitEnum.FORCEUNIT:
             return new IfcDimensionalExponents(1, 1, -2, 0, 0, 0, 0);
         case IfcUnitEnum.FREQUENCYUNIT:
             return new IfcDimensionalExponents(0, 0, -1, 0, 0, 0, 0);
         case IfcUnitEnum.INDUCTANCEUNIT:
             return new IfcDimensionalExponents(2, 1, -2, -2, 0, 0, 0);
         case IfcUnitEnum.ILLUMINANCEUNIT:
             return new IfcDimensionalExponents(-2, 0, 0, 0, 0, 0, 1);
         case IfcUnitEnum.LUMINOUSFLUXUNIT:
             return new IfcDimensionalExponents(0, 0, 0, 0, 0, 0, 1);
         case IfcUnitEnum.MAGNETICFLUXUNIT:
             return new IfcDimensionalExponents(2, 1, -2, -1, 0, 0, 0);
         case IfcUnitEnum.MAGNETICFLUXDENSITYUNIT:
             return new IfcDimensionalExponents(0, 1, -2, -1, 0, 0, 0);
         case IfcUnitEnum.POWERUNIT:
             return new IfcDimensionalExponents(2, 1, -3, 0, 0, 0, 0);
         case IfcUnitEnum.PRESSUREUNIT:
             return new IfcDimensionalExponents(-1, 1, -2, 0, 0, 0, 0);
         default:
             return new IfcDimensionalExponents(0, 0, 0, 0, 0, 0, 0);
     }
 }
        public static IfcDimensionalExponents DeriveDimensionalExponents(DerivedUnitElementSet UnitElements)
        {
            if(UnitElements.Count == 0)
                  throw new ArgumentNullException();
              IModel model = UnitElements.FirstOrDefault().ModelOf;

              #region Strict Implementation
              IfcDimensionalExponents Result = new IfcDimensionalExponents(0, 0, 0, 0, 0, 0, 0);
              Result._model = model;
              foreach (IfcDerivedUnitElement unitElement in UnitElements)
              {
                  Result.LengthExponent = Result.LengthExponent +
                        (unitElement.Exponent * unitElement.Unit.Dimensions.LengthExponent);
                  Result.MassExponent = +Result.MassExponent +
                        (unitElement.Exponent * unitElement.Unit.Dimensions.MassExponent);
                  Result.TimeExponent = Result.TimeExponent +
                        (unitElement.Exponent * unitElement.Unit.Dimensions.TimeExponent);
                  Result.ElectricCurrentExponent = Result.ElectricCurrentExponent +
                        (unitElement.Exponent * unitElement.Unit.Dimensions.ElectricCurrentExponent);
                  Result.ThermodynamicTemperatureExponent = Result.ThermodynamicTemperatureExponent +
                        (unitElement.Exponent * unitElement.Unit.Dimensions.ThermodynamicTemperatureExponent);
                  Result.AmountOfSubstanceExponent = Result.AmountOfSubstanceExponent +
                        (unitElement.Exponent * unitElement.Unit.Dimensions.AmountOfSubstanceExponent);
                  Result.LuminousIntensityExponent = Result.LuminousIntensityExponent +
                        (unitElement.Exponent * unitElement.Unit.Dimensions.LuminousIntensityExponent);
              }
              return Result;
              #endregion Strict Implementation
        }
Exemplo n.º 13
0
        /// <summary>
        /// set the second unit, used for time duration units
        /// </summary>
        private void SetSecondUnit()
        {
            if (_secondUnit == null)
            {
                _secondUnit = Model.Instances.New<IfcSIUnit>(si =>
                {
                    si.UnitType = IfcUnitEnum.TIMEUNIT;
                    si.Prefix = null;
                    si.Name = IfcSIUnitName.SECOND;
                });
            }

            if (_dimensionalExponents == null)
            {
                _dimensionalExponents = Model.Instances.New<IfcDimensionalExponents>(de =>
                {
                    de.LengthExponent = 1;
                    de.MassExponent = 1;
                    de.TimeExponent = 1;
                    de.ElectricCurrentExponent = 1;
                    de.ThermodynamicTemperatureExponent = 1;
                    de.AmountOfSubstanceExponent = 1;
                    de.LuminousIntensityExponent = 1;
                });
            }
        }
Exemplo n.º 14
0
 public void Reset()
 {
     Contacts.Clear();
     _ifcConversionBasedUnitYear = null;
     _ifcConversionBasedUnitMonth = null;
     _ifcConversionBasedUnitWeek = null;
     _secondUnit = null;
     _dimensionalExponents = null;
     WorkBook = null;
 }