Esempio n. 1
0
        internal static DatabaseIfc Generate(ModelView mdv, string path)
        {
            DatabaseIfc db = new DatabaseIfc(true, mdv);
            //IfcGeometricRepresentationContext
            //IfcCartesianPoint
            //IfcAxis2Placement3D
            //IfcDirection
            //IfcAxis2Placement2D
            //IfcSIUnit
            //IfcLocalPlacement
            IfcSite site = new IfcSite(db, "TestSite");
            //IfcPerson  NOT RV
            //IfcOrganization  NOT RV
            //IfcPersonAndOrganization  NOT RV
            //IfcOwnerHistory  NOT RV
            //fcApplication NOT RV
            //                     IfcProjectLibrary NOT RV Can't have multiple context
            IfcProject project = new IfcProject(site, "TestProject", IfcUnitAssignment.Length.Millimetre)
            {
            };
            //IfcUnitAssignment
            //IfcRelAggregates
            IfcBuilding building = new IfcBuilding(site, "TestBuilding")
            {
            };
            IfcBuildingStorey buildingStorey = new IfcBuildingStorey(building, "TestBuildingStorey", 3000);
            IfcSpace          space          = new IfcSpace(buildingStorey, null, null)
            {
                Name = "TestSpace"
            };

            space.RelatingType = new IfcSpaceType(db, "TestSpaceType", IfcSpaceTypeEnum.INTERNAL);

            IfcZone zone = new IfcZone(buildingStorey, "TestZone", "TestZoneLongName", new List <IfcSpace>()
            {
                space
            });

            IfcLocalPlacement localPlacement = buildingStorey.Placement as IfcLocalPlacement;

            IfcMaterial material = new IfcMaterial(db, "TestMaterial")
            {
                Description = "TestDescription", Category = "TestCategory"
            };
            IfcMaterialProperties materialProperties = new IfcMaterialProperties("TestMaterialProperties", material)
            {
                Properties = new List <IfcProperty>()
                {
                    new IfcPropertySingleValue(db, "MassDensity", new IfcMassDensityMeasure(1))
                }
            };
            IfcSurfaceStyleShading surfaceStyleShading = new IfcSurfaceStyleShading(new IfcColourRgb(db, "Red", 1, 0, 0));
            IfcSurfaceStyle        surfaceStyle        = new IfcSurfaceStyle(surfaceStyleShading, null, null, null, null);
            IfcMaterialDefinitionRepresentation materialDefinitionRepresentation = new IfcMaterialDefinitionRepresentation(new List <IfcStyledRepresentation>()
            {
                new IfcStyledRepresentation(new IfcStyledItem(surfaceStyle, "TestStyledItem"))
            }, material);

            IfcIndexedPolyCurve          indexedPolyCurve          = IPE200Curve(db);
            IfcArbitraryClosedProfileDef arbitraryClosedProfileDef = new IfcArbitraryClosedProfileDef("IPE200", indexedPolyCurve);
            IfcMaterialProfile           materialProfile           = new IfcMaterialProfile("TestMaterialProfile", material, arbitraryClosedProfileDef);
            IfcMaterialProfileSet        materialProfileSet        = new IfcMaterialProfileSet("TestMaterialProfileSet", materialProfile);

            IfcExtrudedAreaSolid extrudedAreaSolid = new IfcExtrudedAreaSolid(arbitraryClosedProfileDef, new IfcAxis2Placement3D(new IfcCartesianPoint(db, 0, 0, 0), new IfcDirection(db, 1, 0, 0), new IfcDirection(db, 0, 1, 0)), new IfcDirection(db, 0, 0, 1), 5000);
            IfcBeamType          beamType          = new IfcBeamType(db, "TestBeamType", IfcBeamTypeEnum.BEAM);

            beamType.MaterialSelect = materialProfileSet;
            IfcBeam beam = new IfcBeam(buildingStorey, new IfcLocalPlacement(localPlacement, new IfcAxis2Placement3D(new IfcCartesianPoint(db, 1000, 2000, 0))
            {
                RefDirection = new IfcDirection(db, 0, 1, 0)
            }), new IfcProductDefinitionShape(new IfcShapeRepresentation(extrudedAreaSolid)));

            //IfcGeometricRepresentationSubContext
            beam.RelatingType = beamType;
            //IfcRelDefinesByType

            //	if(mdv != ModelView.Ifc4Reference)
            //			IfcActorRole  NOT RV

            //IfcActuator
            //IfcActuatorType
            //IfcAdvancedBrep  NOT RV
            //IfcAdvancedFace   NOT RV
            //IfcAirTerminal
            //IfcAirTerminalBox
            //IfcAirTerminalBoxType
            //IfcAirTerminalType
            //IfcAirToAirHeatRecovery
            //IfcAirToAirHeatRecoveryType
            //IfcAlarm
            //IfcAlarmType
            //IfcArbitraryOpenProfileDef
            //IfcArbitraryProfileDefWithVoids
            //IfcAsymmetricIShapeProfileDef  NOT RV
            //IfcAudioVisualAppliance
            //IfcAudioVisualApplianceType
            //IfcAxis1Placement
            //IfcBeamStandardCase  NOT RV
            //IfcBlock   NOT RV
            //IfcBoiler
            //IfcBoilerType
            //IfcBooleanClippingResult  NOT RV
            //IfcBooleanResult  NOT RV
            //IfcBSplineCurveWithKnots  NOT RV
            //IfcBSplineSurface  NOT RV
            //IfcBSplineSurfaceWithKnots  NOT RV
            //IfcBuildingElementPart
            //IfcBuildingElementPartType
            //IfcBuildingElementProxy
            //IfcBuildingElementProxyType
            //IfcBuildingSystem
            //IfcBurner
            //IfcBurnerType
            //IfcCableCarrierFitting
            //IfcCableCarrierFittingType
            //IfcCableCarrierSegment
            //IfcCableCarrierSegmentType
            //IfcCableFitting
            //IfcCableFittingType
            //IfcCableSegment
            //IfcCableSegmentType
            //IfcCartesianPointList2D
            //IfcCartesianPointList3D
            //IfcCartesianTransformationOperator2D
            //IfcCartesianTransformationOperator2DnonUniform
            //IfcCartesianTransformationOperator3D
            //IfcCartesianTransformationOperator3DnonUniform
            //IfcCenterLineProfileDef
            //IfcChiller
            //IfcChillerType
            //IfcChimney
            //IfcChimneyType
            //IfcCircle
            //IfcCircleHollowProfileDef  NOT RV
            //IfcCircleProfileDef  NOT RV
            //IfcCivilElement
            //IfcCivilElementType
            //IfcClassification
            //IfcClassificationReference
            //IfcClosedShell
            //IfcCoil
            //IfcCoilType
            //IfcColourRgbList
            //IfcColourSpecification
            //IfcColumn
            //IfcColumnStandardCase  NOT RV
            //IfcColumnType
            //IfcCommunicationsAppliance
            //IfcCommunicationsApplianceType
            //IfcComplexProperty
            //IfcCompositeProfileDef  NOT RV
            //IfcCompressor
            //IfcCompressorType
            //IfcCondenser
            //IfcCondenserType
            //IfcConnectedFaceSet  NOT RV
            //IfcConnectionCurveGeometry  NOT RV
            //IfcConnectionVolumeGeometry  NOT RV
            //IfcController
            //IfcControllerType
            //IfcConversionBasedUnit
            //IfcConversionBasedUnitWithOffset
            //IfcCooledBeam
            //IfcCooledBeamType
            //IfcCoolingTower
            //IfcCoolingTowerType
            //IfcCovering
            //IfcCoveringType
            //IfcCsgSolid  NOT RV
            //IfcCShapeProfileDef  NOT RV
            //IfcCurtainWall
            //IfcCurtainWallType
            //IfcCurveStyle
            //IfcCurveStyleFont
            //IfcCurveStyleFontPattern
            //IfcDamper
            //IfcDamperType
            //IfcDerivedProfileDef  NOT RV
            //IfcDerivedUnit
            //IfcDerivedUnitElement
            //IfcDimensionalExponents
            //IfcDiscreteAccessory
            //IfcDiscreteAccessoryType
            //IfcDistributionChamberElement
            //IfcDistributionChamberElementType
            //IfcDistributionCircuit
            //IfcDistributionControlElement
            //IfcDistributionControlElementType
            //IfcDistributionElement
            //IfcDistributionElementType
            //IfcDistributionFlowElement
            //IfcDistributionFlowElementType
            //IfcDistributionPort
            //IfcDistributionSystem
            //IfcDocumentReference
            //IfcDoor
            //IfcDoorLiningProperties
            //IfcDoorPanelProperties
            //IfcDoorStandardCase  NOT RV
            //IfcDoorType
            //IfcDuctFitting
            //IfcDuctFittingType
            //IfcDuctSegment
            //IfcDuctSegmentType
            //IfcDuctSilencer
            //IfcDuctSilencerType
            //IfcEdge	 NOT RV
            //IfcEdgeCurve  NOT RV
            //IfcEdgeLoop  NOT RV
            //IfcElectricAppliance
            //IfcElectricApplianceType
            //IfcElectricDistributionBoard
            //IfcElectricDistributionBoardType
            //IfcElectricFlowStorageDevice
            //IfcElectricFlowStorageDeviceType
            //IfcElectricGenerator
            //IfcElectricGeneratorType
            //IfcElectricMotor
            //IfcElectricMotorType
            //IfcElectricTimeControl
            //IfcElectricTimeControlType
            //IfcElementAssembly
            //IfcElementAssemblyType
            //IfcElementComponent
            //IfcElementComponentType
            //IfcElementQuantity
            //IfcEllipseProfileDef  NOT RV
            //IfcEnergyConversionDevice
            //IfcEnergyConversionDeviceType
            //IfcEngine
            //IfcEngineType
            //IfcEvaporativeCooler
            //IfcEvaporativeCoolerType
            //IfcEvaporator
            //IfcEvaporatorType
            //IfcExtendedProperties
            //IfcExternalInformation
            //IfcExternalReference
            //IfcExtrudedAreaSolidTapered  NOT RV
            //IfcFace  NOT RV
            //IfcFaceBasedSurfaceModel  NOT RV
            //IfcFaceBound  NOT RV
            //IfcFaceOuterBound  NOT RV
            //IfcFaceSurface  NOT RV
            //IfcFacetedBrep  NOT RV
            //IfcFan
            //IfcFanType
            //IfcFastener
            //IfcFastenerType
            //IfcFeatureElement
            //IfcFeatureElementAddition  NOT RV
            //IfcFeatureElementSubtraction
            //IfcFillAreaStyle
            //IfcFillAreaStyleHatching
            //IfcFilter
            //IfcFilterType
            //IfcFireSuppressionTerminal
            //IfcFireSuppressionTerminalType
            //IfcFixedReferenceSweptAreaSolid  NOT RV
            //IfcFlowController
            //IfcFlowControllerType
            //IfcFlowFitting
            //IfcFlowFittingType
            //IfcFlowInstrument
            //IfcFlowInstrumentType
            //IfcFlowMeter
            //IfcFlowMeterType
            //IfcFlowMovingDevice
            //IfcFlowMovingDeviceType
            //IfcFlowSegment
            //IfcFlowSegmentType
            //IfcFlowStorageDevice
            //IfcFlowStorageDeviceType
            //IfcFlowTerminal
            //IfcFlowTerminalType
            //IfcFlowTreatmentDevice
            //IfcFlowTreatmentDeviceType
            //IfcFooting
            //IfcFootingType
            //IfcFurnishingElement
            //IfcFurnishingElementType
            //IfcFurniture
            //IfcFurnitureType
            //IfcGeographicElement
            //IfcGeographicElementType
            //IfcGeometricCurveSet
            //IfcGeometricSet
            //IfcGrid
            //IfcGridAxis
            //IfcGridPlacement  NOT RV
            //IfcGroup
            //IfcHalfSpaceSolid  NOT RV
            //IfcHeatExchanger
            //IfcHeatExchangerType
            //IfcHumidifier
            //IfcHumidifierType
            //IfcIndexedColourMap
            //IfcIndexedTextureMap
            //IfcIndexedTriangleTextureMap
            //IfcInterceptor
            //IfcInterceptorType
            //IfcIShapeProfileDef
            //IfcJunctionBox
            //IfcJunctionBoxType
            //IfcLamp
            //IfcLampType
            //IfcLibraryInformation  NOT RV
            //IfcLibraryReference  NOT RV
            //IfcLightFixture
            //IfcLightFixtureType
            //IfcLine
            //IfcLoop   NOT RV
            //IfcLShapeProfileDef  NOT RV
            //IfcMapConversion
            //IfcMappedItem
            //IfcMaterialConstituent
            //IfcMaterialConstituentSet
            //IfcMaterialLayer
            //IfcMaterialLayerSet
            //IfcMaterialLayerSetUsage  NOT RV
            //IfcMaterialLayerWithOffsets  NOT RV
            //IfcMaterialProfileSetUsage  NOT RV
            //IfcMaterialProfileSetUsageTapering  NOT RV
            //IfcMaterialProfileWithOffsets  NOT RV
            //IfcMaterialUsageDefinition  NOT RV
            //IfcMeasureWithUnit
            //IfcMechanicalFastener
            //IfcMechanicalFastenerType
            //IfcMedicalDevice
            //IfcMedicalDeviceType
            //IfcMember
            //IfcMemberStandardCase  NOT RV
            //IfcMemberType
            //IfcMonetaryUnit
            //IfcMotorConnection
            //IfcMotorConnectionType
            //IfcNamedUnit
            //IfcOpeningElement
            //IfcOpeningStandardCase  NOT RV
            //IfcOpenShell  NOT RV
            //IfcOrientedEdge  NOT RV
            //IfcOutlet
            //IfcOutletType
            //IfcPcurve  NOT RV
            //IfcPhysicalComplexQuantity
            //IfcPhysicalQuantity
            //IfcPhysicalSimpleQuantity
            //IfcPile
            //IfcPileType
            //IfcPipeFitting
            //IfcPipeFittingType
            //IfcPipeSegment
            //IfcPipeSegmentType
            //IfcPlane  NOT RV
            //IfcPlate
            //IfcPlateStandardCase  NOT RV
            //IfcPlateType
            //IfcPoint
            //IfcPolygonalBoundedHalfSpace  NOT RV
            //IfcPolyline  NOT RV
            //IfcPolyLoop  NOT RV
            //IfcPort
            //IfcPostalAddress
            //IfcPreDefinedPropertySet
            //IfcPresentationItem
            //IfcPresentationLayerAssignment
            //IfcPresentationStyle
            //IfcPresentationStyleAssignment
            //IfcProductDefinitionShape
            //IfcProductRepresentation
            //IfcProfileDef
            //IfcProfileProperties
            //IfcProjectedCRS
            //IfcProjectionElement  NOT RV
            //IfcProperty
            //IfcPropertyAbstraction
            //IfcPropertyBoundedValue
            //IfcPropertyDefinition
            //IfcPropertyEnumeratedValue
            //IfcPropertyEnumeration
            //IfcPropertyListValue
            //IfcPropertySet
            //IfcPropertySetTemplate  NOT RV
            //IfcPropertyTableValue
            //IfcPropertyTemplate  NOT RV
            //IfcPropertyTemplateDefinition  NOT RV
            //IfcProtectiveDevice
            //IfcProtectiveDeviceTrippingUnit
            //IfcProtectiveDeviceTrippingUnitType
            //IfcProtectiveDeviceType
            //IfcPump
            //IfcPumpType
            //IfcQuantityArea
            //IfcQuantityCount
            //IfcQuantityLength
            //IfcQuantitySet
            //IfcQuantityTime
            //IfcQuantityVolume
            //IfcQuantityWeight
            //IfcRailing
            //IfcRailingType
            //IfcRamp
            //IfcRampFlight
            //IfcRampFlightType
            //IfcRampType
            //IfcRectangleHollowProfileDef  NOT RV
            //IfcRectangleProfileDef  NOT RV
            //IfcRectangularPyramid  NOT RV
            //IfcReinforcingBar
            //IfcReinforcingBarType
            //IfcReinforcingElement
            //IfcReinforcingElementType
            //IfcReinforcingMesh
            //IfcReinforcingMeshType
            //IfcRelAssignsToGroup
            //IfcRelAssociatesClassification
            //IfcRelAssociatesDocument
            //IfcRelAssociatesLibrary  NOT RV
            //IfcRelAssociatesMaterial
            //IfcRelConnectsElements  NOT RV
            //IfcRelConnectsPathElements  NOT RV
            //IfcRelConnectsPorts
            //IfcRelConnectsWithRealizingElements  NOT RV
            //IfcRelContainedInSpatialStructure
            //IfcRelCoversBldgElements
            //IfcRelDeclares
            //IfcRelDefinesByProperties
            //IfcRelFillsElement
            //IfcRelFlowControlElements  NOT RV
            //IfcRelInterferesElements  NOT RV
            //IfcRelNests
            //IfcRelProjectsElement  NOT RV
            //IfcRelServicesBuildings
            //IfcRelVoidsElement
            //IfcRepresentation
            //IfcRepresentationContext
            //IfcRepresentationItem
            //IfcRepresentationMap
            //IfcRevolvedAreaSolid
            //IfcRevolvedAreaSolidTapered  NOT RV
            //IfcRightCircularCone  NOT RV
            //IfcRightCircularCylinder  NOT RV
            //IfcRoof
            //IfcRoofType
            //IfcRoundedRectangleProfileDef  NOT RV
            //IfcSanitaryTerminal
            //IfcSanitaryTerminalType
            //IfcSensor
            //IfcSensorType
            //IfcShadingDevice
            //IfcShadingDeviceType
            //IfcShapeRepresentation
            //IfcShellBasedSurfaceModel  NOT RV
            //IfcSimplePropertyTemplate  NOT RV
            //IfcSlab
            //IfcSlabElementedCase  NOT RV
            //IfcSlabStandardCase  NOT RV
            //IfcSlabType
            //IfcSolarDevice
            //IfcSolarDeviceType
            //IfcSpaceHeater
            //IfcSpaceHeaterType
            //IfcSpatialZone
            //IfcSpatialZoneType
            //IfcSphere  NOT RV
            //IfcStackTerminal
            //IfcStackTerminalType
            //IfcStair
            //IfcStairFlight
            //IfcStairFlightType
            //IfcStairType
            //IfcStyleModel
            //IfcSurface  NOT RV
            //IfcSurfaceCurveSweptAreaSolid  NOT RV
            //IfcSurfaceOfLinearExtrusion  NOT RV
            //IfcSurfaceOfRevolution  NOT RV
            //IfcSurfaceStyleRendering
            //IfcSurfaceStyleWithTextures surfaceStyleWithTextures = new IfcSurfaceStyleWithTextures(new IfcImageTexture(db,true,true,""));
            //IfcSweptDiskSolid
            //IfcSwitchingDevice
            //IfcSwitchingDeviceType
            //IfcSystemFurnitureElement
            //IfcSystemFurnitureElementType
            //IfcTank
            //IfcTankType
            //IfcTelecomAddress  NOT RV
            //IfcTendon
            //IfcTendonAnchor
            //IfcTendonAnchorType
            //IfcTendonType
            //IfcTessellatedFaceSet
            //IfcTessellatedItem
            //IfcTextureCoordinate
            //IfcTextureVertexList
            //IfcTransformer
            //IfcTransformerType
            //IfcTransportElement
            //IfcTransportElementType
            //IfcTriangulatedFaceSet
            //IfcTrimmedCurve
            //IfcTShapeProfileDef  NOT RV
            //IfcTubeBundle
            //IfcTubeBundleType
            //IfcUnitaryControlElement
            //IfcUnitaryControlElementType
            //IfcUnitaryEquipment
            //IfcUnitaryEquipmentType
            //IfcUShapeProfileDef  NOT RV
            //IfcValve
            //IfcValveType
            //IfcVector
            //IfcVertex  NOT RV
            //IfcVertexPoint  NOT RV
            //IfcVibrationIsolator
            //IfcVibrationIsolatorType
            //IfcVirtualGridIntersection  NOT RV
            //IfcWall
            //IfcWallElementedCase  NOT RV
            //IfcWallStandardCase  NOT RV
            //IfcWallType
            //IfcWasteTerminal
            //IfcWasteTerminalType
            //IfcWindow
            //IfcWindowLiningProperties
            //IfcWindowPanelProperties
            //IfcWindowStandardCase  NOT RV
            //IfcWindowType
            //IfcZShapeProfileDef  NOT RV
            db.WriteFile(Path.Combine(path, mdv.ToString() + ".ifc"));
            return(db);
        }
