4848#pragma once
4949
5050// std includes
51+ #include < functional>
5152#include < vector>
5253
5354// OCC includes
55+ #include < APIHeaderSection_MakeHeader.hxx>
5456#include < Quantity_Color.hxx>
5557#include < Standard_Type.hxx>
5658#include < TDF_Label.hxx>
5759#include < TDocStd_Document.hxx>
5860#include < TopoDS_Shape.hxx>
5961#include < XCAFDoc_ColorTool.hxx>
60- #include < XCAFDoc_ColorType.hxx>
6162#include < XCAFDoc_MaterialTool.hxx>
6263#include < XCAFDoc_ShapeTool.hxx>
6364
6667#include " occutils/xde/occutils-xde-material.h"
6768#include " occutils/xde/occutils-xde-shape.h"
6869
69- namespace occutils ::xde {
70+ namespace occutils ::xde
71+ {
7072
7173/* *
7274 * @struct DocInternals
@@ -99,11 +101,12 @@ struct DocInternals;
99101 * and dependencies in the header file, aiding in reducing
100102 * compilation times and providing ABI stability.
101103 */
102- class Doc : public Standard_Transient {
104+ class Doc : public Standard_Transient
105+ {
103106 // OCCT RTTI
104107 DEFINE_STANDARD_RTTI_INLINE (Doc, Standard_Transient)
105108
106- public:
109+ public:
107110 /* *
108111 * @brief Constructs a new Doc object.
109112 *
@@ -116,12 +119,12 @@ class Doc : public Standard_Transient {
116119 *
117120 * @param doc The CAF Document to initialize the Doc with.
118121 */
119- Doc (const Handle (TDocStd_Document) & doc);
122+ Doc (const Handle (TDocStd_Document)& doc);
120123
121124 /*
122125 * Construction and Initialization
123126 */
124- public:
127+ public:
125128 /* *
126129 * @brief Creates new empty XDE Document under this Assembly Document facade.
127130 */
@@ -144,11 +147,13 @@ class Doc : public Standard_Transient {
144147 *
145148 * @param filename The path and name of the file to write to.
146149 * @param exportUnit The unit to be used for exporting. Defaults to "MM".
150+ * @param headerCustomizer A Function to customize the header section (optional).
147151 *
148152 * @return true if successful, false otherwise.
149153 */
150- bool SaveSTEP (const std::string& filename,
151- const std::string& exportUnit = " MM" );
154+ bool SaveSTEP (const std::string& filename,
155+ const std::string& exportUnit = " MM" ,
156+ std::function<void (APIHeaderSection_MakeHeader&)> headerCustomizer = {}) const ;
152157
153158 /* *
154159 * @brief Checks if the Assembly Document is empty.
@@ -161,7 +166,7 @@ class Doc : public Standard_Transient {
161166 /*
162167 * API
163168 */
164- public:
169+ public:
165170 /* *
166171 * @brief Adds a shape without special attributes to the application.
167172 *
@@ -171,8 +176,7 @@ class Doc : public Standard_Transient {
171176 * @return TDF_Label The label of the added shape in the internal storage.
172177 * Can be used for subsequent referencing.
173178 */
174- TDF_Label AddShape (const TopoDS_Shape& shape,
175- const std::string& shapeName = std::string()) const ;
179+ TDF_Label AddShape (const TopoDS_Shape& shape, const std::string& shapeName = std::string()) const ;
176180
177181 /* *
178182 * @brief Adds a shape with specified properties to the application.
@@ -184,8 +188,7 @@ class Doc : public Standard_Transient {
184188 * @return TDF_Label The label of the added shape in the internal storage.
185189 * Can be used for subsequent referencing.
186190 */
187- TDF_Label AddShapeWithProps (const TopoDS_Shape& shape,
188- const ShapeProperties& props);
191+ TDF_Label AddShapeWithProps (const TopoDS_Shape& shape, const ShapeProperties& props);
189192
190193 /* *
191194 * @brief Retrieves the TDF_Label associated with a given TopoDS_Shape in the
@@ -240,7 +243,7 @@ class Doc : public Standard_Transient {
240243 * TDF_Label materialLabel = app.FindOrCreateMaterial(material);
241244 * // Use materialLabel as needed
242245 */
243- TDF_Label FindOrCreateMaterial (const Material& material);
246+ TDF_Label FindOrCreateMaterial (const Material& material) const ;
244247
245248 /* *
246249 * @brief Retrieves the labels of all materials in the application.
@@ -346,8 +349,7 @@ class Doc : public Standard_Transient {
346349 * @param changeTransp A boolean flag to indicate whether to change the
347350 * transparency.
348351 */
349- void SetColor (const TDF_Label& label, const Quantity_ColorRGBA& color,
350- bool changeTransp);
352+ void SetColor (const TDF_Label& label, const Quantity_ColorRGBA& color, bool changeTransp);
351353
352354 /* *
353355 * @brief Removes all color attributes from the shapes in the current
@@ -380,7 +382,7 @@ class Doc : public Standard_Transient {
380382 * @return A reference to the handle of the current document. The handle
381383 * allows both reading and modification of the document.
382384 */
383- Handle (TDocStd_Document) & ChangeDocument();
385+ Handle (TDocStd_Document)& ChangeDocument ();
384386
385387 /* *
386388 * @brief Retrieves a constant reference to the current document.
@@ -394,7 +396,7 @@ class Doc : public Standard_Transient {
394396 * @note Marked as [[nodiscard]] to encourage checking the returned handle, as
395397 * it provides essential document access.
396398 */
397- [[nodiscard]] const Handle (TDocStd_Document) & GetDocument() const ;
399+ [[nodiscard]] const Handle (TDocStd_Document)& GetDocument() const ;
398400
399401 /* *
400402 * @brief Retrieves the shape tool associated with the current document.
@@ -430,14 +432,14 @@ class Doc : public Standard_Transient {
430432 */
431433 Handle (XCAFDoc_MaterialTool) GetMaterialTool() const ;
432434
433- protected:
435+ protected:
434436 /* *
435437 * @brief Initializes the Data Model with the passed CAF Document and prepares
436438 * integral Data Model Engines.
437439 *
438440 * @param doc The CAF Document to initialize the Model with.
439441 */
440- void init (const Handle (TDocStd_Document) & doc);
442+ void init (const Handle (TDocStd_Document)& doc);
441443
442444 /* *
443445 * @brief Creates a new CAF Document.
@@ -453,8 +455,8 @@ class Doc : public Standard_Transient {
453455 */
454456 Handle (App) getApplication();
455457
456- protected:
457- Handle (TDocStd_Document) m_doc; // !< Underlying XCAF document.
458+ protected:
459+ Handle (TDocStd_Document) m_doc; // !< Underlying XCAF document.
458460};
459461
460- } // namespace occutils::xde
462+ } // namespace occutils::xde
0 commit comments