Inheritance: BaseClassIfc, IfcUnit
Example #1
0
 protected IfcNamedUnit(DatabaseIfc db, IfcNamedUnit u) : base(db, u)
 {
     if (u.mDimensions != null)
     {
         Dimensions = db.Factory.Duplicate(u.Dimensions) as IfcDimensionalExponents;
     }
     mUnitType = u.mUnitType;
 }
Example #2
0
        internal void Replace(IfcNamedUnit unit)
        {
            IfcNamedUnit existing = mUnits.OfType <IfcNamedUnit>().Where(x => x.UnitType == unit.UnitType).FirstOrDefault();

            if (existing != null)
            {
                mUnits.Remove(existing);
            }
            Units.Add(unit);
        }
Example #3
0
 internal void Replace(IfcConversionBasedUnit cbu)
 {
     for (int icounter = 0; icounter < mUnits.Count; icounter++)
     {
         IfcNamedUnit u = mDatabase[mUnits[icounter]] as IfcNamedUnit;
         if (u != null && u.UnitType == cbu.UnitType)
         {
             mUnits[icounter] = cbu.mIndex;
             return;
         }
     }
 }
Example #4
0
 internal IfcNamedUnit Find(IfcUnitEnum unit)
 {
     foreach (IfcUnit u in Units)
     {
         IfcNamedUnit nu = u as IfcNamedUnit;
         if (nu != null && nu.UnitType == unit)
         {
             return(nu);
         }
     }
     return(null);
 }
Example #5
0
 internal void Replace(IfcNamedUnit unit)
 {
     for (int icounter = 0; icounter < mUnits.Count; icounter++)
     {
         IfcNamedUnit u = mUnits[icounter] as IfcNamedUnit;
         if (u != null && u.UnitType == unit.UnitType)
         {
             mUnits[icounter] = unit;
             return;
         }
     }
     Units.Add(unit);
 }
Example #6
0
 public IfcNamedUnit this[IfcUnitEnum unit]
 {
     get
     {
         foreach (IfcUnit u in Units)
         {
             IfcNamedUnit nu = u as IfcNamedUnit;
             if (nu != null && nu.UnitType == unit)
             {
                 return(nu);
             }
         }
         return(null);
     }
 }
Example #7
0
        internal double ScaleSI(IfcUnitEnum unitType)
        {
            IfcNamedUnit namedUnit = this[unitType];

            if (namedUnit != null)
            {
                IfcSIUnit siUnit = namedUnit as IfcSIUnit;
                if (siUnit != null)
                {
                    return(siUnit.SIFactor);
                }
                IfcConversionBasedUnit conversionBasedUnit = namedUnit as IfcConversionBasedUnit;
                if (conversionBasedUnit != null)
                {
                    return(conversionBasedUnit.SIFactor);
                }
            }
            return(1);
        }
Example #8
0
 internal double getScaleSI(IfcUnitEnum unitType)
 {
     foreach (IfcUnit u in Units)
     {
         IfcNamedUnit nu = u as IfcNamedUnit;
         if (nu != null && nu.UnitType == unitType)
         {
             IfcSIUnit si = nu as IfcSIUnit;
             if (si != null)
             {
                 return(si.getSIFactor());
             }
             IfcConversionBasedUnit cbu = nu as IfcConversionBasedUnit;
             if (cbu != null)
             {
                 return(cbu.getSIFactor());
             }
         }
     }
     return(1);
 }
        protected override void setJSON(JObject obj, BaseClassIfc host, SetJsonOptions options)
        {
            base.setJSON(obj, host, options);
            string str = MapProjection;

            if (!string.IsNullOrEmpty(str))
            {
                obj["MapProjection"] = str;
            }
            str = MapZone;
            if (!string.IsNullOrEmpty(str))
            {
                obj["MapZone"] = str;
            }
            IfcNamedUnit unit = MapUnit;

            if (unit != null)
            {
                obj["MapUnit"] = unit.getJson(this, options);
            }
        }