Esempio n. 2
0
        /// <summary>
        /// Returns the IfcSpaceType of this space, null if one is not defined
        /// </summary>
        /// <param name="space"></param>
        /// <returns></returns>
        public static IfcSpaceType GetSpaceType(this IfcSpace space)
        {
            IfcTypeObject sType = space.GetDefiningType();

            return(sType as IfcSpaceType);
        }
Esempio n. 3
0
 public SpaceKeyType(IfcSpace ifcSpace, CoBieLiteHelper helper)
     : this()
 {
     FloorName = helper.SpaceFloorLookup[ifcSpace].Name;
     SpaceName = ifcSpace.Name;
 }
Esempio n. 4
0
 public IfcRelCoversSpaces(IfcGloballyUniqueId __GlobalId, IfcOwnerHistory __OwnerHistory, IfcLabel?__Name, IfcText?__Description, IfcSpace __RelatingSpace, IfcCovering[] __RelatedCoverings)
     : base(__GlobalId, __OwnerHistory, __Name, __Description)
 {
     this._RelatingSpace    = __RelatingSpace;
     this._RelatedCoverings = new HashSet <IfcCovering>(__RelatedCoverings);
 }
Esempio n. 5
0
        /// <summary>
        /// Get space gross floor area
        /// </summary>
        /// <param name="ifcSpace">IfcSpace object</param>
        /// <param name="allPropertyValues">COBieDataPropertySetValues object holds all the properties for all the IfcSpace</param>
        /// <returns>property value as string or default value</returns>
        private string GetGrossFloorArea(IfcSpace ifcSpace, COBieDataPropertySetValues allPropertyValues)
        {
            string areaUnit  = null;
            double areavalue = 0.0;

            if (!string.IsNullOrEmpty(Context.WorkBookUnits.AreaUnit))
            {
                areaUnit = Context.WorkBookUnits.AreaUnit;//see what the global area unit is
            }
            //Do Gross Areas
            IfcAreaMeasure grossAreaValue = ifcSpace.GetGrossFloorArea();

            if (grossAreaValue != null)
            {
                areavalue = ((double)grossAreaValue);
            }
            else//if we fail on IfcAreaMeasure try GSA keys
            {
                IfcQuantityArea spArea = ifcSpace.GetQuantity <IfcQuantityArea>("GSA Space Areas", "GSA BIM Area");
                if ((spArea is IfcQuantityArea) && (spArea.AreaValue != null))
                {
                    areavalue = ((double)spArea.AreaValue);
                }
            }
            if (areavalue > 0.0)
            {
                //if ((!string.IsNullOrEmpty(areaUnit)) && (areaUnit.ToLower().Contains("milli")) && (areavalue > 250000.0)) //we are using millimetres, and areavalue is lightly to be in mmsq if over 250000(0.5msq)
                //    areavalue = areavalue / 1000000.0;

                return(areavalue.ToString());
            }

            //Fall back to properties
            //get the property single values for this ifcSpace
            if (allPropertyValues.CurrentObject != ifcSpace)
            {
                allPropertyValues.SetAllPropertyValues(ifcSpace);
            }

            //try and find it in the attached properties of the ifcSpace
            string value = allPropertyValues.GetPropertySingleValueValue("GrossFloorArea", true);

            if (value == DEFAULT_STRING)
            {
                value = allPropertyValues.GetPropertySingleValueValue("GSA", true);
            }

            if (value == DEFAULT_STRING)
            {
                return(DEFAULT_NUMERIC);
            }
            else
            {
                if (double.TryParse(value, out areavalue))
                {
                    //if ((!string.IsNullOrEmpty(areaUnit)) && (areaUnit.ToLower().Contains("milli")) && (areavalue > 250000.0))//we are using millimetres, and areavalue is lightly to be in mmsq if over 250000(0.5msq)
                    //    areavalue = areavalue / 1000000.0;
                    return(areavalue.ToString());
                }
                return(value);
            }
        }
