Exemple #1
0
 public IfcSIUnit(IfcUnitEnum unitType, IfcSIUnitName name)
 {
     Dimensions           = new IfcDimensionalExponents();
     Dimensions.IsDerived = true;
     UnitType             = unitType;
     Name = name;
 }
Exemple #2
0
 public IfcSIUnit(IfcUnitEnum unitType, IfcSIUnitName name)
 {
     Dimensions = new IfcDimensionalExponents();
     Dimensions.IsDerived = true;
     UnitType = unitType;
     Name = name;
 }
Exemple #3
0
        /// <summary>
        /// Get Symbol string for SIUnit unit
        /// </summary>
        /// <returns>String holding symbol</returns>
        public static string GetSymbol(this IfcSIUnit ifcSIUnit)
        {
            IfcSIUnitName ifcSIUnitName = ifcSIUnit.Name;
            IfcSIPrefix   ifcSIPrefix;
            string        value  = string.Empty;
            string        prefix = string.Empty;

            if (ifcSIUnit.Prefix != null)
            {
                ifcSIPrefix = (IfcSIPrefix)ifcSIUnit.Prefix;
                switch (ifcSIPrefix)
                {
                case IfcSIPrefix.CENTI:
                    prefix = "c";
                    break;

                case IfcSIPrefix.MILLI:
                    prefix = "m";
                    break;

                case IfcSIPrefix.KILO:
                    prefix = "k";
                    break;

                default:     //TODO: the other values of IfcSIPrefix
                    prefix = ifcSIPrefix.ToString();
                    break;
                }
            }

            switch (ifcSIUnitName)
            {
            case IfcSIUnitName.METRE:
                value = prefix + "m";
                break;

            case IfcSIUnitName.SQUARE_METRE:
                value = prefix + "m" + '\u00B2';     //((char)0x00B2)might need to look at this for other cultures
                break;

            case IfcSIUnitName.CUBIC_METRE:
                value = prefix + "m" + '\u00B3';    //((char)0x00B3)
                break;

            case IfcSIUnitName.GRAM:
                value = prefix + "g";
                break;

            default:    //TODO: the other values of IfcSIUnitName
                value = ifcSIUnit.ToString();
                break;
            }
            return(value);
        }
        public SIUnit(IfcStore model, IfcSIUnitName name, IfcUnitEnum unitType)
        {
            ifcSiUnit = model.Instances.New <IfcSIUnit>(p =>
            {
                p.Name     = name;
                p.UnitType = unitType;
            });

            this.name     = name;
            this.unitType = unitType;
        }
Exemple #5
0
        public void SetOrChangeSiUnit(IfcUnitEnum unitType, IfcSIUnitName siUnitName,
                                      IfcSIPrefix?siUnitPrefix)
        {
            if (UnitsInContext == null)
            {
                UnitsInContext = Model.Instances.New <IfcUnitAssignment>();
            }
            IfcUnitAssignment unitsAssignment = UnitsInContext;

            unitsAssignment.SetOrChangeSiUnit(unitType, siUnitName, siUnitPrefix);
        }
        /// <summary>
        /// Sets the Length Unit to be SIUnit and SIPrefix, returns false if the units are not SI
        /// </summary>
        /// <param name = "siUnitName"></param>
        /// <param name = "siPrefix"></param>
        /// <returns></returns>
        public bool SetSiLengthUnits(IfcSIUnitName siUnitName, IfcSIPrefix?siPrefix)
        {
            var si = Units.OfType <IfcSIUnit>().FirstOrDefault(u => u.UnitType == IfcUnitEnum.LENGTHUNIT);

            if (si != null)
            {
                si.Prefix = siPrefix;
                si.Name   = siUnitName;
                return(true);
            }
            return(false);
        }
