/////////////////////////////////////////////////////////////////////////////// // 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_OPS_H #define _IFC_MODEL_OPS_H #include "IfcBuildOptions.h" #include "IfcModel.h" #include "IfcEntity.h" #include "daiObjectId.h" #include "daiObjectSDAI.h" #include "daiUtils/daiModelProcessor.h" #include "TD_PackPush.h" namespace OdIfc { /** \details Contains declarations to provide high-level operations with IFC model content. */ namespace ModelOps { /** \details Removes an IFC entity shape representation from the model. \param product [in] An object identifier of the entity (the STEP ID is stored in the OdDbHandle). \param removeOpenings [in] Flag whether to remove openings related to the product \returns eOk if method executes successfully. */ OdResult IFCCORE_EXPORT removeRepresentationFrom(const OdDAIObjectId& product, bool removeOpenings = true); /** \details Removes an IFC entity placement components from the model, if they are not shared. \param product [in] An object identifier of the entity (the STEP ID is stored in the OdDbHandle). \returns eOk if method executes successfully. */ OdResult IFCCORE_EXPORT removePlacementFrom(const OdDAIObjectId& product); /** \details Removes an IFC entity of IfcFeatureElementSubtraction type and its nested content from the model. \param productToRemove [in] An object identifier of the entity (the STEP ID is stored in the OdDbHandle). \returns eOk if the operation has been finished successfully, or an appropriate error code otherwise. */ OdResult IFCCORE_EXPORT removeFromRelVoids(const OdDAIObjectId& productToRemove); /** \details Removes a contained or referenced IFC entity of IfcBuildingElement type and its nested content from the model. \param productToRemove [in] An object identifier of the entity (the STEP ID is stored in the OdDbHandle). \returns eOk if the operation has been finished successfully, or an appropriate error code otherwise. */ OdResult IFCCORE_EXPORT removeFromSpatialStructure(const OdDAIObjectId& productToRemove); /** \details Removes a decomposing IFC entity of IfcBuildingElement type or IFC entity of IfcSpatialStructureElement type and its nested content from the model. \param ifcSpatialStructureElement [in] An object identifier of the entity (the STEP ID is stored in the OdDbHandle). \returns eOk if the operation has been finished successfully, or an appropriate error code otherwise. */ OdResult IFCCORE_EXPORT removeFromRelAggregates(const OdDAIObjectId& ifcSpatialStructureElement); /** \details Clones an IFC entity shape representation to the model. \param product [in] An object identifier of the entity (the STEP ID is stored in the OdDbHandle). \returns The object identifier of the cloned entity or the source entity identifier otherwise. */ OdDAIObjectId IFCCORE_EXPORT cloneProductRepresentation(const OdDAIObjectId& product); /** \details Clones an IFC product within the same model. \param productToClone [in] An object identifier of the entity (the STEP ID is stored in the OdDbHandle). \returns The object identifier of the cloned entity or the source entity identifier otherwise. */ OdDAIObjectId cloneIfcProduct(const OdDAIObjectId& productToClone); /** \details Clones an IFC entity of IfcSpatialStructureElement type and its nested content to the model. \param ifcSpatialStructureElement [in] An object identifier of the entity (the STEP ID is stored in the OdDbHandle). \returns The object identifier of the cloned entity or the source entity identifier otherwise. */ OdDAIObjectId IFCCORE_EXPORT cloneWithRelAggregates(const OdDAIObjectId& ifcSpatialStructureElement); /** \details Clones an IFC entity of IfcBuildingElement type and its nested content to the model. \param productToClone [in] An object identifier of the entity (the STEP ID is stored in the OdDbHandle). \param toExistingSpatialStructure [in] A value of the flag that defines whether the cloned entity is appended to the existing structure (true) or is cloned with its structure (false). \returns The object identifier of the cloned entity or the source entity identifier otherwise. */ OdDAIObjectId IFCCORE_EXPORT cloneWithSpatialStructure(const OdDAIObjectId& productToClone, bool toExistingSpatialStructure = false); /** \details Clones an IFC entity of IfcSpatialStructureElement type and its nested content to the model. \param sourceProduct [in] An object identifier of the entity (the STEP ID is stored in the OdDbHandle). \param targetProduct [in] An object identifier of the target entity. \param targetModel [in] A smart pointer to the Model that is the target for processed entities. \returns The object identifier of the cloned entity or the kNullHandle value otherwise. */ OdDAIObjectId cloneContainedInSpatialStructure(const OdDAIObjectId& sourceProduct, const OdDAIObjectId& targetProduct, const OdDAI::ModelPtr targetModel = OdDAI::ModelPtr()); /** \details Clones an IFC entity of IfcBuildingElement type and its nested content to the model. \param sourceProduct [in] An object identifier of the entity (the STEP ID is stored in the OdDbHandle). \param targetProduct [in] An object identifier of the target entity. \param targetModel [in] A smart pointer to the Model that is the target for processed entities. \returns The object identifier of the cloned entity or the kNullHandle value otherwise. */ OdDAIObjectId cloneContainedInRelAggregate(const OdDAIObjectId& sourceProduct, const OdDAIObjectId& targetProduct, const OdDAI::ModelPtr targetModel = OdDAI::ModelPtr()); /** \details Clones an IFC entity of IfcProfuct subtype and its nested content to the model. \param sourceProduct [in] An object identifier of the entity (the STEP ID is stored in the OdDbHandle). \param targetModel [in] A smart pointer to the Model that is the target for processed entities. \returns The object identifier of the cloned entity or the kNullHandle value otherwise. */ OdDAIObjectId cloneProduct(const OdDAIObjectId& sourceProduct, const OdDAI::ModelPtr targetModel = OdDAI::ModelPtr()); /** \details Clones an IFC entity of IfcProfuct subtype without nested content (any decompose relationship) to the model. \param sourceProduct [in] An object identifier of the entity (the STEP ID is stored in the OdDbHandle). \param targetModel [in] A smart pointer to the Model that is the target for processed entities. \returns The object identifier of the cloned entity or the kNullHandle value otherwise. */ OdDAIObjectId cloneProductShallow(const OdDAIObjectId& sourceProduct, const OdDAI::ModelPtr targetModel = OdDAI::ModelPtr()); /** \details Extracts IFC geometric context items to make other model IFC entities valid. \param sourceModel [in] A smart pointer to the Model that is the source of data. \param targetModel [in] A smart pointer to the Model that is the target for processed entities. \param ctx [in] A smart pointer to the model context that represents shared data for entities processing. */ void prepareContext(const OdDAI::ModelPtr sourceModel, const OdDAI::ModelPtr targetModel, const OdDAI::ModelOps::ModelCtxPtr ctx); /** \details Creates units conversion calculation between 2 models according to target values and modifies context properties. \param sourceModel [in] A smart pointer to the Model that is the source of data. \param targetModel [in] A smart pointer to the Model that is the target for processed entities. \param ctx [in] A smart pointer to the model context that represents shared data for entities processing. */ void prepareUnits(const OdDAI::ModelPtr sourceModel, const OdDAI::ModelPtr targetModel, const OdDAI::ModelOps::ModelCtxPtr ctx); /** \details Fills OdDAI::ModelOps inner structures for processing target entity that belongs to IfcRelContainedInSpatialStructure. \param targetProduct [in] Object id of the target entity. \param ctx [in] A smart pointer to the model context that represents shared data for entities processing. */ void IFCCORE_EXPORT preparePathsSpatial(const OdDAIObjectId& targetProduct, const OdDAI::ModelOps::ModelCtxPtr ctx); /** \details Fills OdDAI::ModelOps inner structures for processing target entity that belongs to IfcRelAggregates and its nested content to the model. \param targetProduct [in] Object id of the target entity. \param ctx [in] A smart pointer to the model context that represents shared data for entities processing. */ void IFCCORE_EXPORT preparePathsAggregates(const OdDAIObjectId& targetProduct, const OdDAI::ModelOps::ModelCtxPtr ctx); /** \details Fills OdDAI::ModelOps inner structures for processing target entity without decompose relationships of its nested content. \param targetProduct [in] Object id of the target entity. \param ctx [in] A smart pointer to the model context that represents shared data for entities processing. */ void IFCCORE_EXPORT preparePaths(const OdDAIObjectId& targetProduct, const OdDAI::ModelOps::ModelCtxPtr ctx); /** \details Clones an IFC entity of IfcProduct subtype and its nested content to the model. \param sourceProduct [in] An object identifier of the entity (the STEP ID is stored in the OdDbHandle). \param targetProduct [in] An object identifier of the target entity. \param targetModel [in] A smart pointer to the Model that is the target for processed entities. \returns The object identifier of the cloned entity or the kNullHandle value otherwise. */ OdDAIObjectId IFCCORE_EXPORT ifcCloneTo(const OdDAIObjectId& sourceProduct, const OdDAIObjectId& targetProduct, const OdDAI::ModelPtr targetModel = OdDAI::ModelPtr()); /** \details Clones IFC entity of IfcProduct subtype and its nested content to the model. \param sourceProduct [in] An object identifier of the entity (the STEP ID is stored in the OdDbHandle). \param targetModel [in] A smart pointer to the Model that is the target for processed entities. \returns The object identifier of the cloned entity or the kNullHandle value otherwise. */ OdDAIObjectId IFCCORE_EXPORT ifcClone(const OdDAIObjectId& sourceProduct, const OdDAI::ModelPtr targetModel = OdDAI::ModelPtr()); /** \details Level of entities merging for the ModelOps::ifcCombineModels() function. */ enum class MergeLevel { /**Merge on the store level.*/ Storey, /**Merge on the building level.*/ Building, /**Merge on the site level.*/ Site }; /** \details Merges the content of two IFC models with a specified merge level. \param sourceModel [in] A smart pointer to the source Model that contains entities to be extracted. \param targetModel [in] A smart pointer to the Model that is the target for processed entities. \param level [in] The merging level value. \returns The object identifier of the target entity that contains merged content, or the kNullHandle value otherwise. */ OdDAIObjectId IFCCORE_EXPORT ifcCombineModels(const OdDAI::ModelPtr sourceModel, const OdDAI::ModelPtr targetModel, MergeLevel level = MergeLevel::Building); /** \details Extracts units from a specified Model. \param model [in] A smart pointer to the Model that contains units to be extracted. \param unitTypes [in] An array that contains types of extracted units. \param unitPrefixes [out] An STL map that contains prefixes of extracted units according their types. */ void IFCCORE_EXPORT extractUnits(const OdDAI::ModelPtr model, const OdAnsiStringArray& unitTypes, std::map& unitPrefixes); } } #include "TD_PackPop.h" #endif // _IFC_MODEL_OPS_H