Esempio n. 6
0
        /// <summary>
        /// Add space placement
        /// </summary>
        /// <param name="row">COBieCoordinateRow holding the data for one corner</param>
        /// <param name="rowNext">COBieCoordinateRow holding the data for the other corner</param>
        private void AddBoundingBoxAsExtrudedAreaSolid(COBieCoordinateRow row, COBieCoordinateRow rowNext)
        {
            if (row.SheetName.ToLower() == "floor")
            {
                IfcBuildingStorey ifcBuildingStorey = null;
                if (ValidateString(row.ExtIdentifier))
                {
                    IfcGloballyUniqueId id = new IfcGloballyUniqueId(row.ExtIdentifier);
                    ifcBuildingStorey = Model.Instances.Where <IfcBuildingStorey>(bs => bs.GlobalId == id).FirstOrDefault();
                }

                if ((ifcBuildingStorey == null) && (ValidateString(row.RowName)))
                {
                    ifcBuildingStorey = Model.Instances.Where <IfcBuildingStorey>(bs => bs.Name == row.RowName).FirstOrDefault();
                }

                if (ifcBuildingStorey != null)
                {
                    //using statement will set the Model.OwnerHistoryAddObject to IfcRoot.OwnerHistory as OwnerHistoryAddObject is used upon any property changes,
                    //then swaps the original OwnerHistoryAddObject back in the dispose, so set any properties within the using statement
                    using (COBieXBimEditScope context = new COBieXBimEditScope(Model, ifcBuildingStorey.OwnerHistory))
                    {
                        IfcProduct placementRelToIfcProduct = ifcBuildingStorey.SpatialStructuralElementParent as IfcProduct;
                        AddExtrudedRectangle(row, rowNext, ifcBuildingStorey, placementRelToIfcProduct);
                    }
                }
            }
            if (row.SheetName.ToLower() == "space")
            {
                IfcSpace ifcSpace = null;
                if (ValidateString(row.ExtIdentifier))
                {
                    IfcGloballyUniqueId id = new IfcGloballyUniqueId(row.ExtIdentifier);
                    ifcSpace = Model.Instances.Where <IfcSpace>(bs => bs.GlobalId == id).FirstOrDefault();
                }
                if ((ifcSpace == null) && (ValidateString(row.RowName)))
                {
                    ifcSpace = Model.Instances.Where <IfcSpace>(bs => bs.Name == row.RowName).FirstOrDefault();
                }
                if ((ifcSpace == null) && (ValidateString(row.RowName)))
                {
                    IEnumerable <IfcSpace> ifcSpaces = Model.Instances.Where <IfcSpace>(bs => bs.Description == row.RowName);
                    //check we have one, if >1 then no match
                    if ((ifcSpaces.Any()) && (ifcSpaces.Count() == 1))
                    {
                        ifcSpace = ifcSpaces.FirstOrDefault();
                    }
                }

                if (ifcSpace != null)
                {
                    if (ifcSpace.Representation != null) //check it has no graphics attached, if it has then skip
                    {
                        return;
                    }
                    //using statement will set the Model.OwnerHistoryAddObject to IfcRoot.OwnerHistory as OwnerHistoryAddObject is used upon any property changes,
                    //then swaps the original OwnerHistoryAddObject back in the dispose, so set any properties within the using statement
                    using (COBieXBimEditScope context = new COBieXBimEditScope(Model, ifcSpace.OwnerHistory))
                    {
                        IfcProduct placementRelToIfcProduct = ifcSpace.SpatialStructuralElementParent as IfcProduct;

                        AddExtrudedRectangle(row, rowNext, ifcSpace, placementRelToIfcProduct);
                    }
                }
            }

            if (row.SheetName.ToLower() == "component")
            {
                IfcElement ifcElement = null;
                if (ValidateString(row.ExtIdentifier))
                {
                    IfcGloballyUniqueId id = new IfcGloballyUniqueId(row.ExtIdentifier);
                    ifcElement = Model.Instances.Where <IfcElement>(bs => bs.GlobalId == id).FirstOrDefault();
                }
                if ((ifcElement == null) && (ValidateString(row.RowName)))
                {
                    ifcElement = Model.Instances.Where <IfcElement>(bs => bs.Name == row.RowName).FirstOrDefault();
                }

                if ((ifcElement == null) && (ValidateString(row.RowName)))
                {
                    IEnumerable <IfcElement> ifcElements = Model.Instances.Where <IfcElement>(bs => bs.Description == row.RowName);
                    //check we have one, if >1 then no match
                    if ((ifcElements.Any()) && (ifcElements.Count() == 1))
                    {
                        ifcElement = ifcElements.FirstOrDefault();
                    }
                }

                if (ifcElement != null)
                {
                    if (ifcElement.Representation != null) //check it has no graphics attached, if it has then skip
                    {
                        return;
                    }

                    //using statement will set the Model.OwnerHistoryAddObject to IfcRoot.OwnerHistory as OwnerHistoryAddObject is used upon any property changes,
                    //then swaps the original OwnerHistoryAddObject back in the dispose, so set any properties within the using statement
                    using (COBieXBimEditScope context = new COBieXBimEditScope(Model, ifcElement.OwnerHistory))
                    {
                        IfcProduct placementRelToIfcProduct = ifcElement.ContainedInStructure as IfcProduct;
                        IfcRelContainedInSpatialStructure ifcRelContainedInSpatialStructure = Model.Instances.OfType <IfcRelContainedInSpatialStructure>().Where(rciss => rciss.RelatedElements.Contains(ifcElement)).FirstOrDefault();
                        if ((ifcRelContainedInSpatialStructure != null) &&
                            (ifcRelContainedInSpatialStructure.RelatingStructure != null)
                            )
                        {
                            placementRelToIfcProduct = ifcRelContainedInSpatialStructure.RelatingStructure as IfcProduct;
                            AddExtrudedRectangle(row, rowNext, ifcElement, placementRelToIfcProduct);
                        }
                        else
                        {
#if DEBUG
                            Console.WriteLine("COBieXBimCoordinate.AddBoundingBoxAsExtrudedAreaSolid: Cannot find Parent object placement");
#endif
                        }
                    }
                }
                else
                {
#if DEBUG
                    Console.WriteLine("COBieXBimCoordinate.AddBoundingBoxAsExtrudedAreaSolid: Cannot find object to relate points too");
#endif
                }
            }
        }