SHAPER  9.15.0
ExchangeAPI_Export.h
1 // Copyright (C) 2014-2025 CEA, EDF
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 
20 #ifndef SRC_EXCHANGEAPI_EXCHANGEAPI_EXPORT_H_
21 #define SRC_EXCHANGEAPI_EXCHANGEAPI_EXPORT_H_
22 
23 //--------------------------------------------------------------------------------------
24 #include "ExchangeAPI.h"
25 
26 #include <list>
27 #include <string>
28 
29 #include <ModelHighAPI_Interface.h>
30 #include <ModelHighAPI_Macro.h>
31 
32 #include <ExchangePlugin_ExportFeature.h>
33 
34 #include <Python.h>
35 
36 //--------------------------------------------------------------------------------------
39 //--------------------------------------------------------------------------------------
40 
41 
46 {
47 public:
49  EXCHANGEAPI_EXPORT
50  explicit ExchangeAPI_Export(const std::shared_ptr<ModelAPI_Feature>& theFeature);
51 
53  EXCHANGEAPI_EXPORT
54  explicit ExchangeAPI_Export(const std::shared_ptr<ModelAPI_Feature>& theFeature,
55  const std::string & theFilePath,
56  const std::string & theAuthor = std::string(),
57  const std::string & theGeometryName = std::string(),
58  const std::string & theShapeFilePath = std::string());
59 
61  EXCHANGEAPI_EXPORT
62  explicit ExchangeAPI_Export(const std::shared_ptr<ModelAPI_Feature>& theFeature,
63  const std::string & theFilePath,
64  const ModelHighAPI_Selection& theSelectedShape,
65  const ModelHighAPI_Double& theDeflectionRelative ,
66  const ModelHighAPI_Double& theDeflectionAbsolute,
67  const bool theIsRelative,
68  const bool theIsASCII);
69 
71  EXCHANGEAPI_EXPORT
72  explicit ExchangeAPI_Export(const std::shared_ptr<ModelAPI_Feature>& theFeature,
73  const std::string & theFilePath,
74  const ModelHighAPI_Selection& theResult,
75  const std::string & theAuthor,
76  const std::string & theGeometryName = std::string(),
77  const std::string & theShapeFilePath = std::string());
78 
80  EXCHANGEAPI_EXPORT
81  explicit ExchangeAPI_Export(const std::shared_ptr<ModelAPI_Feature>& theFeature,
82  const ModelHighAPI_Selection& theResult,
83  const std::string & theAuthor,
84  const std::string & theGeometryName = std::string());
85 
87  EXCHANGEAPI_EXPORT
88  explicit ExchangeAPI_Export(const std::shared_ptr<ModelAPI_Feature>& theFeature,
89  const std::string & theFilePath,
90  const std::list<ModelHighAPI_Selection> & theSelectionList,
91  const std::string & theFileFormat = std::string());
92 
94  EXCHANGEAPI_EXPORT
95  virtual ~ExchangeAPI_Export();
96 
97  INTERFACE_17(ExchangePlugin_ExportFeature::ID(),
134 
135 
136  EXCHANGEAPI_EXPORT
137  virtual void dump(ModelHighAPI_Dumper& theDumper) const;
138 };
139 
141 typedef std::shared_ptr<ExchangeAPI_Export> ExportPtr;
142 
146 EXCHANGEAPI_EXPORT
147 ExportPtr exportToFile(const std::shared_ptr<ModelAPI_Document> & thePart,
148  const std::string & theFilePath,
149  const std::list<ModelHighAPI_Selection> & theSelectionList,
150  const std::string & theFileFormat = std::string());
151 
155 EXCHANGEAPI_EXPORT
156 ExportPtr exportToXAO(const std::shared_ptr<ModelAPI_Document> & thePart,
157  const std::string & theFilePath,
158  const std::string & theAuthor = std::string(),
159  const std::string & theGeometryName = std::string(),
160  const std::string & theShapeFilePath = std::string());
161 
165 EXCHANGEAPI_EXPORT
166 ExportPtr exportToSTL(const std::shared_ptr<ModelAPI_Document> & thePart,
167  const std::string & theFilePath,
168  const ModelHighAPI_Selection& theSelectedShape,
169  const ModelHighAPI_Double& theDeflectionRelative,
170  const ModelHighAPI_Double& theDeflectionAbsolute,
171  const bool theIsRelative,
172  const bool theIsASCII);
173 
177 EXCHANGEAPI_EXPORT
178 ExportPtr exportToXAO(const std::shared_ptr<ModelAPI_Document> & thePart,
179  const std::string & theFilePath,
180  const ModelHighAPI_Selection& theSelectedShape,
181  const std::string & theAuthor = std::string(),
182  const std::string & theGeometryName = std::string(),
183  const std::string & theShapeFilePath = std::string());
184 
188 EXCHANGEAPI_EXPORT
189 PyObject* exportToXAOMem(const std::shared_ptr<ModelAPI_Document> & thePart,
190  const ModelHighAPI_Selection& theSelectedShape,
191  const std::string & theAuthor = std::string(),
192  const std::string & theGeometryName = std::string());
193 
194 
201 EXCHANGEAPI_EXPORT void exportPart(
202  const std::shared_ptr<ModelAPI_Document> & thePart,
203  const std::string & theFilePath,
204  const std::list<ModelHighAPI_Selection> & theSelected = std::list<ModelHighAPI_Selection>());
205 
206 //--------------------------------------------------------------------------------------
207 //--------------------------------------------------------------------------------------
208 #endif /* SRC_EXCHANGEAPI_EXCHANGEAPI_EXPORT_H_ */
Interface for Export feature.
Definition: ExchangeAPI_Export.h:46
virtual void dump(ModelHighAPI_Dumper &theDumper) const
Dump wrapped feature.
Definition: ExchangeAPI_Export.cpp:195
virtual std::shared_ptr< ModelAPI_AttributeString > xaoFilePath() const
xao_file_path
Definition: ExchangeAPI_Export.h:133
virtual std::shared_ptr< ModelAPI_AttributeDouble > stlabsolute() const
Absolute.
Definition: ExchangeAPI_Export.h:133
virtual std::shared_ptr< ModelAPI_AttributeString > fileFormat() const
file format
Definition: ExchangeAPI_Export.h:133
virtual std::shared_ptr< ModelAPI_AttributeString > xaoGeometryName() const
xao geometry name
Definition: ExchangeAPI_Export.h:133
virtual std::shared_ptr< ModelAPI_AttributeString > exportType() const
ExportType.
Definition: ExchangeAPI_Export.h:133
virtual std::shared_ptr< ModelAPI_AttributeString > stldeflectionTypeabsolute() const
Type of the defelection.
Definition: ExchangeAPI_Export.h:133
virtual std::shared_ptr< ModelAPI_AttributeString > stlfileType() const
Type of the stl file.
Definition: ExchangeAPI_Export.h:133
virtual std::shared_ptr< ModelAPI_AttributeString > stlFilePath() const
stl_file_path
Definition: ExchangeAPI_Export.h:133
virtual std::shared_ptr< ModelAPI_AttributeString > selectionList() const
selection list
Definition: ExchangeAPI_Export.h:133
ExchangeAPI_Export(const std::shared_ptr< ModelAPI_Feature > &theFeature)
Constructor without values.
Definition: ExchangeAPI_Export.cpp:36
virtual std::shared_ptr< ModelAPI_AttributeDouble > stlrelative() const
Relative.
Definition: ExchangeAPI_Export.h:133
virtual std::shared_ptr< ModelAPI_AttributeString > xaoShapeFilePath() const
xao shape file path
Definition: ExchangeAPI_Export.h:133
virtual std::shared_ptr< ModelAPI_AttributeString > stldeflectionType() const
Type of the defelection.
Definition: ExchangeAPI_Export.h:133
virtual std::shared_ptr< ModelAPI_AttributeString > filePath() const
file path
Definition: ExchangeAPI_Export.h:133
virtual ~ExchangeAPI_Export()
Destructor.
Definition: ExchangeAPI_Export.cpp:171
virtual std::shared_ptr< ModelAPI_AttributeSelection > stlobjectselected() const
Object selected to export in stl file.
Definition: ExchangeAPI_Export.h:133
virtual std::shared_ptr< ModelAPI_AttributeString > memoryBuff() const
Bytes.
Definition: ExchangeAPI_Export.h:133
virtual std::shared_ptr< ModelAPI_AttributeString > xaoAuthor() const
xao author
Definition: ExchangeAPI_Export.h:133
virtual std::shared_ptr< ModelAPI_AttributeString > stldeflectionTyperelative() const
Type of the defelection.
Definition: ExchangeAPI_Export.h:133
static const std::string & SELECTION_LIST_ID()
attribute name of selection list
Definition: ExchangePlugin_ExportFeature.h:130
static const std::string & EXPORT_TYPE_ID()
attribute name for file format
Definition: ExchangePlugin_ExportFeature.h:46
static const std::string & XAO_AUTHOR_ID()
attribute name of author for XAO format
Definition: ExchangePlugin_ExportFeature.h:142
static const std::string & STL_FILE_TYPE()
Attribute name for stl file type.
Definition: ExchangePlugin_ExportFeature.h:106
static const std::string & ID()
Feature kind.
Definition: ExchangePlugin_ExportFeature.h:40
static const std::string & MEMORY_BUFFER_ID()
attribute string memory buffer
Definition: ExchangePlugin_ExportFeature.h:167
static const std::string & STL_ABSOLUTE()
Attribute name for absolute.
Definition: ExchangePlugin_ExportFeature.h:100
static const std::string & XAO_GEOMETRY_NAME_ID()
attribute name of geometry name for XAO format
Definition: ExchangePlugin_ExportFeature.h:148
static const std::string & FILE_FORMAT_ID()
attribute name of file format
Definition: ExchangePlugin_ExportFeature.h:124
static const std::string & XAO_SHAPE_FILE_PATH_ID()
attribute name of xao shape file path
Definition: ExchangePlugin_ExportFeature.h:154
static const std::string & STL_OBJECT_SELECTED()
Attribute name for selected object to export in stl file path.
Definition: ExchangePlugin_ExportFeature.h:70
static const std::string & STL_DEFLECTION_TYPE_ABSOLUTE()
Attribute name for deflection type absolute.
Definition: ExchangePlugin_ExportFeature.h:88
static const std::string & FILE_PATH_ID()
attribute name of file path
Definition: ExchangePlugin_ExportFeature.h:52
static const std::string & STL_DEFLECTION_TYPE()
Attribute name for deflection type.
Definition: ExchangePlugin_ExportFeature.h:76
static const std::string & STL_FILE_PATH_ID()
attribute name of stl file path
Definition: ExchangePlugin_ExportFeature.h:64
static const std::string & STL_DEFLECTION_TYPE_RELATIVE()
Attribute name for deflection type relative.
Definition: ExchangePlugin_ExportFeature.h:82
static const std::string & STL_RELATIVE()
Attribute name for relative.
Definition: ExchangePlugin_ExportFeature.h:94
static const std::string & XAO_FILE_PATH_ID()
attribute name of xao file path
Definition: ExchangePlugin_ExportFeature.h:58
Attribute that contains real value with double precision.
Definition: ModelAPI_AttributeDouble.h:34
Attribute that contains reference to the sub-shape of some result, the selected shape.
Definition: ModelAPI_AttributeSelection.h:35
API for the attribute that contains std (null terminated) string.
Definition: ModelAPI_AttributeString.h:33
Document for internal data structure of any object storage.
Definition: ModelAPI_Document.h:53
Class for filling ModelAPI_AttributeDouble.
Definition: ModelHighAPI_Double.h:37
Dump engine for the model.
Definition: ModelHighAPI_Dumper.h:81
Base class for feature interfaces.
Definition: ModelHighAPI_Interface.h:46
Class for filling ModelAPI_AttributeSelection.
Definition: ModelHighAPI_Selection.h:49
PyObject * exportToXAOMem(const std::shared_ptr< ModelAPI_Document > &thePart, const ModelHighAPI_Selection &theSelectedShape, const std::string &theAuthor=std::string(), const std::string &theGeometryName=std::string())
Exports to XAO format buffer the selected result with groups parts related to it only.
Definition: ExchangeAPI_Export.cpp:356
void exportPart(const std::shared_ptr< ModelAPI_Document > &thePart, const std::string &theFilePath, const std::list< ModelHighAPI_Selection > &theSelected=std::list< ModelHighAPI_Selection >())
Export selected features or the whole part to the binary file.
Definition: ExchangeAPI_Export.cpp:370
ExportPtr exportToSTL(const std::shared_ptr< ModelAPI_Document > &thePart, const std::string &theFilePath, const ModelHighAPI_Selection &theSelectedShape, const ModelHighAPI_Double &theDeflectionRelative, const ModelHighAPI_Double &theDeflectionAbsolute, const bool theIsRelative, const bool theIsASCII)
Exports to STL file the result of the current document.
Definition: ExchangeAPI_Export.cpp:321
ExportPtr exportToFile(const std::shared_ptr< ModelAPI_Document > &thePart, const std::string &theFilePath, const std::list< ModelHighAPI_Selection > &theSelectionList, const std::string &theFileFormat=std::string())
Export to file.
Definition: ExchangeAPI_Export.cpp:298
ExportPtr exportToXAO(const std::shared_ptr< ModelAPI_Document > &thePart, const std::string &theFilePath, const std::string &theAuthor=std::string(), const std::string &theGeometryName=std::string(), const std::string &theShapeFilePath=std::string())
Exports to XAO file all results of the current document.
Definition: ExchangeAPI_Export.cpp:309