Example #1
0
 public IfcSIUnit(IfcUnitEnum unitType, IfcSIPrefix prefix, IfcSIUnitName name)
 {
     Dimensions = new IfcDimensionalExponents();
     Dimensions.IsDerived = true;
     UnitType = unitType;
     Prefix = prefix;
     Name = name;
 }
Example #2
0
 public IfcSIUnit(IfcUnitEnum unitType, IfcSIPrefix prefix, IfcSIUnitName name)
 {
     Dimensions           = new IfcDimensionalExponents();
     Dimensions.IsDerived = true;
     UnitType             = unitType;
     Prefix = prefix;
     Name   = name;
 }
        public SIUnit(IfcStore model, IfcSIUnitName name, IfcSIPrefix prefix, IfcUnitEnum unitType)
        {
            ifcSiUnit = model.Instances.New <IfcSIUnit>(p =>
            {
                p.Name     = name;
                p.Prefix   = prefix;
                p.UnitType = unitType;
            });

            this.name     = name;
            this.prefix   = prefix;
            this.unitType = unitType;
        }
 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;
 }
        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);
        }
Example #8
0
 public IfcSIUnit(IfcDimensionalExponents dimensions, IfcUnitEnum unitType, IfcSIPrefix prefix, IfcSIUnitName name) : base(dimensions, unitType)
 {
     Prefix = prefix;
     Name   = name;
 }
Example #9
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);
 }
Example #10
0
		public IfcSIUnit(DatabaseIfc m, IfcUnitEnum unitEnum, IfcSIPrefix pref, IfcSIUnitName name) : base(m, unitEnum, false) { mPrefix = pref; mName = name; }