Inheritance: IfcNamedUnit
Beispiel #1
0
 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);
         }
     }
 }
Beispiel #2
0
 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);
         }
     }
 }
Beispiel #3
0
 internal void initData()
 {
     initGeom();
     mSILength = new IfcSIUnit(mDatabase, IfcUnitEnum.LENGTHUNIT, IfcSIPrefix.NONE, IfcSIUnitName.METRE);
     mSIArea   = new IfcSIUnit(mDatabase, IfcUnitEnum.AREAUNIT, IfcSIPrefix.NONE, IfcSIUnitName.SQUARE_METRE);
     mSIVolume = new IfcSIUnit(mDatabase, IfcUnitEnum.VOLUMEUNIT, IfcSIPrefix.NONE, IfcSIUnitName.CUBIC_METRE);
 }
Beispiel #4
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);
        }
Beispiel #5
0
 internal double ScaleSI(IfcUnitEnum unitType)
 {
     foreach (IfcNamedUnit namedUnit in Units.OfType <IfcNamedUnit>())
     {
         if (namedUnit.UnitType == unitType)
         {
             IfcSIUnit siUnit = namedUnit as IfcSIUnit;
             if (siUnit != null)
             {
                 return(siUnit.SIFactor);
             }
             IfcConversionBasedUnit conversionBasedUnit = namedUnit as IfcConversionBasedUnit;
             if (conversionBasedUnit != null)
             {
                 return(conversionBasedUnit.SIFactor);
             }
         }
     }
     return(1);
 }
Beispiel #6
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);
 }
Beispiel #7
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));
            }
        }
Beispiel #8
0
        internal BaseClassIfc InterpretLine(string line)
        {
            if (line.StartsWith("ISO"))
            {
                return(null);
            }
            string ts = line.Trim().Replace(" ", "");

            if (ts.StartsWith("FILE_SCHEMA(('IFC2X4", true, System.Globalization.CultureInfo.CurrentCulture) ||
                ts.StartsWith("FILE_SCHEMA(('IFC4", true, System.Globalization.CultureInfo.CurrentCulture))
            {
                mRelease = ReleaseVersion.IFC4;
                return(null);
            }
            BaseClassIfc result = ParserIfc.ParseLine(line, mRelease);

            if (result == null)
            {
                int    ifcID = 0;
                string kw = "", str = "";
                ParserIfc.GetKeyWord(line, out ifcID, out kw, out str);
                if (string.IsNullOrEmpty(kw))
                {
                    return(null);
                }

                result = new BaseClassIfc(ifcID, kw, str);
            }
            if (result == null)
            {
                return(null);
            }
            IfcApplication application = result as IfcApplication;

            if (application != null)
            {
                IfcApplication ea = mFactory.mApplication;
                if (ea != null && ea.mVersion == application.mVersion)
                {
                    if (string.Compare(ea.ApplicationFullName, application.ApplicationFullName, true) == 0)
                    {
                        if (string.Compare(ea.mApplicationIdentifier, application.mApplicationIdentifier) == 0)
                        {
                            mIfcObjects[ea.mIndex] = null;
                            mFactory.mApplication  = application;
                            mFactory.OwnerHistory(IfcChangeActionEnum.ADDED).mLastModifyingApplication = application.mIndex;
                            if (mFactory.mOwnerHistoryModify != null)
                            {
                                mFactory.mOwnerHistoryModify.mLastModifyingApplication = application.mIndex;
                            }
                        }
                    }
                }
            }
            IfcContext context = result as IfcContext;

            if (context != null)
            {
                mContext = context;
            }
            IfcGeometricRepresentationContext geometricRepresentationContext = result as IfcGeometricRepresentationContext;

            if (geometricRepresentationContext != null)
            {
                if (string.Compare(geometricRepresentationContext.mContextType, "Plan", true) != 0)
                {
                    mFactory.mGeomRepContxt = geometricRepresentationContext;
                }
                if (geometricRepresentationContext.mPrecision > 1e-6)
                {
                    Tolerance = geometricRepresentationContext.mPrecision;
                }
            }
            IfcSIUnit unit = result as IfcSIUnit;

            if (unit != null)
            {
                if (unit.Name == IfcSIUnitName.METRE && unit.Prefix == IfcSIPrefix.NONE)
                {
                    mFactory.mSILength = unit;
                }
                else if (unit.Name == IfcSIUnitName.SQUARE_METRE && unit.Prefix == IfcSIPrefix.NONE)
                {
                    mFactory.mSIArea = unit;
                }
                else if (unit.Name == IfcSIUnitName.CUBIC_METRE && unit.Prefix == IfcSIPrefix.NONE)
                {
                    mFactory.mSIVolume = unit;
                }
            }
            this[result.mIndex] = result;

            //IfcWorkPlan workPlan = result as IfcWorkPlan;
            //if(workPlan != null)
            //{
            //	mWorkPlans.Add(workPlan);
            //	return workPlan;
            //}
            return(result);
        }