Exemple #7
0
        /// <summary>
        /// Sets the Length Unit to be SIUnit and SIPrefix, returns false if the units are not SI
        /// </summary>
        /// <param name = "ua"></param>
        /// <param name = "siUnitName"></param>
        /// <param name = "siPrefix"></param>
        /// <returns></returns>
        public static bool SetSILengthUnits(this IfcUnitAssignment ua, IfcSIUnitName siUnitName, IfcSIPrefix?siPrefix)
        {
            IfcSIUnit si = ua.Units.OfType <IfcSIUnit>().FirstOrDefault(u => u.UnitType == IfcUnitEnum.LENGTHUNIT);

            if (si != null)
            {
                si.Prefix = siPrefix;
                si.Name   = siUnitName;
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #8
0
        public static IIfcSIUnit NewIfcSIUnit(this IModel s, IfcUnitEnum unitType, IfcSIUnitName name, IfcSIPrefix?prefix = null)
        {
            switch (s.SchemaVersion)
            {
            case Xbim.Common.Step21.XbimSchemaVersion.Ifc2X3:
                return(s.NewIfc2x3SIUnit(unitType, name, prefix));

            case Xbim.Common.Step21.XbimSchemaVersion.Ifc4:
            case Xbim.Common.Step21.XbimSchemaVersion.Ifc4x1:
                return(s.Instances.New <Xbim.Ifc4.MeasureResource.IfcSIUnit>(x =>
                {
                    x.Name = name;
                    x.Prefix = prefix;
                    x.UnitType = unitType;
                }));

            default:
                throw new NotImplementedException($"Missing implementation for {s.SchemaVersion}");
            }
        }
Exemple #9
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:
                _prefix = (IfcSIPrefix)System.Enum.Parse(typeof(IfcSIPrefix), value.EnumVal, true);
                return;

            case 3:
                _name = (IfcSIUnitName)System.Enum.Parse(typeof(IfcSIUnitName), value.EnumVal, true);
                return;

            default:
                throw new XbimParserException(string.Format("Attribute index {0} is out of range for {1}", propIndex + 1, GetType().Name.ToUpper()));
            }
        }
        public void SetOrChangeSiUnit(IfcUnitEnum unitType, IfcSIUnitName siUnitName,
                                      IfcSIPrefix?siUnitPrefix)
        {
            var model = Model;
            var si    = Units.OfType <IfcSIUnit>().FirstOrDefault(u => u.UnitType == unitType);

            if (si != null)
            {
                si.Prefix = siUnitPrefix;
                si.Name   = siUnitName;
            }
            else
            {
                Units.Add(model.Instances.New <IfcSIUnit>(s =>
                {
                    s.UnitType = unitType;
                    s.Name     = siUnitName;
                    s.Prefix   = siUnitPrefix;
                }));
            }
        }
        public XbimCoBieValueHelper(DecimalValueType decimalValue, IfcSIUnitName defaultSiUnitName, IfcSIPrefix?defaultSiPrefix = null)
        {
            //set regardless
            SiPrefix   = defaultSiPrefix;
            SiUnitName = defaultSiUnitName;

            if (decimalValue == null || !decimalValue.DecimalValueSpecified)
            {
                IsNull = true;
                Value  = null;
            }
            else
            {
                IsNull = false;
                Value  = decimalValue.DecimalValue;
                if (!string.IsNullOrWhiteSpace(decimalValue.UnitName))
                {
                    //acording the COBie standard units should start with the SI prefix and end with the unit name
                    var trimmedName = decimalValue.UnitName.Trim();
                    foreach (IfcSIUnitName unit in Enum.GetValues(typeof(IfcSIUnitName)))
                    {
                        if (trimmedName.EndsWith(unit.ToString(), true, CultureInfo.InvariantCulture))
                        {
                            SiUnitName = unit;
                            break;
                        }
                    }
                    foreach (IfcSIPrefix prefix in Enum.GetValues(typeof(IfcSIPrefix)))
                    {
                        if (trimmedName.StartsWith(prefix.ToString(), true, CultureInfo.InvariantCulture))
                        {
                            defaultSiPrefix = prefix;
                            break;
                        }
                    }
                }
            }
        }