Example #10
0
 internal IfcQuantityArea(DatabaseIfc m, string name, string desc, IfcNamedUnit unit, double area, string formula) : base(m, name, desc, unit)
 {
     mAreaValue = area; mFormula = formula;
 }
Example #11
0
 protected static void parseFields(IfcNamedUnit u, List <string> arrFields, ref int ipos)
 {
     u.mDimensions = ParserSTEP.ParseLink(arrFields[ipos++]); u.mUnitType = (IfcUnitEnum)Enum.Parse(typeof(IfcUnitEnum), arrFields[ipos++].Replace(".", ""));
 }
Example #12
0
 protected IfcNamedUnit(IfcNamedUnit p) : base()
 {
     mDimensions = p.mDimensions; mUnitType = p.mUnitType;
 }
Example #13
0
		public IfcDerivedUnitElement(IfcNamedUnit u, int exponent) : base(u.mDatabase) { mUnit = u.mIndex; mExponent = exponent; }
Example #14
0
		internal IfcQuantityWeight(DatabaseIfc m, string name, string desc, IfcNamedUnit unit, double weight, string formula) : base(m, name, desc, unit) { mWeightValue = weight; mFormula = formula; }
Example #15
0
        internal void setStructuralUnits()
        {
            if (mStructuralSet)
            {
                return;
            }
            mStructuralSet = true;
            DatabaseIfc m = mDatabase;

            IfcNamedUnit fu = Find(IfcUnitEnum.FORCEUNIT);

            if (fu == null)
            {
                fu = new IfcSIUnit(m, IfcUnitEnum.FORCEUNIT, IfcSIPrefix.NONE, IfcSIUnitName.NEWTON);
                AddUnit(fu);
            }
            IfcSIUnit lengthSI = m.Factory.SILength, volumeSI = m.Factory.SIVolume;

            if (Find(IfcDerivedUnitEnum.TORQUEUNIT) == null)
            {
                AddUnit(new IfcDerivedUnit(new IfcDerivedUnitElement(fu, 1), new IfcDerivedUnitElement(lengthSI, 1), IfcDerivedUnitEnum.TORQUEUNIT));
            }
            if (Find(IfcDerivedUnitEnum.LINEARFORCEUNIT) == null)
            {
                AddUnit(new IfcDerivedUnit(new IfcDerivedUnitElement(fu, 1), new IfcDerivedUnitElement(lengthSI, -1), IfcDerivedUnitEnum.LINEARFORCEUNIT));
            }
            if (Find(IfcDerivedUnitEnum.LINEARMOMENTUNIT) == null)
            {
                AddUnit(new IfcDerivedUnit(new IfcDerivedUnitElement(fu, 1), IfcDerivedUnitEnum.LINEARMOMENTUNIT));
            }
            if (Find(IfcDerivedUnitEnum.PLANARFORCEUNIT) == null)
            {
                AddUnit(new IfcDerivedUnit(new IfcDerivedUnitElement(fu, 1), new IfcDerivedUnitElement(lengthSI, -2), IfcDerivedUnitEnum.PLANARFORCEUNIT));
            }
            if (Find(IfcDerivedUnitEnum.MODULUSOFELASTICITYUNIT) == null)
            {
                AddUnit(new IfcDerivedUnit(new IfcDerivedUnitElement(fu, 1), new IfcDerivedUnitElement(lengthSI, -2), IfcDerivedUnitEnum.MODULUSOFELASTICITYUNIT));
            }

            IfcNamedUnit time = Find(IfcUnitEnum.TIMEUNIT);

            if (time == null || Math.Abs(time.getSIFactor() - 1) < mDatabase.Tolerance)
            {
                time = new IfcSIUnit(mDatabase, IfcUnitEnum.TIMEUNIT, IfcSIPrefix.NONE, IfcSIUnitName.SECOND);
            }
            if (Find(IfcDerivedUnitEnum.ACCELERATIONUNIT) == null)
            {
                AddUnit(new IfcDerivedUnit(new IfcDerivedUnitElement(lengthSI, 1), new IfcDerivedUnitElement(time, -2), IfcDerivedUnitEnum.ACCELERATIONUNIT));
            }
            if (Find(IfcUnitEnum.PRESSUREUNIT) == null)
            {
                AddUnit(new IfcSIUnit(m, IfcUnitEnum.PRESSUREUNIT, IfcSIPrefix.NONE, IfcSIUnitName.PASCAL));
            }
            if (Find(IfcDerivedUnitEnum.SECTIONMODULUSUNIT) == null)
            {
                AddUnit(new IfcDerivedUnit(new IfcDerivedUnitElement(lengthSI, 3), IfcDerivedUnitEnum.SECTIONMODULUSUNIT));
            }
            if (Find(IfcDerivedUnitEnum.MOMENTOFINERTIAUNIT) == null)
            {
                AddUnit(new IfcDerivedUnit(new IfcDerivedUnitElement(lengthSI, 4), IfcDerivedUnitEnum.MOMENTOFINERTIAUNIT));
            }
            IfcSIUnit massu = Find(IfcUnitEnum.MASSUNIT) as IfcSIUnit;

            if (massu == null)
            {
                massu = new IfcSIUnit(m, IfcUnitEnum.MASSUNIT, IfcSIPrefix.KILO, IfcSIUnitName.GRAM);
                AddUnit(massu);
            }
            if (Find(IfcDerivedUnitEnum.MASSDENSITYUNIT) == null)
            {
                AddUnit(new IfcDerivedUnit(new IfcDerivedUnitElement(massu, 1), new IfcDerivedUnitElement(volumeSI, -1), IfcDerivedUnitEnum.MASSDENSITYUNIT));
            }
            IfcSIUnit kelvin = Find(IfcUnitEnum.THERMODYNAMICTEMPERATUREUNIT) as IfcSIUnit;

            if (kelvin == null)
            {
                kelvin = new IfcSIUnit(m, IfcUnitEnum.THERMODYNAMICTEMPERATUREUNIT, IfcSIPrefix.NONE, IfcSIUnitName.KELVIN);
                AddUnit(kelvin);
            }
            if (Find(IfcDerivedUnitEnum.THERMALEXPANSIONCOEFFICIENTUNIT) == null)
            {
                AddUnit(new IfcDerivedUnit(new IfcDerivedUnitElement(kelvin, -1), IfcDerivedUnitEnum.THERMALEXPANSIONCOEFFICIENTUNIT));
            }
            if (Find(IfcDerivedUnitEnum.LINEARSTIFFNESSUNIT) == null)
            {
                AddUnit(new IfcDerivedUnit(new IfcDerivedUnitElement(fu, 1), new IfcDerivedUnitElement(lengthSI, -1), IfcDerivedUnitEnum.LINEARSTIFFNESSUNIT));
            }

            IfcNamedUnit radians = Find(IfcUnitEnum.PLANEANGLEUNIT);

            if (radians == null || Math.Abs(radians.getSIFactor() - 1) < mDatabase.Tolerance)
            {
                radians = new IfcSIUnit(mDatabase, IfcUnitEnum.PLANEANGLEUNIT, IfcSIPrefix.NONE, IfcSIUnitName.RADIAN);
            }
            if (Find(IfcDerivedUnitEnum.ROTATIONALSTIFFNESSUNIT) == null)
            {
                AddUnit(new IfcDerivedUnit(new IfcDerivedUnitElement(fu, 1), new IfcDerivedUnitElement(lengthSI, 1), new IfcDerivedUnitElement(radians, -1), IfcDerivedUnitEnum.ROTATIONALSTIFFNESSUNIT));
            }
        }
