internal void SetUnits(Length length) { if (length == Length.Millimetre) { mUnits.Add(new IfcSIUnit(mDatabase, IfcUnitEnum.LENGTHUNIT, IfcSIPrefix.MILLI, IfcSIUnitName.METRE).mIndex); mDatabase.ScaleSI = 0.001; } else if (length == Length.Centimetre) { mUnits.Add(new IfcSIUnit(mDatabase, IfcUnitEnum.LENGTHUNIT, IfcSIPrefix.CENTI, IfcSIUnitName.METRE).mIndex); mDatabase.ScaleSI = 0.01; } else if (length == Length.Inch) { IfcMeasureWithUnit mwu = new IfcMeasureWithUnit(new IfcLengthMeasure(0.0254), mDatabase.Factory.SILength); mUnits.Add(new IfcConversionBasedUnit(IfcUnitEnum.LENGTHUNIT, "Inches", mwu).mIndex); mDatabase.ScaleSI = 0.0254; } else if (length == Length.Foot) { IfcMeasureWithUnit mwu = new IfcMeasureWithUnit(new IfcLengthMeasure(FeetToMetre), mDatabase.Factory.SILength); mUnits.Add(new IfcConversionBasedUnit(IfcUnitEnum.LENGTHUNIT, "Feet", mwu).mIndex); mDatabase.ScaleSI = FeetToMetre; } else { mUnits.Add(mDatabase.Factory.SILength.mIndex); mDatabase.ScaleSI = 1; } SetUnits(); }
internal void SetUnits() { if (Find(IfcUnitEnum.AREAUNIT) == null) { mUnits.Add(mDatabase.Factory.SIArea.mIndex); } if (Find(IfcUnitEnum.VOLUMEUNIT) == null) { mUnits.Add(mDatabase.Factory.SIVolume.mIndex); } if (Find(IfcUnitEnum.PLANEANGLEUNIT) == null) { IfcSIUnit radians = new IfcSIUnit(mDatabase, IfcUnitEnum.PLANEANGLEUNIT, IfcSIPrefix.NONE, IfcSIUnitName.RADIAN); mUnits.Add(mDatabase.Factory.Options.AngleUnitsInRadians ? radians.mIndex : new IfcConversionBasedUnit(IfcUnitEnum.PLANEANGLEUNIT, "DEGREE", new IfcMeasureWithUnit(new IfcPlaneAngleMeasure(Math.PI / 180.0), radians)).mIndex); } if (Find(IfcUnitEnum.TIMEUNIT) == null) { IfcSIUnit seconds = new IfcSIUnit(mDatabase, IfcUnitEnum.TIMEUNIT, IfcSIPrefix.NONE, IfcSIUnitName.SECOND); if (mDatabase.mTimeInDays) { IfcMeasureWithUnit mu = new IfcMeasureWithUnit(new IfcTimeMeasure(60 * 60 * 24), seconds); mUnits.Add(new IfcConversionBasedUnit(IfcUnitEnum.TIMEUNIT, "DAY", mu).mIndex); } else { mUnits.Add(seconds.mIndex); } } }
internal void SetUnits() { if (this[IfcUnitEnum.AREAUNIT] == null) { Units.Add(mDatabase.Factory.SIArea); } if (this[IfcUnitEnum.VOLUMEUNIT] == null) { Units.Add(mDatabase.Factory.SIVolume); } if (this[IfcUnitEnum.PLANEANGLEUNIT] == null) { if (mDatabase.Factory.Options.AngleUnitsInRadians) { Units.Add(new IfcSIUnit(mDatabase, IfcUnitEnum.PLANEANGLEUNIT, IfcSIPrefix.NONE, IfcSIUnitName.RADIAN)); } else { Units.Add(mDatabase.Factory.ConversionUnit(IfcConversionBasedUnit.Common.degree)); } } if (this[IfcUnitEnum.TIMEUNIT] == null) { IfcSIUnit seconds = new IfcSIUnit(mDatabase, IfcUnitEnum.TIMEUNIT, IfcSIPrefix.NONE, IfcSIUnitName.SECOND); if (mDatabase.mTimeInDays) { IfcMeasureWithUnit mu = new IfcMeasureWithUnit(new IfcTimeMeasure(60 * 60 * 24), seconds); Units.Add(new IfcConversionBasedUnit(IfcUnitEnum.TIMEUNIT, "DAY", mu)); } else { Units.Add(seconds); } } }
public IfcUnit LengthUnit(IfcUnitAssignment.Length length) { if (length == IfcUnitAssignment.Length.Millimetre) { return(new IfcSIUnit(mDatabase, IfcUnitEnum.LENGTHUNIT, IfcSIPrefix.MILLI, IfcSIUnitName.METRE)); } if (length == IfcUnitAssignment.Length.Centimetre) { return(new IfcSIUnit(mDatabase, IfcUnitEnum.LENGTHUNIT, IfcSIPrefix.CENTI, IfcSIUnitName.METRE)); } if (length == IfcUnitAssignment.Length.Inch) { IfcMeasureWithUnit mwu = new IfcMeasureWithUnit(new IfcLengthMeasure(0.0254), SILength); return(new IfcConversionBasedUnit(IfcUnitEnum.LENGTHUNIT, "Inches", mwu)); } if (length == IfcUnitAssignment.Length.Foot) { IfcMeasureWithUnit mwu = new IfcMeasureWithUnit(new IfcLengthMeasure(IfcUnitAssignment.FeetToMetre), SILength); return(new IfcConversionBasedUnit(IfcUnitEnum.LENGTHUNIT, "Feet", mwu)); } return(SILength); }
internal static IfcMeasureWithUnit Parse(string strDef) { IfcMeasureWithUnit m = new IfcMeasureWithUnit(); int ipos = 0; parseFields(m, ParserSTEP.SplitLineFields(strDef), ref ipos); return m; }
internal static void parseFields(IfcMeasureWithUnit m, List<string> arrFields, ref int ipos) { string s = arrFields[ipos++]; m.mValueComponent = ParserIfc.parseValue(s); if (m.mValueComponent == null) m.mVal = s; m.mUnitComponent = ParserSTEP.ParseLink(arrFields[ipos++]); }
internal IfcMeasureWithUnit(IfcMeasureWithUnit m) : base() { mValueComponent = m.mValueComponent; mUnitComponent = m.mUnitComponent; }
internal IfcConversionBasedUnitWithOffset(IfcUnitEnum unit, string name, IfcMeasureWithUnit mu, double offset) : base(unit, name, mu) { mConversionOffset = offset; }
internal IfcConversionBasedUnit(IfcUnitEnum unit, string name, IfcMeasureWithUnit mu) : base(mu.mDatabase, unit, true) { Name = name.Replace("'", ""); mConversionFactor = mu.mIndex; }
internal void SetUnits() { if (Find(IfcUnitEnum.AREAUNIT) == null) mUnits.Add(mDatabase.Factory.SIArea.mIndex); if (Find(IfcUnitEnum.VOLUMEUNIT) == null) mUnits.Add(mDatabase.Factory.SIVolume.mIndex); if (Find(IfcUnitEnum.PLANEANGLEUNIT) == null) { IfcSIUnit radians = new IfcSIUnit(mDatabase, IfcUnitEnum.PLANEANGLEUNIT, IfcSIPrefix.NONE, IfcSIUnitName.RADIAN); mUnits.Add(mDatabase.Factory.Options.AngleUnitsInRadians ? radians.mIndex : new IfcConversionBasedUnit(IfcUnitEnum.PLANEANGLEUNIT, "DEGREE", new IfcMeasureWithUnit(new IfcPlaneAngleMeasure(Math.PI / 180.0), radians)).mIndex); } if (Find(IfcUnitEnum.TIMEUNIT) == null) { IfcSIUnit seconds = new IfcSIUnit(mDatabase, IfcUnitEnum.TIMEUNIT, IfcSIPrefix.NONE, IfcSIUnitName.SECOND); if (mDatabase.mTimeInDays) { IfcMeasureWithUnit mu = new IfcMeasureWithUnit(new IfcTimeMeasure(60 * 60 * 24), seconds); mUnits.Add(new IfcConversionBasedUnit(IfcUnitEnum.TIMEUNIT, "DAY", mu).mIndex); } else mUnits.Add(seconds.mIndex); } }