Beispiel #9
0
        internal BaseClassIfc interpretLine(string line)
        {
            BaseClassIfc result = ParserIfc.ParseLine(line, mRelease);

            if (result == null)
            {
                if (line.StartsWith("ISO"))
                {
                    return(null);
                }
                if (setFileLine(line))
                {
                    return(null);
                }
                int    ifcID = 0;
                string kw = "", str = "";
                ParserSTEP.GetKeyWord(line, out ifcID, out kw, out str);
                if (string.IsNullOrEmpty(kw) || !kw.ToLower().StartsWith("ifc"))
                {
                    return(null);
                }

                result = new BaseClassIfc(ifcID, kw, str);
            }
            if (result == null)
            {
                return(null);
            }
            IfcApplication application = result as IfcApplication;

            if (application != null)
            {
                IfcApplication ea = mFactory.mApplication;
                if (ea != null && ea.mVersion == application.mVersion)
                {
                    if (string.Compare(ea.ApplicationFullName, application.ApplicationFullName, true) == 0)
                    {
                        if (string.Compare(ea.mApplicationIdentifier, application.mApplicationIdentifier) == 0)
                        {
                            this[ea.mIndex]       = null;
                            mFactory.mApplication = application;
                            //	mFactory.OwnerHistory(IfcChangeActionEnum.ADDED).mLastModifyingApplication = application.mIndex;
                            //	if (mFactory.mOwnerHistories.ContainsKey(IfcChangeActionEnum.MODIFIED))
                            //		mFactory.mOwnerHistories[IfcChangeActionEnum.MODIFIED].mLastModifyingApplication = application.mIndex;
                        }
                    }
                }
            }

            IfcGeometricRepresentationContext geometricRepresentationContext = result as IfcGeometricRepresentationContext;

            if (geometricRepresentationContext != null)
            {
                Tolerance = geometricRepresentationContext.mPrecision;
            }
            IfcSIUnit unit = result as IfcSIUnit;

            if (unit != null)
            {
                if (unit.Name == IfcSIUnitName.METRE && unit.Prefix == IfcSIPrefix.NONE)
                {
                    mFactory.mSILength = unit;
                }
                else if (unit.Name == IfcSIUnitName.SQUARE_METRE && unit.Prefix == IfcSIPrefix.NONE)
                {
                    mFactory.mSIArea = unit;
                }
                else if (unit.Name == IfcSIUnitName.CUBIC_METRE && unit.Prefix == IfcSIPrefix.NONE)
                {
                    mFactory.mSIVolume = unit;
                }
            }
            return(result);
        }
Beispiel #10
0
 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);
     }
 }
