GeometryGym.Ifc.IfcUnitAssignment.setStructuralUnits C# (CSharp) Méthode

setStructuralUnits() private méthode

private setStructuralUnits ( ) : void
Résultat void
        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);
        }