Example #16
0
 internal IfcQuantityTime(DatabaseIfc m, string name, string desc, IfcNamedUnit unit, int ifctimemeasure, string formula) : base(m, name, desc, unit)
 {
     mTimeValue = ifctimemeasure; mFormula = formula;
 }
Example #17
0
 internal IfcQuantityLength(DatabaseIfc m, string name, string desc, IfcNamedUnit unit, double length, string formula) : base(m, name, desc, unit)
 {
     mLengthValue = length; mFormula = formula;
 }
Example #18
0
		internal IfcQuantityTime(DatabaseIfc m, string name, string desc, IfcNamedUnit unit, int ifctimemeasure, string formula) : base(m, name, desc, unit) { mTimeValue = ifctimemeasure; mFormula = formula; }
Example #19
0
 protected IfcNamedUnit(DatabaseIfc db, IfcNamedUnit u)
     : base(db,u)
 {
     if(u.mDimensions > 0) Dimensions = db.Factory.Duplicate(u.Dimensions) as IfcDimensionalExponents; mUnitType = u.mUnitType;
 }
Example #20
0
		protected IfcNamedUnit(IfcNamedUnit p) : base() { mDimensions = p.mDimensions; mUnitType = p.mUnitType; }
Example #21
0
		internal IfcQuantityLength(DatabaseIfc m, string name, string desc, IfcNamedUnit unit, double length, string formula) : base(m, name, desc, unit) { mLengthValue = length; mFormula = formula; }