Beispiel #11
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);
                mUnits.Add(fu.mIndex);
            }
            IfcSIUnit lengthSI = m.Factory.SILength, volumeSI = m.Factory.SIVolume;
            if (Find(IfcDerivedUnitEnum.TORQUEUNIT) == null)
                mUnits.Add(new IfcDerivedUnit(new IfcDerivedUnitElement(fu, 1), new IfcDerivedUnitElement(lengthSI, 1), IfcDerivedUnitEnum.TORQUEUNIT).mIndex);
            if (Find(IfcDerivedUnitEnum.LINEARFORCEUNIT) == null)
                mUnits.Add(new IfcDerivedUnit(new IfcDerivedUnitElement(fu, 1), new IfcDerivedUnitElement(lengthSI, -1), IfcDerivedUnitEnum.LINEARFORCEUNIT).mIndex);
            if (Find(IfcDerivedUnitEnum.PLANARFORCEUNIT) == null)
                mUnits.Add(new IfcDerivedUnit(new IfcDerivedUnitElement(fu, 1), new IfcDerivedUnitElement(lengthSI, -2), IfcDerivedUnitEnum.PLANARFORCEUNIT).mIndex);
            if (Find(IfcDerivedUnitEnum.MODULUSOFELASTICITYUNIT) == null)
                mUnits.Add(new IfcDerivedUnit(new IfcDerivedUnitElement(fu, 1), new IfcDerivedUnitElement(lengthSI, -2), IfcDerivedUnitEnum.MODULUSOFELASTICITYUNIT).mIndex);

            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)
                mUnits.Add(new IfcDerivedUnit(new IfcDerivedUnitElement(lengthSI, 1), new IfcDerivedUnitElement(time, -2), IfcDerivedUnitEnum.ACCELERATIONUNIT).mIndex);
            if(Find(IfcUnitEnum.PRESSUREUNIT) == null)
                mUnits.Add(new IfcSIUnit(m, IfcUnitEnum.PRESSUREUNIT, IfcSIPrefix.NONE, IfcSIUnitName.PASCAL).mIndex);
            if (Find(IfcDerivedUnitEnum.SECTIONMODULUSUNIT) == null)
                mUnits.Add(new IfcDerivedUnit(new IfcDerivedUnitElement(lengthSI, 3), IfcDerivedUnitEnum.SECTIONMODULUSUNIT).mIndex);
            if(Find(IfcDerivedUnitEnum.MOMENTOFINERTIAUNIT) == null)
                mUnits.Add(new IfcDerivedUnit(new IfcDerivedUnitElement(lengthSI, 4), IfcDerivedUnitEnum.MOMENTOFINERTIAUNIT).mIndex);
            IfcSIUnit massu = Find(IfcUnitEnum.MASSUNIT) as IfcSIUnit;
            if (massu == null)
            {
                massu = new IfcSIUnit(m, IfcUnitEnum.MASSUNIT, IfcSIPrefix.KILO, IfcSIUnitName.GRAM);
                mUnits.Add(massu.mIndex);
            }
            if (Find(IfcDerivedUnitEnum.MASSDENSITYUNIT) == null)
                mUnits.Add(new IfcDerivedUnit(new IfcDerivedUnitElement(massu, 1), new IfcDerivedUnitElement(volumeSI, -1), IfcDerivedUnitEnum.MASSDENSITYUNIT).mIndex);
            IfcSIUnit kelvin = Find(IfcUnitEnum.THERMODYNAMICTEMPERATUREUNIT) as IfcSIUnit;
            if (kelvin == null)
            {
                kelvin = new IfcSIUnit(m, IfcUnitEnum.THERMODYNAMICTEMPERATUREUNIT, IfcSIPrefix.NONE, IfcSIUnitName.KELVIN);
                mUnits.Add(kelvin.mIndex);
            }
            if (Find(IfcDerivedUnitEnum.THERMALEXPANSIONCOEFFICIENTUNIT) == null)
                mUnits.Add(new IfcDerivedUnit(new IfcDerivedUnitElement(kelvin, -1), IfcDerivedUnitEnum.THERMALEXPANSIONCOEFFICIENTUNIT).mIndex);
            if(Find(IfcDerivedUnitEnum.LINEARSTIFFNESSUNIT) == null)
                mUnits.Add(new IfcDerivedUnit(new IfcDerivedUnitElement(fu, 1), new IfcDerivedUnitElement(lengthSI, -1), IfcDerivedUnitEnum.LINEARSTIFFNESSUNIT).mIndex);

            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)
                mUnits.Add(new IfcDerivedUnit(new IfcDerivedUnitElement(fu, 1), new IfcDerivedUnitElement(lengthSI, 1), new IfcDerivedUnitElement(radians, -1), IfcDerivedUnitEnum.ROTATIONALSTIFFNESSUNIT).mIndex);
        }
Beispiel #12
0
		internal static IfcSIUnit Parse(string strDef) { IfcSIUnit u = new IfcSIUnit(); int ipos = 0; parseFields(u, ParserSTEP.SplitLineFields(strDef), ref ipos); return u; }
Beispiel #13
0
		internal static void parseFields(IfcSIUnit u, List<string> arrFields, ref int ipos)
		{
			IfcNamedUnit.parseFields(u, arrFields, ref ipos);
			string str = arrFields[ipos++];
			if (str.Contains("$"))
				u.mPrefix = IfcSIPrefix.NONE;
			else
				u.mPrefix = (IfcSIPrefix)Enum.Parse(typeof(IfcSIPrefix), str.Replace(".", ""));
			u.mName = (IfcSIUnitName)Enum.Parse(typeof(IfcSIUnitName), arrFields[ipos++].Replace(".", ""));
		}
