/////////////////////////////////////////////////////////////////////////////// // Copyright (C) 2002-2025, Open Design Alliance (the "Alliance"). // All rights reserved. // // This software and its documentation and related materials are owned by // the Alliance. The software may only be incorporated into application // programs owned by members of the Alliance, subject to a signed // Membership Agreement and Supplemental Software License Agreement with the // Alliance. The structure and organization of this software are the valuable // trade secrets of the Alliance and its suppliers. The software is also // protected by copyright law and international treaty provisions. Application // programs incorporating this software must include the following statement // with their copyright notices: // // This application incorporates Open Design Alliance software pursuant to a license // agreement with Open Design Alliance. // Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance. // All rights reserved. // // By use of this software, its documentation or related materials, you // acknowledge and accept the above terms. /////////////////////////////////////////////////////////////////////////////// #ifndef _IFC_MODEL_FILLER_H #define _IFC_MODEL_FILLER_H #include "OdPlatformSettings.h" #include "Ge/GePlane.h" #include "IfcModel.h" #include "IfcEntity.h" #include "IfcSimpleTypes.h" #include "IfcPropertySetFiller.h" #include "IfcQuantitySetFiller.h" #include "TD_PackPush.h" /** \details Base class that provides basic set of model entities creation operations. */ class IFCCORE_EXPORT OdIfcModelFiller { public: /** \details Defines values for conversion factors between metric and imperial system units. */ enum UnitsConversion { /** Conversion from inches to meters. */ IfcLengthUnit_Inch_To_Meters = 0, /** Conversion from feet to meters. */ IfcLengthUnit_Foot_To_Meters = 1, /** Conversion from inches to square meters. */ IfcAreaUnit_SquareInch_To_SquareMeters = 7, /** Conversion from square feet to square meters. */ IfcAreaUnit_SquareFoot_To_SquareMeters = 8, /** Conversion from cubic inches to cubic meters. */ IfcVolumeUnit_CubicInch_To_CubicMeters = 15, /** Conversion from feet to cubic meters. */ IfcVolumeUnit_CubicFoot_To_CubicMeters = 16, /** Conversion from angle to radians. */ IfcPlaneAngleUnit_Angle_To_Radians = 23 }; protected: struct EntityDefinitions { const OdDAI::Entity* IfcAlignment; const OdDAI::Entity* IfcAxis2Placement2D; const OdDAI::Entity* IfcAxis2Placement3D; const OdDAI::Entity* IfcBridge; const OdDAI::Entity* IfcBuilding; const OdDAI::Entity* IfcCartesianPoint; const OdDAI::Entity* IfcDirection; const OdDAI::Entity* IfcOwnerHistory; const OdDAI::Entity* IfcProduct; const OdDAI::Entity* IfcProject; const OdDAI::Entity* IfcRailway; const OdDAI::Entity* IfcRoot; const OdDAI::Entity* IfcSite; const OdDAI::Entity* IfcSiUnit; const OdDAI::Entity* IfcUnitAssignment; const OdDAI::Entity* IfcConversionBasedUnit; const OdDAI::Entity* IfcMeasureWithUnit; }; EntityDefinitions Entity; void initEntities(); protected: OdIfcModelPtr m_model; OdIfcModelFiller(OdDAI::Model *model) : m_model(model) { initEntities(); m_objectDefinition = OdIfc::OdIfcInstancePtr(); m_propertySet = OdIfc::OdIfcInstancePtr(); } OdIfc::OdIfcInstancePtr m_person; OdIfc::OdIfcInstancePtr m_ownerHistory; OdIfc::OdIfcInstancePtr m_unitAssignment; OdIfc::OdIfcInstancePtr m_project; OdIfc::OdIfcInstancePtr m_site; // // Common entities, must not be changed as their purposes are predefined: // OdDAIObjectId m_dirX; OdDAIObjectId m_dirY; OdDAIObjectId m_dirZ; OdDAIObjectId m_posOrigin; OdDAIObjectId m_identity; OdDAIObjectId m_dirX2D; OdDAIObjectId m_dirY2D; OdDAIObjectId m_posOrigin2D; OdDAIObjectId m_identity2D; OdDAIObjectIds unitsCollection; std::map m_relAggregates; std::map m_relContainedInSpatialStructure; std::map m_relReferencedInSpatialStructure; std::map m_geometricRepresentationContext; std::map > m_geometricRepresentationSubContext; std::map m_relDefinesByProperties; std::map m_surfaceStyles; OdIfc::OdIfcInstancePtr m_objectDefinition; OdIfc::OdIfcInstancePtr m_propertySet; OdDAIObjectIds m_idProperties; std::map m_conversionFactors; /** \details Appends shared (commonly used) geometrical entities as directions align axis etc. */ void appendSharedInstances(); public: /** \details Virtual destructor. */ virtual ~OdIfcModelFiller() {}; /** \details Retrieves working IFC model. \returns Returns smart pointer to IFC model. */ OdIfcModelPtr model() { return m_model; }; /** details Fills an empty model by predefined set of entities. \param organizationName [in] Organization name. \param applicationDeveloperName [in] Name of the application developer. \param applicationDeveloperDescription [in] Detailed description about application developer. \param applicationFullName [in] The full name of the application as specified by the application developer. \param applicationVersion [in] The version number of this software as specified by the developer of the application. \param applicationIdentifier [in] Short identifying name for the application. \returns Returns a smart pointer to instantiated IfcProject. */ OdIfc::OdIfcInstancePtr createFromScratch( const OdString &organizationName, const OdString &applicationDeveloperName, const OdString &applicationDeveloperDescription, const OdString &applicationFullName, const OdString &applicationVersion, const OdString &applicationIdentifier ); // // Common instances accessors // /** details Retrieves direction of a local x-axis. \returns Direction of a local x-axis. */ const OdDAIObjectId& dirX() const { return m_dirX; }; /** details Retrieves direction of a local y-axis. \returns Direction of a local y-axis. */ const OdDAIObjectId& dirY() const { return m_dirY; }; /** details Retrieves direction of a local z-axis. \returns Direction of a local z-axis. */ const OdDAIObjectId& dirZ() const { return m_dirZ; }; /** details Retrieves origin point of 3D placement. \returns Origin as a Cartesian point. */ const OdDAIObjectId& origin() const { return m_posOrigin; }; const OdDAIObjectId& identity() const { return m_identity; }; /** details Retrieves direction of a local x-axis used in 2D placement. \returns Direction of a local x-axis used in 2D placement. */ const OdDAIObjectId& dirX2D() const { return m_dirX2D; }; /** details Retrieves direction of a local y-axis used in 2D placement. \returns Direction of a local y-axis used in 2D placement. */ const OdDAIObjectId& dirY2D() const { return m_dirY2D; }; /** details Retrieves origin point of 2D placement. \returns Origin as a Cartesian point. */ const OdDAIObjectId& origin2D() const { return m_posOrigin2D; }; const OdDAIObjectId& identity2D() const { return m_identity2D; }; /** details Retrieves person associated with this instance. \returns Smart pointer to a person instance. */ OdIfc::OdIfcInstancePtr person() { return m_person; }; /** details Retrieves owner history associated with this instance. \returns Smart pointer to owner history instance. */ OdIfc::OdIfcInstancePtr ownerHistory() { return m_ownerHistory; }; /** details Retrieves unit assignment associated with this instance. \returns Smart pointer to unit assignment instance. */ OdIfc::OdIfcInstancePtr unitAssignment() { return m_unitAssignment; }; /** details Retrieves project associated with this instance. \returns Smart pointer to project instance. */ OdIfc::OdIfcInstancePtr project() { return m_project; }; /** details Retrieves site associated with this instance. \returns Smart pointer to site instance. */ OdIfc::OdIfcInstancePtr site() { return m_site; }; /** details Retrieves object definition associated with this instance. \returns Smart pointer to object definition instance. */ OdIfc::OdIfcInstancePtr getObjectDefinition() { return m_objectDefinition; }; /** details Retrieves property set associated with this instance. \returns Smart pointer to a property set. */ OdIfc::OdIfcInstancePtr getPropertySet() { return m_propertySet; }; /** \details Sets attributes collection for current entity in the model. \param inst [in] Smart pointer to OdIfc::OdIfcInstance. \param attrs [in] std::map collection of custom entity attributes with values. \returns true in case of success. */ bool putAttrs(OdIfc::OdIfcInstancePtr &inst, std::map& attrs); /** \details Sets IfcOwnerHistory attribute value for the entity in the model. \param history [in] OdSmartPtr to existing instance. */ void setOwnerHistory(OdIfc::OdIfcInstancePtr history) { if (!history.isNull()) m_ownerHistory = history; }; /** \details Sets IfcProject value for the entities in the model. \param project [in] OdSmartPtr to existing instance. */ void setProject(OdIfc::OdIfcInstancePtr project) { if (!project.isNull()) m_project = project; }; /** \details Adds object id to the appropriate attribute of OdIfc::OdIfcInstance within a model. \param pInst [in] pointer to OdIfcInstance. \param attr [in] OdIfcAttribute of entity. \param id [in] OdDAIObjectId value of appropriate attribute. \returns true in case of success, false otherwise. */ bool appendId(OdIfc::OdIfcInstance* pInst, OdIfc::OdIfcAttribute attr, OdDAIObjectId id); /** \details Appends selected geometric context via params to the active model contexts. \param name [in] OdAnsiString name of context identifier ("2D"/"3D" etc). \param type [in] OdAnsiString of context type ("Plan"/"Model" etc). \param dim [in] dimension of coordinate space. \param precision [in] Precision value. \param idWCS [in] OdDAIObjectId db handle of world coordinate system for current context. \param idTrueNorth [in] OdDAIObjectId db handle of north direction. \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr appendGeometricRepresentationContext(const OdAnsiString &name, const OdAnsiString &type, int dim, double precision = OdDAI::Consts::OdNan, OdDAIObjectId idWCS = OdDAIObjectId(), OdDAIObjectId idTrueNorth = OdDAIObjectId()); /** \details Appends selected geometric subcontext to the parent one. \param contextIdentifier [in] OdAnsiString name of context identifier ("Axis"/"Body" etc). \param contextType [in] OdAnsiString of context type ("Plan"/"Model" etc). \param pParent [in] OdSmartPtr to existing parent context. \param targetView [in] OdAnsiString of target view name ("GRAPH_VIEW"/"MODEL_VIEW" etc). \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr appendGeometricRepresentationSubContext(const OdAnsiString &contextIdentifier, const OdAnsiString &contextType, OdIfc::OdIfcInstancePtr pParent, OdAnsiString targetView); /** \details Returns active model geometric context by its type name. \param type [in] OdAnsiString name of context identifier ("Axis"/"Body" etc). \returns A pointer to the existing context or empty OdIfcInstancePtr() otherwise. */ OdIfc::OdIfcInstancePtr getGeometricRepresentationContext(const OdAnsiString &type); /** \details Returns active model geometric subcontext by its type name and context identifier. \param contextIdentifier [in] OdAnsiString name of context identifier ("Axis"/"Body" etc). \param contextType [in] OdAnsiString of context type ("Plan"/"Model" etc). \returns A pointer to the existing subcontext or empty OdIfcInstancePtr() otherwise. */ OdIfc::OdIfcInstancePtr getGeometricRepresentationSubContext(const OdAnsiString &contextIdentifier, const OdAnsiString &contextType); /** \details Creates an instance of IfcShapeRepresentation within a model based on context and geometrical representation items. \param contextOfItems [in] OdDAIObjectId db handle of existing geometric representation context. \param representationIdentifier [in] OdAnsiString name of representation identifier ("Axis"/"Body" etc). \param representationType [in] OdAnsiString name of representation type ("Brep"/"SweptSolid" etc). \param items [in] OdDAIObjectIds set of entities that describe entity geometry. \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr createShapeRepresentation(const OdDAIObjectId & contextOfItems, const OdAnsiString & representationIdentifier, const OdAnsiString & representationType, const OdDAIObjectIds & items); /** \details Creates an instance of IfcProductDefinitionShape within a model based on geometrical representation items. \param representations [in] OdDAIObjectIds set of entities that describe shape representation. \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr createProductDefinitionShape(const OdDAIObjectIds & representations); /** \details Creates an instance of IfcrRepresentationMap within a model based on mapping origin and representation itself. \param MappingOrigin [in] OdDAIObjectId db handle of mapping origin location. \param MappedRepresentation [in] OdDAIObjectId db handle of representation. \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr createRepresentationMap(const OdDAIObjectId & MappingOrigin, const OdDAIObjectId & MappedRepresentation); /** \details Creates an instance of IfcMappedItem based on mapping source and target respectively. \param MappingSource [in] OdDAIObjectId db handle of representation to be mapped. \param MappingTarget [in] OdDAIObjectId db handle of transformation operator. \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr createMappedItem(const OdDAIObjectId & MappingSource, const OdDAIObjectId & MappingTarget); /** \details Creates an instance of IfcCompositeCurve element based on existing segments set. \param segments [in] OdDAIObjectIds set of existing curve segments. \param selfIntersect [in] determine if curve has intersected segments. \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr createCompositeCurve(const OdDAIObjectIds & segments, bool selfIntersect); /** \details Creates an instance of IfcCompositeCurveSegment element based on appropriate attributes. \param transition [in] OdAnsiString of IfcTransitionCode value. \param sameSense [in] Indicator of whether or not the sense of the segment agrees with. \param parentCurve [in] OdDAIObjectId db handle of parent curve entity. \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr createCompositeCurveSegment(const OdAnsiString & transition, bool sameSense, const OdDAIObjectId & parentCurve); /** \details Creates an instance of IfcCurveStyle element based on colour. \param curveColourId [in] OdDAIObjectId db handle of curve colour. \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr createCurveStyle(const OdDAIObjectId & curveColourId); /** \details Creates an instance of IfcTrimmedCurve entity. \param basisCurve [in] OdDAIObjectId db handle of existing curve entity. \param param1 [in] The first trimming point which may be specified as a Cartesian point. \param param2 [in] The second trimming point which may be specified as a Cartesian point. \param bSenseAgreement [in] Indicates whether the direction of the trimmed curve agrees with or is opposed to the direction of the basis curve. \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr createTrimmedCurve(const OdDAIObjectId& basisCurve, double param1, double param2, bool bSenseAgreement); /** \details Creates an instance of IfcTrimmedCurve entity. \param basisCurve [in] OdDAIObjectId db handle of existing curve entity. \param trim1 [in] OdDAIObjectId db handle of the first trimming point. \param trim2 [in] OdDAIObjectId db handle of the second trimming point. \param bSenseAgreement [in] Indicates whether the direction of the trimmed curve agrees with or is opposed to the direction of the basis curve. \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr createTrimmedCurve(const OdDAIObjectId & basisCurve, const OdDAIObjectId & trim1, const OdDAIObjectId & trim2, bool bSenseAgreement); /** \details Creates an instance of IfcPolyline element based on points set. \param points [in] OdDAIObjectIds set of existing points. \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr createPolyline(const OdDAIObjectIds & points); /** \details Creates an instance of IfcCircle element based on appropriate attributes. \param center [in] OdGePoint2d that determines location of center point. \param refDirection [in] OdGeVector2d that determines direction of circle plane. \param radius [in] Circle radius value. \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr createCircle(const OdGePoint2d & center, const OdGeVector2d & refDirection, double radius); /** \details Creates an instance of IfcPlane element based on position. \param position [in] OdDAIObjectId db handle of plane position. \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr createPlane(const OdDAIObjectId & position); /** \details Creates an instance of IfcPlane element based on existing OdGePlane item. \param plane [in] OdGePlane plane representation in space. \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr createPlane(const OdGePlane & plane); /** \details Creates an instance of IfcWallStandardCase building element based on placement and representation. \param name [in] OdString that describes entity name. \param objectPlacement [in] OdDAIObjectId db handle of existing entity placement. \param representation [in] OdDAIObjectId db handle of existing entity shape representation. \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr createWallStandardCase(const OdString & name, const OdDAIObjectId & objectPlacement, const OdDAIObjectId & representation); /** \details Creates an instance of IfcWall building element based on placement and representation. \param name [in] OdString that describes entity name. \param objectPlacement [in] OdDAIObjectId db handle of existing entity placement. \param representation [in] OdDAIObjectId db handle of existing entity shape representation. \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr createWall(const OdString & name, const OdDAIObjectId & objectPlacement, const OdDAIObjectId & representation); /** \details Creates an instance of IfcSlab building element based on placement, representation and type. \param name [in] OdString that describes entity name. \param objectPlacement [in] OdDAIObjectId db handle of existing entity placement. \param representation [in] OdDAIObjectId db handle of existing entity shape representation. \param predefinedType [in] OdAnsiString name of predefined type ("Floor"/"Roof" etc). \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr createSlab(const OdString & name, const OdDAIObjectId & objectPlacement, const OdDAIObjectId & representation, const OdAnsiString & predefinedType); /** \details Creates an instance of IfcOpeningElement based on placement, representation and type. \param name [in] OdString that describes entity name. \param objectPlacement [in] OdDAIObjectId db handle of existing entity placement. \param representation [in] OdDAIObjectId db handle of existing entity shape representation. \param predefinedType [in] OdAnsiString name of predefined type ("Opening"/"Recess" or empty). \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr createOpening(const OdString& name, const OdDAIObjectId & objectPlacement, const OdDAIObjectId & representation, const OdAnsiString & predefinedType = OdAnsiString()); /** \details Creates an instance of IfcRelVoidsElement element based on relating building element and related opening element. \param relatingBuildingElement [in] OdDAIObjectId db handle of existing building item. \param relatedOpeningElement [in] OdDAIObjectId db handle of existing opening element that is contained in the building element. \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr addRelVoidsElement(const OdDAIObjectId & relatingBuildingElement, const OdDAIObjectId & relatedOpeningElement); /** \details Creates an instance of IfcRelFillsElement element based on relating opening element and related building element. \param relatingOpeningElement [in] OdDAIObjectId db handle of existing opening item. \param relatedBuildingElement [in] OdDAIObjectId db handle of existing building element that contains opening item. \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr createRelFillsElement(const OdDAIObjectId & relatingOpeningElement, const OdDAIObjectId & relatedBuildingElement); /** \details Creates an instance of IfcClassificationReference. \param materialDefName [in] OdString that contains material name. \param location [in] OdString that contains location, where the external source (classification, document or library) can be accessed by electronic means. \param itemReference [in] OdAnsiString that contains item reference name. \param referencedSource [in] OdDAIObjectId db handle of existing classification. \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr createClassificationReference(const OdString & materialDefName, const OdString & location, const OdAnsiString & itemReference, const OdDAIObjectId & referencedSource); /** \details Creates an instance of IfcClassification. \param source [in] OdAnsiString that contains source (or publisher) for this classification. \param edition [in] OdAnsiString that determines classification edition name. \param name [in] OdString that determines classification name. \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr createClassification(const OdAnsiString & source, const OdAnsiString & edition, const OdString & name); /** \details Creates an instance of IfcSiUnit within a model. \param unitType [in] name of type for allowed SI unit types (LENGTHUNIT). \param prefix [in] name of a SI prefix that may be associated with an SI unit (DECI). \param name [in] OdString that determines classification name (SQUARE_METRE). \param append [in] the name of the SI unit. \returns A pointer to the created / appended to the model entity. */ OdIfc::OdIfcInstancePtr createSiUnit(const char *unitType, const char *prefix, const char *name, bool append = false); /** \details Creates an instance of IfcUnitAssignment within a model based on existing units collection. \param unitsCollection [in] OdDAIObjectIds set of existing units. \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr createUnitAssignment(const OdArray& unitsCollection); /** \details Creates an instance of IfcConversionBasedUnit within a model based on existing IfcMeasureWithUnit . \param name [in] OdAnsiString that contains conversion based unit name. \param conversionFactor [in] OdDAIObjectId db handle of existing IfcMeasureWithUnit entity. \param dimensions [in] OdDAIObjectId db handle existing IfcDimensionalExponents. \param unitType [in] OdAnsiString that determines SI unit type name (PLANEANGLEUNIT). \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr createConversionBasedUnit(const OdAnsiString & name, const OdDAIObjectId & conversionFactor, const OdDAIObjectId & dimensions, const OdAnsiString & unitType); /** \details Creates an instance of IfcMeasureWithUnit within a model based on conversion value. \param measureValue [in] Conversion value. \param dimensions [in] OdDAIObjectId db handle existing IfcSiUnit. \param typeName [in] OdAnsiString that determines IFC unit type name (IfcVolumeMeasure). \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr createMeasureWithUnit(double measureValue, const OdDAIObjectId& unit, const OdAnsiString& typeName); /** \details Sets units assignment attribute for project entity in the model. \param unitsAssignment [in] Pointer to OdIfcInstance that represents existing IfcUnitAssignment. */ void setUnitAssignment(OdIfc::OdIfcInstancePtr unitsAssignment = OdIfc::OdIfcInstancePtr()); /** \details Appends new aggregate relationship for selected entities within a model. \param pRelating [in] Pointer to OdIfcInstance that represents existing related element that represents the aggregation. \param pRelated [in] Pointer to OdIfcInstance that represents existing building items that is being aggregated. \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr addRelAggregates(OdIfc::OdIfcInstancePtr pRelating, OdIfc::OdIfcInstancePtr pRelated); /** \details Appends new related item to existing aggregate relationship within a model. \param pRelating [in] Pointer to OdIfcInstance that represents existing related element that represents the aggregation. \param pRelated [in] Pointer to OdIfcInstance that represents existing building items that is being aggregated. \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr appendRelAggregates(OdIfc::OdIfcInstancePtr pRelating, OdIfc::OdIfcInstancePtr pRelated); /** \details Returns existing aggregate relationship for relating item within a model. \param pRelating [in] Pointer to OdIfcInstance that represents existing element that describes the aggregation. \returns A pointer to the existed IfcRelAggregates or empty OdIfcInstancePtr() otherwise. */ OdIfc::OdIfcInstancePtr getRelAggregates(OdIfc::OdIfcInstancePtr pRelating); /** \details Appends new IfcRelContainedInSpatialstructure relationship for selected entities within a model. \param pRelating [in] Pointer to OdIfcInstance that represents existing related element that represents the IfcSpatialStructureElement. \param pRelated [in] Pointer to OdIfcInstance that represents existing IfcProduct. \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr addRelContainedInSpatialStructure(OdIfc::OdIfcInstancePtr pRelating, OdIfc::OdIfcInstancePtr pRelated); /** \details Appends new IfcRelReferencedInSpatialStructure relationship for selected entities within a model. \param pRelating [in] Pointer to OdIfcInstance that represents existing related element that represents the IfcSpatialStructureElement. \param pRelated [in] Pointer to OdIfcInstance that represents existing IfcProduct. \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr addRelReferencedInSpatialStructure(OdIfc::OdIfcInstancePtr pRelating, OdIfc::OdIfcInstancePtr pRelated); /** \details Appends new IfcRelContainedInSpatialstructure relationship for selected set of related elements within a model. \param relatedElements [in] OdDAIObjectIds set of existing IfcProduct. \param relStructure [in] OdDAIObjectId db handle that represents existing related element that represents the IfcSpatialStructureElement. \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr createRelContainedInSpatialStructure(const OdDAIObjectIds & relatedElements, const OdDAIObjectId & relStructure); /** \details Appends new IfcRelReferencedInSpatialStructure relationship for selected set of related elements within a model. \param relatedElements [in] OdDAIObjectIds set of existing IfcProduct. \param relStructure [in] OdDAIObjectId db handle that represents existing related element that represents the IfcSpatialStructureElement. \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr createRelReferencedInSpatialStructure(const OdDAIObjectIds & relatedElements, const OdDAIObjectId & relStructure); /** \details Appends new IfcRelAggregates relationship for selected set of related objects within a model. \param name [in] OdString that contains relation name. \param relatingObject [in] OdDAIObjectId db handle element that represents the aggregation. \param relatedObjects [in] OdDAIObjectIds set of existing IfcProduct that are being aggregated. \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr createRelAggregates(const OdString & name, const OdDAIObjectId & relatingObject, const OdDAIObjectIds & relatedObjects); /** \details Creates an instance of IfcColourRgb with not normalized rgb values. \param red [in] OdUInt8 that represents red colour component (0..255). \param green [in] OdUInt8 that represents green colour component (0..255). \param blue [in] OdUInt8 that represents blue colour component (0..255). \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr createColourRgb(const OdUInt8 & red, const OdUInt8 & green, const OdUInt8 & blue); /** \details Creates an instance of IfcColourRgb with normalized rgb values. \param r [in] Double that represents red colour component (0..1). \param g [in] Double that represents green colour component (0..1). \param b [in] Double that represents blue colour component (0..1). \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr createColourRgb(const double & r, const double & g, const double & b); /** \details Creates an instance of local placement with appropriate params within a model. \param placementRelTo [in] Pointer to OdIfcInstance that represents IfcObjectPlacement that provides the relative placement by its local coordinate system. \param relativePlacement [in] Pointer to OdIfcInstance that represents existing IfcAxis2Placement entity. \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr createLocalPlacement(OdIfc::OdIfcInstancePtr placementRelTo, OdIfc::OdIfcInstancePtr relativePlacement); /** \details Creates an instance of local placement with appropriate params within a model. \param placementRelTo [in] OdDAIObjectId db handle that represents IfcObjectPlacement that provides the relative placement by its local coordinate system. \param relativePlacement [in] OdDAIObjectId db handle that represents existing IfcAxis2Placement entity. \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr createLocalPlacement3d(const OdDAIObjectId & placementRelTo, const OdDAIObjectId & relativePlacement); /** \details Creates an instance of local placement with appropriate params within a model. \param placementRelTo [in] OdDAIObjectId db handle that represents IfcObjectPlacement that provides the relative placement by its local coordinate system. \param ptLocation [in] OdGePoint3d point of relative placement. \param axis [in] OdGeVector3d axis of the local Z Axis. \param refDirection [in] OdGeVector3d the direction of the local X Axis. \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr createLocalPlacement3d(const OdDAIObjectId & placementRelTo, const OdGePoint3d & ptLocation, const OdGeVector3d & axis, const OdGeVector3d & refDirection); /** \details Creates an instance of 3D IfcCartesianPoint within a model. \param p [in] OdGePoint3d as position of IfcCartesianPoint. \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr createCartesianPoint(const OdGePoint3d &p); /** \details Creates an instance of 2D IfcCartesianPoint within a model. \param p [in] OdGePoint2d as position of IfcCartesianPoint. \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr createCartesianPoint(const OdGePoint2d &p); /** \details Creates an instance of 3D IfcPointByDistanceExpression within a model. \param distanceAlong [in] OdGePoint3d as distance on basisCurve. \param basisCurve [in] OdDAIObjectId db handle of existing curve entity. \param offsetLateral [in] Default offset horizontally is measured perpendicular to the basis curve, where positive values indicate to the left of the basis curve as facing in the positive parametrization direction of the basis curve, and negative values indicate to the right. \param offsetVertical [in] Default offset vertical to the basis curve where positive values indicate perpendicular to the tangent at DistanceAlong in the plane of the tangent perpendicular to the global XY plane. \param offsetLongitudinal [in] Offset parallel to the basis curve after applying DistanceAlong, OffsetLateral, and OffsetVertical to reach locations for the case of a tangentially discontinuous basis curve. \param distanceAlongType [in] Type of distanceAlong select object. Should be equal ifclengthmeasure or ifcparametervalue. \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr createPointByDistanceExpression(double distanceAlong, const OdDAIObjectId& basisCurve, double offsetLateral = 0., double offsetVertical = 0., double offsetLongitudinal = 0., const OdAnsiString& distanceAlongType = "ifclengthmeasure"); /** \details Creates an instance of 3D IfcDirection within a model. \param v [in] OdGeVector3d as vector of IfcDirection. \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr createDirection(const OdGeVector3d &v); /** \details Creates an instance of 2D IfcDirection within a model. \param v [in] OdGeVector2d as vector of IfcDirection. \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr createDirection(const OdGeVector2d &v); /** \details Creates an instance of 3D IfcAxis2Placement within a model. \param m [in] OdGeMatrix3d as initial matriх of IfcAxis2Placement3D. \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr createAxis2Placement3D(const OdGeMatrix3d &m); /** \details Creates an instance of 3D IfcAxis2Placement within a model. \param location [in] OdDAIObjectId db handle as initial position of IfcAxis2Placement3D. \param axis [in] OdDAIObjectId db handle as exact direction of the local Z Axis. \param refDirection [in] OdDAIObjectId db handle as direction used to determine the direction of the local X Axis. \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr createAxis2Placement3D(const OdDAIObjectId & location, const OdDAIObjectId & axis, const OdDAIObjectId & refDirection); /** \details Creates an instance of 3D IfcAxis2Placement within a model. \param ptLocation [in] OdGePoint3d as initial position of IfcAxis2Placement3D. \param axis [in] OdGeVector3d as exact direction of the local Z Axis. \param refDirection [in] OdGeVector3d as direction used to determine the direction of the local X Axis. \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr createAxis2Placement3D(const OdGePoint3d & ptLocation, const OdGeVector3d * axis, const OdGeVector3d * refDirection); /** \details Creates an instance of 2D IfcAxis2Placement within a model. \param m [in] OdGeMatrix2d as initial matriх of IfcAxis2Placement3D. \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr createAxis2Placement2D(const OdGeMatrix2d &m); /** \details Creates an instance of 2D IfcAxis2Placement within a model. \param location [in] OdDAIObjectId db handle as initial position of IfcAxis2Placement3D. \param refDirection [in] OdDAIObjectId db handle as direction used to determine the direction of the local X Axis. \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr createAxis2Placement2D(const OdDAIObjectId & location, const OdDAIObjectId & refDirection); /** \details Creates an instance of IfcSite element within a model. \param name [in] OdAnsiString as site name. \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr createSite(const OdAnsiString& name = "Default site"); /** \details Returns conversion value between imperial and metric units. \param unit [in] UnitsConversion value. \returns Conversion factor for current unit. */ double getConversionFactor(UnitsConversion unit) { return ((m_conversionFactors.find(unit) != m_conversionFactors.end()) ? m_conversionFactors.find(unit)->second : 1.); } /** \details Creates an instance of IfcPropertySetFiller by its relating product. \param objectDefinition [in] OdIfcInstance pointer to the IfcObjectDefinition item, which properties should be created with IfcRelDefinesByProperties. \returns A pointer to the created IfcPropertySetFiller, that should be used with IfcPropertySetFiller::createRelDefinesPropertySet, if success or empty IfcPropertySetFillerPtr() otherwise. */ IfcPropertySetFillerPtr initPropertySet(OdIfc::OdIfcInstancePtr objectDefinition); /** \details Creates an instance of IfcPropertySetFiller that doesn't belong to the IfcObjectDefinition, i.e. without creation appropriate IfcRelDefinesByProperties. \returns A pointer to the created IfcPropertySetFiller, that should be used with IfcPropertySetFiller::createPropertySet. */ IfcPropertySetFillerPtr initDetachedPropertySet(); /** \details Creates an instance of IfcPropertySet element based on property items set. \param name [in] OdString as property set name. \param props [in] OdDAIObjectIds set of IfcProperty. \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr createIfcPropertySet(const OdString & name, const OdDAIObjectIds & props); /** \details Creates an instance of IfcQuantitySetFiller by its relating owner. \param objectDefinition [in] OdIfcInstance pointer to the IfcObjectDefinition item, which properties should be created with IfcRelDefinesByProperties. \returns A pointer to the created IfcQuantitySetFiller, that should be used with IfcQuantitySetFiller::createRelDefinesQuantitySet, if success or empty IfcPropertySetFillerPtr() otherwise. */ IfcQuantitySetFillerPtr createQuantitySet(OdIfc::OdIfcInstancePtr objectDefinition); /** \details Creates an instance of IfcRelDefinesByProperties element based on related objects set and property set item. \param relatedObjects [in] OdDAIObjectIds set of IfcObjects. \param relatingPropDef [in] OdDAIObjectId db handle of IfcPropertySetDefinition. \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr createRelDefinesByProperties(const OdDAIObjectIds & relatedObjects, OdDAIObjectId & relatingPropDef); /** \details Appends a new related object to the existing IfcRelDefinesByProperties element or create new one if the last one doesn't exist. \param pRelatingPropertyDefinition [in] OdIfcInstance pointer to the new appended property instance. \param relatedObjectDefinition [in] OdIfcInstance pointer to the IfcObjectDefinition. \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr appendRelDefinesByProperties(OdIfc::OdIfcInstancePtr pRelatingPropertyDefinition, OdIfc::OdIfcInstancePtr relatedObjectDefinition); /** \details Returns existing IfcRelDefinesByProperties relationship for relating property definition within a model. \param pRelatingPropertyDefinition [in] pointer to OdIfcInstance that represents existing element that describes the property item. \returns A pointer to the existed IfcRelDefinesByProperties or empty OdIfcInstancePtr() otherwise. */ OdIfc::OdIfcInstancePtr getRelDefinesByProperties(OdIfc::OdIfcInstancePtr pRelatingPropertyDefinition); /** \details Creates an instance of IfcRelDefinesByType element based on related objects set and Ifc entity type item. \param relatedObjects [in] OdDAIObjectIds set of IfcObjects. \param relTypeId [in] OdDAIObjectId db handle of IfcTypeObject. \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr createRelDefinesByType(const OdDAIObjectIds & relatedObjects, const OdDAIObjectId & relTypeId); /** \details Creates an instance of IfcSurfaceStyle and appropriate IfcSurfaceStyleRendering. \param name [in] OdAnsiString style name. \param color [in] OdCmEntityColor color parameter. \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr createSurfaceStyle(const OdAnsiString &name, const OdCmEntityColor &color); /** \details Finds an instance of IfcSurfaceStyle by its name. \param name [in] OdAnsiString style name. \returns A pointer to the existed IfcSurfaceStyle or empty OdIfcInstancePtr() otherwise. */ OdIfc::OdIfcInstancePtr findSurfaceStyle(const OdAnsiString &name); /** \details Creates an instance of IfcStyledItem. \param item [in] OdIfcInstance pointer to the representation item to which the style is assigned.. \param style [in] OdIfcInstance pointer to the representation style which is assigned,. \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr createStyledItem(OdIfc::OdIfcInstancePtr item, OdIfc::OdIfcInstancePtr style); /** \details Creates an instance of IfcVector. \param pDirection [in] OdIfcInstance pointer to the direction of the vector. \param magnitude [in] Magnitude value of the vector. \returns A pointer to the created and appended to the model entity. */ OdIfc::OdIfcInstancePtr createVector(OdIfc::OdIfcInstancePtr pDirection, double magnitude); friend class OdIfcFile; }; /** \details A data type that represents a smart pointer to an OdIfcModelFiller object. */ typedef OdSharedPtr OdIfcModelFillerPtr; #include "TD_PackPop.h" #endif // _IFC_MODEL_FILLER_H