Exemple #12
0
        public override void IfcParse(int propIndex, IPropertyValue value)
        {
            switch (propIndex)
            {
            case 0:
                break;     //do nothing NamedUnit.Dimensional Exponents is overrideen and derived in this class

            case 1:
                base.IfcParse(propIndex, value);
                break;

            case 2:
                _prefix = (IfcSIPrefix)Enum.Parse(typeof(IfcSIPrefix), value.EnumVal, true);
                break;

            case 3:
                _name = (IfcSIUnitName)Enum.Parse(typeof(IfcSIUnitName), value.EnumVal, true);
                break;

            default:
                this.HandleUnexpectedAttribute(propIndex, value); break;
            }
        }
Exemple #13
0
        protected IfcSIUnit ChangeOrNewLengthUnit(IfcSIUnitName name, IfcSIPrefix?prefix = null)
        {
            var project   = Store.Instances.OfType <IfcProject>().First();
            var assigment = project.UnitsInContext;

            if (null == assigment)
            {
                assigment = Store.NewIfc4UnitAssignment(IfcUnitEnum.LENGTHUNIT, name, prefix);
            }

            // Test for existing
            var unit = assigment.Units.Where(u => (u as IfcSIUnit)?.UnitType == IfcUnitEnum.LENGTHUNIT).FirstOrDefault() as IfcSIUnit;

            if (null == unit)
            {
                unit = Store.Instances.New <IfcSIUnit>(u => { u.UnitType = IfcUnitEnum.LENGTHUNIT; });
                assigment.Units.Add(unit);
            }

            unit.Name   = name;
            unit.Prefix = prefix;
            return(unit);
        }
 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 void SetOrChangeSIUnit(this IfcUnitAssignment ua, IfcUnitEnum unitType, IfcSIUnitName siUnitName,
                                      IfcSIPrefix? siUnitPrefix)
 {
     IModel model = ua.ModelOf;
     IfcSIUnit si = ua.Units.OfType<IfcSIUnit>().FirstOrDefault(u => u.UnitType == unitType);
     if (si != null)
     {
         si.Prefix = siUnitPrefix;
         si.Name = siUnitName;
     }
     else
     {
         ua.Units.Add(model.Instances.New<IfcSIUnit>(s =>
                                                          {
                                                              s.UnitType = unitType;
                                                              s.Name = siUnitName;
                                                              s.Prefix = siUnitPrefix;
                                                          }));
     }
 }
 /// <summary>
 /// Sets the Length Unit to be SIUnit and SIPrefix, returns false if the units are not SI
 /// </summary>
 /// <param name = "ua"></param>
 /// <param name = "siUnitName"></param>
 /// <param name = "siPrefix"></param>
 /// <returns></returns>
 public static bool SetSILengthUnits(this IfcUnitAssignment ua, IfcSIUnitName siUnitName, IfcSIPrefix? siPrefix)
 {
     IfcSIUnit si = ua.Units.OfType<IfcSIUnit>().FirstOrDefault(u => u.UnitType == IfcUnitEnum.LENGTHUNIT);
     if (si != null)
     {
         si.Prefix = siPrefix;
         si.Name = siUnitName;
         return true;
     }
     else
         return false;
 }
Exemple #17
0
 public static IfcDimensionalExponents IfcDimensionsForSiUnit(IfcSIUnitName n)
 {
     throw new NotImplementedException();
 }
        public static void SetOrChangeSIUnit(this IfcProject ifcProject, IfcUnitEnum unitType, IfcSIUnitName siUnitName,
                                             IfcSIPrefix? siUnitPrefix)
        {
            IModel model = ifcProject.ModelOf;
            if (ifcProject.UnitsInContext == null)
            {
                ifcProject.UnitsInContext = model.Instances.New<IfcUnitAssignment>();
            }

            IfcUnitAssignment unitsAssignment = ifcProject.UnitsInContext;
            unitsAssignment.SetOrChangeSIUnit(unitType, siUnitName, siUnitPrefix);
        }