Example #22
0
		internal IfcQuantityCount(DatabaseIfc m, string name, string desc, IfcNamedUnit unit, double count, string formula) : base(m, name, desc, unit) { mCountValue = count; mFormula = formula; }
Example #23
0
		internal IfcQuantityArea(DatabaseIfc m, string name, string desc, IfcNamedUnit unit, double area, string formula) : base(m, name, desc, unit) { mAreaValue = area; mFormula = formula; }
Example #24
0
 internal IfcQuantityWeight(DatabaseIfc m, string name, string desc, IfcNamedUnit unit, double weight, string formula) : base(m, name, desc, unit)
 {
     mWeightValue = weight; mFormula = formula;
 }
Example #25
0
 internal IfcQuantityVolume(DatabaseIfc m, string name, string desc, IfcNamedUnit unit, double vol, string formula) : base(m, name, desc, unit)
 {
     mVolumeValue = vol; mFormula = formula;
 }
Example #26
0
		internal IfcPropertyBoundedValue(DatabaseIfc m, string name, string desc, IfcValue upper, IfcValue lower, IfcNamedUnit unit, IfcValue set)
			: base(m, name, desc)
		{
			mUpperBoundValue = upper;
			mLowerBoundValue = lower;
			mSetPointValue = set;
			if (unit != null)
				mUnit = unit.mIndex;
		}
Example #27
0
		internal IfcPropertyListValue(DatabaseIfc m, string name, string desc, IfcNamedUnit unit, List<IfcValue> values)
			: base(m, name, desc) { if (unit != null) mUnit = unit.mIndex; mNominalValue = values; }
Example #28
0
		protected IfcPhysicalSimpleQuantity(DatabaseIfc m, string name, string desc, IfcNamedUnit unit) : base(m, name, desc) { Unit = unit; }
Example #29
0
 protected static void parseFields(IfcNamedUnit u, List<string> arrFields, ref int ipos)
 {
     u.mDimensions = ParserSTEP.ParseLink(arrFields[ipos++]); u.mUnitType = (IfcUnitEnum)Enum.Parse(typeof(IfcUnitEnum), arrFields[ipos++].Replace(".", ""));
 }
Example #30
0
		internal IfcQuantityVolume(DatabaseIfc m, string name, string desc, IfcNamedUnit unit, double vol, string formula) : base(m, name, desc, unit) { mVolumeValue = vol; mFormula = formula; }
Example #31
0
		internal IfcProjectedCRS(IfcProjectedCRS m) : base(m) { mName = m.mName; mMapZone = m.mMapZone; mMapUnit = m.mMapUnit; }
Example #32
0
 internal IfcQuantityCount(DatabaseIfc m, string name, string desc, IfcNamedUnit unit, double count, string formula) : base(m, name, desc, unit)
 {
     mCountValue = count; mFormula = formula;
 }