Beispiel #14
0
		internal IfcSIUnit(IfcSIUnit p) : base(p) { }
Beispiel #15
0
		internal BaseClassIfc InterpretLine(string line,Aggregate aggregate)
		{
			if (line.StartsWith("ISO"))
				return null;
			string ts = line.Trim().Replace(" ", "");
			if (ts.StartsWith("FILE_SCHEMA(('IFC2X4", true, System.Globalization.CultureInfo.CurrentCulture) ||
					ts.StartsWith("FILE_SCHEMA(('IFC4", true, System.Globalization.CultureInfo.CurrentCulture))
			{ 
				mSchema = Schema.IFC4;
				return null;
			}
			BaseClassIfc result = ParserIfc.ParseLine(line, mSchema);
			if (result == null)
			{
				int ifcID = 0;
				string kw = "", str = "";
				ParserIfc.GetKeyWord(line, out ifcID, out kw, out str);
				if (string.IsNullOrEmpty(kw))
					return null;

				result = new BaseClassIfc(ifcID, kw,str);
			}
			if(result == null)
				return null;
			IfcApplication application = result as IfcApplication;
			if (application != null)
			{
				IfcApplication ea = mApplication;
				if (ea != null && ea.mVersion == application.mVersion)
				{
					if (string.Compare(ea.ApplicationFullName, application.ApplicationFullName, true) == 0)
					{
						if (string.Compare(ea.mApplicationIdentifier, application.mApplicationIdentifier) == 0)
						{
							mIfcObjects[ea.mIndex] = null;
							mApplication = application;
							OwnerHistory(IfcChangeActionEnum.ADDED).mLastModifyingApplication = application.mIndex;
							if (mOwnerHistoryModify != null)
								mOwnerHistoryModify.mLastModifyingApplication = application.mIndex;
						}
					}
				}
			}
			IfcContext context = result as IfcContext;
			if (context != null)
			{
				mContext = context;
#warning merge project if existing 
					
			}
			IfcGeometricRepresentationContext geometricRepresentationContext = result as IfcGeometricRepresentationContext;
			if (geometricRepresentationContext != null)
			{
				if (string.Compare(geometricRepresentationContext.mContextType, "Plan", true) != 0)
					mGeomRepContxt = geometricRepresentationContext;
				if (geometricRepresentationContext.mPrecision > 1e-6)
					Tolerance = geometricRepresentationContext.mPrecision;

			}
			IfcSIUnit unit = result as IfcSIUnit;
			if(unit != null)
			{
				if (unit.Name == IfcSIUnitName.METRE && unit.Prefix == IfcSIPrefix.NONE)
					mSILength = unit;
				else if (unit.Name == IfcSIUnitName.SQUARE_METRE && unit.Prefix == IfcSIPrefix.NONE)
					mSIArea = unit;
				else if (unit.Name == IfcSIUnitName.CUBIC_METRE && unit.Prefix == IfcSIPrefix.NONE)
					mSIVolume = unit;
			}
			aggregate.setAggregate(result);
			if (mIfcObjects.Count <= result.mIndex)
				for (int ncounter = mIfcObjects.Count; ncounter <= result.mIndex; ncounter++)
					mIfcObjects.Add(new BaseClassIfc());
			mIfcObjects[result.mIndex] = result;
			result.mDatabase = this;
			
			//IfcWorkPlan workPlan = result as IfcWorkPlan;
			//if(workPlan != null)
			//{
			//	mWorkPlans.Add(workPlan);
			//	return workPlan;
			//}
			return result;
		}
Beispiel #16
0
		internal void initData()
		{ 
			initGeom();
			mSILength = new IfcSIUnit(this, IfcUnitEnum.LENGTHUNIT, IfcSIPrefix.NONE, IfcSIUnitName.METRE);
			mSIArea = new IfcSIUnit(this, IfcUnitEnum.AREAUNIT, IfcSIPrefix.NONE, IfcSIUnitName.SQUARE_METRE);
			mSIVolume = new IfcSIUnit(this, IfcUnitEnum.VOLUMEUNIT, IfcSIPrefix.NONE, IfcSIUnitName.CUBIC_METRE);
		}