Exemple #19
0
        public static IfcUnitAssignment NewIfc4UnitAssignment(this IModel s, IfcUnitEnum unitType, IfcSIUnitName name, IfcSIPrefix?prefix = null)
        {
            var unitAssignment = s.Instances.New <IfcUnitAssignment>();

            unitAssignment.Units.Add(s.Instances.New <IfcSIUnit>(store =>
            {
                store.UnitType = unitType;
                store.Name     = name;
                store.Prefix   = prefix;
            }));
            return(unitAssignment);
        }
Exemple #20
0
        public static void SetOrChangeSIUnit(this IfcUnitAssignment ua, IfcUnitEnum unitType, IfcSIUnitName siUnitName,
                                             IfcSIPrefix?siUnitPrefix)
        {
            IModel    model = ua.ModelOf;
            IfcSIUnit si    = ua.Units.OfType <IfcSIUnit>().FirstOrDefault(u => u.UnitType == unitType);

            if (si != null)
            {
                si.Prefix = siUnitPrefix;
                si.Name   = siUnitName;
            }
            else
            {
                ua.Units.Add(model.Instances.New <IfcSIUnit>(s =>
                {
                    s.UnitType = unitType;
                    s.Name     = siUnitName;
                    s.Prefix   = siUnitPrefix;
                }));
            }
        }
Exemple #21
0
 public IfcSIUnit(IfcDimensionalExponents __Dimensions, IfcUnitEnum __UnitType, IfcSIPrefix?__Prefix, IfcSIUnitName __Name)
     : base(__Dimensions, __UnitType)
 {
     this._Prefix = __Prefix;
     this._Name   = __Name;
 }
Exemple #22
0
 /// <summary>
 /// Sets SI unit or change it if it exists. It does not affect any physical 
 /// values in the model, it just changes their meaning.
 /// </summary>
 /// <param name="UnitType">Enumeration of unit types</param>
 /// <param name="siUnitName">Enumeration of base SI unit names</param>
 /// <param name="siUnitPrefix">Enumeration of SI units prefixes</param>
 public void SetOrChangeSIUnit(IfcUnitEnum UnitType, IfcSIUnitName siUnitName, IfcSIPrefix? siUnitPrefix)
 {
     ((IfcProject)Model.IfcProject).SetOrChangeSIUnit(UnitType, siUnitName, siUnitPrefix);
 }
