///////////////////////////////////////////////////////////////////////////////
// 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.
///////////////////////////////////////////////////////////////////////////////
#if !defined(BREP2IFCADVANCEDBREPFILLER_H_)
#define BREP2IFCADVANCEDBREPFILLER_H_
#include "IfcBuildOptions.h"
#include "daiModel.h"
#include "IfcHostAppServices.h"
#include "Br/BrBrep.h"
#include "TD_PackPush.h"
class Brep2IfcAdvancedBrep;
/** \details
A class that provides an advanced interface for writing ODA Boundary Representation objects to IFC files.
\remarks
ODA IFC SDK should be initialized with odIfcInitialize parameter bool initIfcGeomResource = true to work with this class.
*/
class IFCCORETOOLS_EXPORT Brep2IfcAdvancedBrepFiller
{
public:
/** \details
Creates a new Brep2IFC filler object with specified parameters.
\param brep [in] A B-Rep object that contains data to write.
\param pModel [in] A raw pointer to the instance of the OdIfcModel class that represents the current model of the file.
\param pDb [in] A raw pointer to the instance of the B-Rep owner Protocol Extension database.
*/
Brep2IfcAdvancedBrepFiller(const OdBrBrep& brep, OdDAI::Model* pModel, OdDbBaseDatabase* pDb = nullptr);
/** \details
Destroys the Brep2IFC filler object.
*/
~Brep2IfcAdvancedBrepFiller();
/** \details
Sets the B-Rep color and material.
\param material [in] A global B-Rep material.
\param color [in] A global B-Rep color.
*/
void setBrepMaterialAndColor(OdDbStub* material, const OdCmEntityColor& color);
/** \details
Sets the B-Rep material.
\param material [in] A global B-Rep material.
*/
void setBrepMaterial(OdDbStub* material);
/** \details
Sets the B-Rep color.
\param color [in] A global B-Rep color.
*/
void setBrepColor(const OdCmEntityColor& color);
/** \details
Sets the value of the NURBS surfaces creation flag.
If the NURBS surfaces creation flag equals true, all surfaces are created as NURBS; otherwise, all surfaces are created according to their types in the B-Rep object if it is possible.
\param asNurbs [in] A new vale of the NURBS surfaces creation flag.
*/
void setAsNurbs(bool asNurbs);
/** \details
Sets transformation options.
\param transform [in] A transformation matrix for brep object.
\param dScale [in] Scale Factor. The scale factor must be greater than zero.
*/
void setTransformation(const OdGeMatrix3d& transform, double dScale = 1.);
/** \details
Sets transformation to the output instance from the incoming OdBrBrep object transformation matrix.
\param isTransform [in] If parameter is true sets transformation from the incoming OdBrBrep; otherwise dont set.
*/
void setBrBrepTransformation(bool isTransform);
/** \details
Sets the generated textures type or switches the generation of textures off.
\param texturesType [in] The textures generation type represented with a value of the TexturesType enumeration.
If this parameter equals to the kNoTextures value, the generation of textures will be switched off.
\remarks
The textures conversion option is in early beta state.
*/
void setTexturesCreationType(OdIfcHostAppServices::TexturesType texturesType);
/** \details
Adds the B-Rep object to the model as a new shape representation.
If the shape representation already exists, the method adds an IfcAdvancedBrep instance to it;
otherwise, it creates a new shape representation.
\param shapeId [in/out] A placeholder for the identifier of the created shape representation object.
If the identifier is zero, the method creates a new IfcProductDefinitionShape and sets its identifier.
\returns eOk if the shape representation object was successfully created; otherwise, the method returns an appropriate error code.
\remarks
The B-Rep object conversion to the IFC format is in the beta state.
*/
OdResult convertBrep2Model(OdDAIObjectId& shapeId);
/** \details
Creates an IfcAdvancedBrep object within the model and returns its object identifier.
\param advancedBrepId [out] A placeholder for the identifier of the created IfcAdvancedBrep object.
\returns eOk if the IfcAdvancedBrep object was successfully created; otherwise, the method returns an appropriate error code.
*/
OdResult convertBrep2IfcAdvancedBrep(OdDAIObjectId& advancedBrepId);
/** \details
Creates an IfcClosedShell entity object within the model and returns its object identifier.
\param shellId [out] A placeholder for the identifier of the created IfcClosedShell object.
\returns eOk if the IfcClosedShell entity object was successfully created; otherwise, the function returns an appropriate error code.
*/
OdResult convertBrep2ClosedShell(OdDAIObjectId& shellId);
/** \details
Creates an IfcOpenShell entity object within the model and returns its object identifier.
\param shellId [out] A placeholder for the identifier of the created IfcOpenShell object.
\returns eOk if the IfcOpenShell entity object was successfully created; otherwise, the function returns an appropriate error code.
*/
OdResult convertBrep2OpenShell(OdDAIObjectId& shellId);
private:
Brep2IfcAdvancedBrep* m_brep2IfcAdvancedBrep;
OdGeMatrix3d m_transform;
double m_dScale;
};
#include "TD_PackPop.h"
#endif // BREP2IFCADVANCEDBREPFILLER_H_