SHAPER  9.12.0
ExchangeAPI_Export.h
1 // Copyright (C) 2014-2023 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 
60  EXCHANGEAPI_EXPORT
61  explicit ExchangeAPI_Export(const std::shared_ptr<ModelAPI_Feature>& theFeature,
62  const std::string & theFilePath,
63  const ModelHighAPI_Selection& theSelectedShape,
64  const ModelHighAPI_Double& theDeflectionRelative ,
65  const ModelHighAPI_Double& theDeflectionAbsolute,
66  const bool theIsRelative,
67  const bool theIsASCII);
68 
70  EXCHANGEAPI_EXPORT
71  explicit ExchangeAPI_Export(const std::shared_ptr<ModelAPI_Feature>& theFeature,
72  const std::string & theFilePath,
73  const ModelHighAPI_Selection& theResult,
74  const std::string & theAuthor,
75  const std::string & theGeometryName = std::string());
76 
78  EXCHANGEAPI_EXPORT
79  explicit ExchangeAPI_Export(const std::shared_ptr<ModelAPI_Feature>& theFeature,
80  const ModelHighAPI_Selection& theResult,
81  const std::string & theAuthor,
82  const std::string & theGeometryName = std::string());
83 
85  EXCHANGEAPI_EXPORT
86  explicit ExchangeAPI_Export(const std::shared_ptr<ModelAPI_Feature>& theFeature,
87  const std::string & theFilePath,
88  const std::list<ModelHighAPI_Selection> & theSelectionList,
89  const std::string & theFileFormat = std::string());
90 
92  EXCHANGEAPI_EXPORT
93  virtual ~ExchangeAPI_Export();
94 
95  INTERFACE_16(ExchangePlugin_ExportFeature::ID(),
130 
131 
132  EXCHANGEAPI_EXPORT
133  virtual void dump(ModelHighAPI_Dumper& theDumper) const;
134 };
135 
137 typedef std::shared_ptr<ExchangeAPI_Export> ExportPtr;
138 
142 EXCHANGEAPI_EXPORT
143 ExportPtr exportToFile(const std::shared_ptr<ModelAPI_Document> & thePart,
144  const std::string & theFilePath,
145  const std::list<ModelHighAPI_Selection> & theSelectionList,
146  const std::string & theFileFormat = std::string());
147 
151 EXCHANGEAPI_EXPORT
152 ExportPtr exportToXAO(const std::shared_ptr<ModelAPI_Document> & thePart,
153  const std::string & theFilePath,
154  const std::string & theAuthor = std::string(),
155  const std::string & theGeometryName = std::string());
156 
160 EXCHANGEAPI_EXPORT
161 ExportPtr exportToSTL(const std::shared_ptr<ModelAPI_Document> & thePart,
162  const std::string & theFilePath,
163  const ModelHighAPI_Selection& theSelectedShape,
164  const ModelHighAPI_Double& theDeflectionRelative,
165  const ModelHighAPI_Double& theDeflectionAbsolute,
166  const bool theIsRelative,
167  const bool theIsASCII);
168 
172 EXCHANGEAPI_EXPORT
173 ExportPtr exportToXAO(const std::shared_ptr<ModelAPI_Document> & thePart,
174  const std::string & theFilePath,
175  const ModelHighAPI_Selection& theSelectedShape,
176  const std::string & theAuthor = std::string(),
177  const std::string & theGeometryName = std::string());
178 
182 EXCHANGEAPI_EXPORT
183 PyObject* exportToXAOMem(const std::shared_ptr<ModelAPI_Document> & thePart,
184  const ModelHighAPI_Selection& theSelectedShape,
185  const std::string & theAuthor = std::string(),
186  const std::string & theGeometryName = std::string());
187 
188 
192 EXCHANGEAPI_EXPORT void exportPart(
193  const std::shared_ptr<ModelAPI_Document> & thePart,
194  const std::string & theFilePath,
195  const std::list<ModelHighAPI_Selection> & theSelected = std::list<ModelHighAPI_Selection>());
196 
197 //--------------------------------------------------------------------------------------
198 //--------------------------------------------------------------------------------------
199 #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:189
virtual std::shared_ptr< ModelAPI_AttributeString > xaoFilePath() const
xao_file_path
Definition: ExchangeAPI_Export.h:129
virtual std::shared_ptr< ModelAPI_AttributeDouble > stlabsolute() const
Absolute.
Definition: ExchangeAPI_Export.h:129
virtual std::shared_ptr< ModelAPI_AttributeString > fileFormat() const
file format
Definition: ExchangeAPI_Export.h:129
virtual std::shared_ptr< ModelAPI_AttributeString > xaoGeometryName() const
xao geometry name
Definition: ExchangeAPI_Export.h:129
virtual std::shared_ptr< ModelAPI_AttributeString > exportType() const
ExportType.
Definition: ExchangeAPI_Export.h:129
virtual std::shared_ptr< ModelAPI_AttributeString > stldeflectionTypeabsolute() const
Type of the defelection.
Definition: ExchangeAPI_Export.h:129
virtual std::shared_ptr< ModelAPI_AttributeString > stlfileType() const
Type of the stl file.
Definition: ExchangeAPI_Export.h:129
virtual std::shared_ptr< ModelAPI_AttributeString > stlFilePath() const
stl_file_path
Definition: ExchangeAPI_Export.h:129
virtual std::shared_ptr< ModelAPI_AttributeString > selectionList() const
selection list
Definition: ExchangeAPI_Export.h:129
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:129
virtual std::shared_ptr< ModelAPI_AttributeString > stldeflectionType() const
Type of the defelection.
Definition: ExchangeAPI_Export.h:129
virtual std::shared_ptr< ModelAPI_AttributeString > filePath() const
file path
Definition: ExchangeAPI_Export.h:129
virtual ~ExchangeAPI_Export()
Destructor.
Definition: ExchangeAPI_Export.cpp:165
virtual std::shared_ptr< ModelAPI_AttributeSelection > stlobjectselected() const
Object selected to export in stl file.
Definition: ExchangeAPI_Export.h:129
virtual std::shared_ptr< ModelAPI_AttributeString > memoryBuff() const
Bytes.
Definition: ExchangeAPI_Export.h:129
virtual std::shared_ptr< ModelAPI_AttributeString > xaoAuthor() const
xao author
Definition: ExchangeAPI_Export.h:129
virtual std::shared_ptr< ModelAPI_AttributeString > stldeflectionTyperelative() const
Type of the defelection.
Definition: ExchangeAPI_Export.h:129
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:154
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 & 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:52
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:42
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:348
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:362
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:314
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:292
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())
Exports to XAO file all results of the current document.
Definition: ExchangeAPI_Export.cpp:303