Exemple #23
0
        /// <summary>
        /// Definition from ISO/CD 10303-41:1992: The function returns the dimensional exponents of the given SI-unit.
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public static IfcDimensionalExponents IfcDimensionsForSiUnit(IfcSIUnitName name)
        {
            switch (name)
            {
            case IfcSIUnitName.metre:
                return(new IfcDimensionalExponents(1, 0, 0, 0, 0, 0, 0));

            case IfcSIUnitName.square_metre:
                return(new IfcDimensionalExponents(2, 0, 0, 0, 0, 0, 0));

            case IfcSIUnitName.cubic_metre:
                return(new IfcDimensionalExponents(3, 0, 0, 0, 0, 0, 0));

            case IfcSIUnitName.gram:
                return(new IfcDimensionalExponents(0, 1, 0, 0, 0, 0, 0));

            case IfcSIUnitName.second:
                return(new IfcDimensionalExponents(0, 0, 1, 0, 0, 0, 0));

            case IfcSIUnitName.ampere:
                return(new IfcDimensionalExponents(0, 0, 0, 1, 0, 0, 0));

            case IfcSIUnitName.kelvin:
                return(new IfcDimensionalExponents(0, 0, 0, 0, 1, 0, 0));

            case IfcSIUnitName.mole:
                return(new IfcDimensionalExponents(0, 0, 0, 0, 0, 1, 0));

            case IfcSIUnitName.candela:
                return(new IfcDimensionalExponents(0, 0, 0, 0, 0, 0, 1));

            case IfcSIUnitName.radian:
                return(new IfcDimensionalExponents(0, 0, 0, 0, 0, 0, 0));

            case IfcSIUnitName.steradian:
                return(new IfcDimensionalExponents(0, 0, 0, 0, 0, 0, 0));

            case IfcSIUnitName.hertz:
                return(new IfcDimensionalExponents(0, 0, -1, 0, 0, 0, 0));

            case IfcSIUnitName.newton:
                return(new IfcDimensionalExponents(1, 1, -2, 0, 0, 0, 0));

            case IfcSIUnitName.pascal:
                return(new IfcDimensionalExponents(-1, 1, -2, 0, 0, 0, 0));

            case IfcSIUnitName.joule:
                return(new IfcDimensionalExponents(2, 1, -2, 0, 0, 0, 0));

            case IfcSIUnitName.watt:
                return(new IfcDimensionalExponents(2, 1, -3, 0, 0, 0, 0));

            case IfcSIUnitName.coulomb:
                return(new IfcDimensionalExponents(0, 0, 1, 1, 0, 0, 0));

            case IfcSIUnitName.volt:
                return(new IfcDimensionalExponents(2, 1, -3, -1, 0, 0, 0));

            case IfcSIUnitName.farad:
                return(new IfcDimensionalExponents(-2, -1, 4, 1, 0, 0, 0));

            case IfcSIUnitName.ohm:
                return(new IfcDimensionalExponents(2, 1, -3, -2, 0, 0, 0));

            case IfcSIUnitName.siemens:
                return(new IfcDimensionalExponents(-2, -1, 3, 2, 0, 0, 0));

            case IfcSIUnitName.weber:
                return(new IfcDimensionalExponents(2, 1, -2, -1, 0, 0, 0));

            case IfcSIUnitName.tesla:
                return(new IfcDimensionalExponents(0, 1, -2, -1, 0, 0, 0));

            case IfcSIUnitName.henry:
                return(new IfcDimensionalExponents(2, 1, -2, -2, 0, 0, 0));

            case IfcSIUnitName.degree_celsius:
                return(new IfcDimensionalExponents(0, 0, 0, 0, 1, 0, 0));

            case IfcSIUnitName.lumen:
                return(new IfcDimensionalExponents(0, 0, 0, 0, 0, 0, 1));

            case IfcSIUnitName.lux:
                return(new IfcDimensionalExponents(-2, 0, 0, 0, 0, 0, 1));

            case IfcSIUnitName.becquerel:
                return(new IfcDimensionalExponents(0, 0, -1, 0, 0, 0, 0));

            case IfcSIUnitName.gray:
                return(new IfcDimensionalExponents(2, 0, -2, 0, 0, 0, 0));

            case IfcSIUnitName.sievert:
                return(new IfcDimensionalExponents(2, 0, -2, 0, 0, 0, 0));

            default:
                return(new IfcDimensionalExponents(0, 0, 0, 0, 0, 0, 0));
            }
        }
        internal IfcDimensionalExponents IfcDimensionsForSiUnit(IfcSIUnitName name)
        {
            IfcDimensionalExponents result;

            if (ExponentsCache.TryGetValue(name, out result))
            {
                return(result);
            }
            switch (name)
            {
            case IfcSIUnitName.METRE: result = GetOrCreateExponents(new List <int> {
                    1, 0, 0, 0, 0, 0, 0
                }); break;

            case IfcSIUnitName.SQUARE_METRE: result = GetOrCreateExponents(new List <int> {
                    2, 0, 0, 0, 0, 0, 0
                }); break;

            case IfcSIUnitName.CUBIC_METRE: result = GetOrCreateExponents(new List <int> {
                    3, 0, 0, 0, 0, 0, 0
                }); break;

            case IfcSIUnitName.GRAM: result = GetOrCreateExponents(new List <int> {
                    0, 1, 0, 0, 0, 0, 0
                }); break;

            case IfcSIUnitName.SECOND: result = GetOrCreateExponents(new List <int> {
                    0, 0, 1, 0, 0, 0, 0
                }); break;

            case IfcSIUnitName.AMPERE: result = GetOrCreateExponents(new List <int> {
                    0, 0, 0, 1, 0, 0, 0
                }); break;

            case IfcSIUnitName.KELVIN: result = GetOrCreateExponents(new List <int> {
                    0, 0, 0, 0, 1, 0, 0
                }); break;

            case IfcSIUnitName.MOLE: result = GetOrCreateExponents(new List <int> {
                    0, 0, 0, 0, 0, 1, 0
                }); break;

            case IfcSIUnitName.CANDELA: result = GetOrCreateExponents(new List <int> {
                    0, 0, 0, 0, 0, 0, 1
                }); break;

            case IfcSIUnitName.RADIAN: result = GetOrCreateExponents(new List <int> {
                    0, 0, 0, 0, 0, 0, 0
                }); break;

            case IfcSIUnitName.STERADIAN: result = GetOrCreateExponents(new List <int> {
                    0, 0, 0, 0, 0, 0, 0
                }); break;

            case IfcSIUnitName.HERTZ: result = GetOrCreateExponents(new List <int> {
                    0, 0, -1, 0, 0, 0, 0
                }); break;

            case IfcSIUnitName.NEWTON: result = GetOrCreateExponents(new List <int> {
                    1, 1, -2, 0, 0, 0, 0
                }); break;

            case IfcSIUnitName.PASCAL: result = GetOrCreateExponents(new List <int> {
                    -1, 1, -2, 0, 0, 0, 0
                }); break;

            case IfcSIUnitName.JOULE: result = GetOrCreateExponents(new List <int> {
                    2, 1, -2, 0, 0, 0, 0
                }); break;

            case IfcSIUnitName.WATT: result = GetOrCreateExponents(new List <int> {
                    2, 1, -3, 0, 0, 0, 0
                }); break;

            case IfcSIUnitName.COULOMB: result = GetOrCreateExponents(new List <int> {
                    0, 0, 1, 1, 0, 0, 0
                }); break;

            case IfcSIUnitName.VOLT: result = GetOrCreateExponents(new List <int> {
                    2, 1, -3, -1, 0, 0, 0
                }); break;

            case IfcSIUnitName.FARAD: result = GetOrCreateExponents(new List <int> {
                    -2, -1, 4, 1, 0, 0, 0
                }); break;

            case IfcSIUnitName.OHM: result = GetOrCreateExponents(new List <int> {
                    2, 1, -3, -2, 0, 0, 0
                }); break;

            case IfcSIUnitName.SIEMENS: result = GetOrCreateExponents(new List <int> {
                    -2, -1, 3, 2, 0, 0, 0
                }); break;

            case IfcSIUnitName.WEBER: result = GetOrCreateExponents(new List <int> {
                    2, 1, -2, -1, 0, 0, 0
                }); break;

            case IfcSIUnitName.TESLA: result = GetOrCreateExponents(new List <int> {
                    0, 1, -2, -1, 0, 0, 0
                }); break;

            case IfcSIUnitName.HENRY: result = GetOrCreateExponents(new List <int> {
                    2, 1, -2, -2, 0, 0, 0
                }); break;

            case IfcSIUnitName.DEGREE_CELSIUS: result = GetOrCreateExponents(new List <int> {
                    0, 0, 0, 0, 1, 0, 0
                }); break;

            case IfcSIUnitName.LUMEN: result = GetOrCreateExponents(new List <int> {
                    0, 0, 0, 0, 0, 0, 1
                }); break;

            case IfcSIUnitName.LUX: result = GetOrCreateExponents(new List <int> {
                    -2, 0, 0, 0, 0, 0, 1
                }); break;

            case IfcSIUnitName.BECQUEREL: result = GetOrCreateExponents(new List <int> {
                    0, 0, -1, 0, 0, 0, 0
                }); break;

            case IfcSIUnitName.GRAY: result = GetOrCreateExponents(new List <int> {
                    2, 0, -2, 0, 0, 0, 0
                }); break;

            case IfcSIUnitName.SIEVERT: result = GetOrCreateExponents(new List <int> {
                    2, 0, -2, 0, 0, 0, 0
                }); break;

            default: result = GetOrCreateExponents(new List <int> {
                    0, 0, 0, 0, 0, 0, 0
                }); break;
            }

            ExponentsCache.Add(name, result);
            return(result);
        }
 public static IfcDimensionalExponents DimensionsForSiUnit(IfcSIUnitName? siUnit)
 {
     if (siUnit == null) return null;
     switch (siUnit)
     {
         case IfcSIUnitName.METRE:
             return new IfcDimensionalExponents(1, 0, 0, 0, 0, 0, 0);
         case IfcSIUnitName.SQUARE_METRE:
             return new IfcDimensionalExponents(2, 0, 0, 0, 0, 0, 0);
         case IfcSIUnitName.CUBIC_METRE:
             return new IfcDimensionalExponents(3, 0, 0, 0, 0, 0, 0);
         case IfcSIUnitName.GRAM:
             return new IfcDimensionalExponents(0, 1, 0, 0, 0, 0, 0);
         case IfcSIUnitName.SECOND:
             return new IfcDimensionalExponents(0, 0, 1, 0, 0, 0, 0);
         case IfcSIUnitName.AMPERE:
             return new IfcDimensionalExponents(0, 0, 0, 1, 0, 0, 0);
         case IfcSIUnitName.KELVIN:
             return new IfcDimensionalExponents(0, 0, 0, 0, 1, 0, 0);
         case IfcSIUnitName.MOLE:
             return new IfcDimensionalExponents(0, 0, 0, 0, 0, 1, 0);
         case IfcSIUnitName.CANDELA:
             return new IfcDimensionalExponents(0, 0, 0, 0, 0, 0, 1);
         case IfcSIUnitName.RADIAN:
             return new IfcDimensionalExponents(0, 0, 0, 0, 0, 0, 0);
         case IfcSIUnitName.STERADIAN:
             return new IfcDimensionalExponents(0, 0, 0, 0, 0, 0, 0);
         case IfcSIUnitName.HERTZ:
             return new IfcDimensionalExponents(0, 0, -1, 0, 0, 0, 0);
         case IfcSIUnitName.NEWTON:
             return new IfcDimensionalExponents(1, 1, -2, 0, 0, 0, 0);
         case IfcSIUnitName.PASCAL:
             return new IfcDimensionalExponents(-1, 1, -2, 0, 0, 0, 0);
         case IfcSIUnitName.JOULE:
             return new IfcDimensionalExponents(2, 1, -2, 0, 0, 0, 0);
         case IfcSIUnitName.WATT:
             return new IfcDimensionalExponents(2, 1, -3, 0, 0, 0, 0);
         case IfcSIUnitName.COULOMB:
             return new IfcDimensionalExponents(0, 0, 1, 1, 0, 0, 0);
         case IfcSIUnitName.VOLT:
             return new IfcDimensionalExponents(2, 1, -3, -1, 0, 0, 0);
         case IfcSIUnitName.FARAD:
             return new IfcDimensionalExponents(-2, -1, 4, 1, 0, 0, 0);
         case IfcSIUnitName.OHM:
             return new IfcDimensionalExponents(2, 1, -3, -2, 0, 0, 0);
         case IfcSIUnitName.SIEMENS:
             return new IfcDimensionalExponents(-2, -1, 3, 2, 0, 0, 0);
         case IfcSIUnitName.WEBER:
             return new IfcDimensionalExponents(2, 1, -2, -1, 0, 0, 0);
         case IfcSIUnitName.TESLA:
             return new IfcDimensionalExponents(0, 1, -2, -1, 0, 0, 0);
         case IfcSIUnitName.HENRY:
             return new IfcDimensionalExponents(2, 1, -2, -2, 0, 0, 0);
         case IfcSIUnitName.DEGREE_CELSIUS:
             return new IfcDimensionalExponents(0, 0, 0, 0, 1, 0, 0);
         case IfcSIUnitName.LUMEN:
             return new IfcDimensionalExponents(0, 0, 0, 0, 0, 0, 1);
         case IfcSIUnitName.LUX:
             return new IfcDimensionalExponents(-2, 0, 0, 0, 0, 0, 1);
         case IfcSIUnitName.BECQUEREL:
             return new IfcDimensionalExponents(0, 0, -1, 0, 0, 0, 0);
         case IfcSIUnitName.GRAY:
             return new IfcDimensionalExponents(2, 0, -2, 0, 0, 0, 0);
         case IfcSIUnitName.SIEVERT:
             return new IfcDimensionalExponents(2, 0, -2, 0, 0, 0, 0);
         default:
             return new IfcDimensionalExponents(0, 0, 0, 0, 0, 0, 0);
     }
 }
Exemple #26
0
 public override void IfcParse(int propIndex, IPropertyValue value)
 {
     switch (propIndex)
     {
         case 0:
             break; //do nothing NamedUnit.Dimensional Exponents is overrideen and derived in this class
         case 1:
             base.IfcParse(propIndex, value);
             break;
         case 2:
             _prefix = (IfcSIPrefix) Enum.Parse(typeof (IfcSIPrefix), value.EnumVal, true);
             break;
         case 3:
             _name = (IfcSIUnitName) Enum.Parse(typeof (IfcSIUnitName), value.EnumVal, true);
             break;
         default:
             this.HandleUnexpectedAttribute(propIndex, value); break;
     }
 }
Exemple #27
0
        }                                                                                                                                                      // derived


        /// <summary>
        /// Construct a IfcSIUnit with all required attributes.
        /// </summary>
        public IfcSIUnit(IfcDimensionalExponents dimensions, IfcUnitEnum unitType, IfcSIUnitName name) : base(dimensions, unitType)
        {
            Name = name;
        }
Exemple #28
0
 public IfcSIUnit(IfcDimensionalExponents dimensions, IfcUnitEnum unitType, IfcSIPrefix prefix, IfcSIUnitName name) : base(dimensions, unitType)
 {
     Prefix = prefix;
     Name   = name;
 }
Exemple #29
0
        public static void SetOrChangeSIUnit(this IfcProject ifcProject, IfcUnitEnum unitType, IfcSIUnitName siUnitName,
                                             IfcSIPrefix?siUnitPrefix)
        {
            IModel model = ifcProject.ModelOf;

            if (ifcProject.UnitsInContext == null)
            {
                ifcProject.UnitsInContext = model.Instances.New <IfcUnitAssignment>();
            }

            IfcUnitAssignment unitsAssignment = ifcProject.UnitsInContext;

            unitsAssignment.SetOrChangeSIUnit(unitType, siUnitName, siUnitPrefix);
        }
Exemple #30
0
 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;
 }
Exemple #31
0
		public IfcSIUnit(DatabaseIfc m, IfcUnitEnum unitEnum, IfcSIPrefix pref, IfcSIUnitName name) : base(m, unitEnum, false) { mPrefix = pref; mName = name; }