1 // Copyright (C) 2014-2024 CEA, EDF
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
25 #include "FeaturesAPI_swig.h"
30 // import other modules
31 %import "ModelHighAPI.i"
33 // to avoid error on this
34 #define FEATURESAPI_EXPORT
36 // standard definitions
38 %include "std_shared_ptr.i"
40 // functions with named parameters
41 %feature("kwargs") addChamfer;
42 %feature("kwargs") addCommon;
43 %feature("kwargs") addCut;
44 %feature("kwargs") addFillet;
45 %feature("kwargs") addFuse;
46 %feature("kwargs") addGlueFaces;
47 %feature("kwargs") addIntersection;
48 %feature("kwargs") addLimitTolerance;
49 %feature("kwargs") addMultiRotation;
50 %feature("kwargs") addMultiTranslation;
51 %feature("kwargs") addPartition;
52 %feature("kwargs") addPlacement;
53 %feature("kwargs") addRotation;
54 %feature("kwargs") addScale;
55 %feature("kwargs") addSewing;
56 %feature("kwargs") addSplit;
57 %feature("kwargs") addSmash;
58 %feature("kwargs") addSymmetry;
59 %feature("kwargs") addTranslation;
60 %feature("kwargs") addUnion;
63 %shared_ptr(FeaturesAPI_BooleanCut)
64 %shared_ptr(FeaturesAPI_BooleanFuse)
65 %shared_ptr(FeaturesAPI_BooleanCommon)
66 %shared_ptr(FeaturesAPI_BooleanSmash)
67 %shared_ptr(FeaturesAPI_BooleanFill)
68 %shared_ptr(FeaturesAPI_BoundingBox)
69 %shared_ptr(FeaturesAPI_Chamfer)
70 %shared_ptr(FeaturesAPI_Copy)
71 %shared_ptr(FeaturesAPI_Defeaturing)
72 %shared_ptr(FeaturesAPI_Extrusion)
73 %shared_ptr(FeaturesAPI_ExtrusionBoolean)
74 %shared_ptr(FeaturesAPI_ExtrusionCut)
75 %shared_ptr(FeaturesAPI_ExtrusionFuse)
76 %shared_ptr(FeaturesAPI_Fillet)
77 %shared_ptr(FeaturesAPI_Fillet1D)
78 %shared_ptr(FeaturesAPI_Fillet2D)
79 %shared_ptr(FeaturesAPI_FusionFaces)
80 %shared_ptr(FeaturesAPI_GlueFaces)
81 %shared_ptr(FeaturesAPI_ImportResult)
82 %shared_ptr(FeaturesAPI_Intersection)
83 %shared_ptr(FeaturesAPI_LimitTolerance)
84 %shared_ptr(FeaturesAPI_Loft)
85 %shared_ptr(FeaturesAPI_MultiRotation)
86 %shared_ptr(FeaturesAPI_MultiTranslation)
87 %shared_ptr(FeaturesAPI_NormalToFace)
88 %shared_ptr(FeaturesAPI_Partition)
89 %shared_ptr(FeaturesAPI_Pipe)
90 %shared_ptr(FeaturesAPI_Placement)
91 %shared_ptr(FeaturesAPI_PointCloudOnFace)
92 %shared_ptr(FeaturesAPI_Recover)
93 %shared_ptr(FeaturesAPI_RemoveResults)
94 %shared_ptr(FeaturesAPI_RemoveSubShapes)
95 %shared_ptr(FeaturesAPI_Revolution)
96 %shared_ptr(FeaturesAPI_RevolutionBoolean)
97 %shared_ptr(FeaturesAPI_RevolutionCut)
98 %shared_ptr(FeaturesAPI_RevolutionFuse)
99 %shared_ptr(FeaturesAPI_Rotation)
100 %shared_ptr(FeaturesAPI_Scale)
101 %shared_ptr(FeaturesAPI_Sewing)
102 %shared_ptr(FeaturesAPI_SharedFaces)
103 %shared_ptr(FeaturesAPI_Symmetry)
104 %shared_ptr(FeaturesAPI_Translation)
105 %shared_ptr(FeaturesAPI_Union)
108 %typecheck(SWIG_TYPECHECK_POINTER) std::pair<std::list<ModelHighAPI_Selection>, bool>, const std::pair<std::list<ModelHighAPI_Selection>, bool> & {
109 ModelHighAPI_Selection* temp_selection;
113 std::list<PyObject*> temp_inputlist;
114 if (PySequence_Check($input)) {
115 for (Py_ssize_t i = 0; i < PySequence_Size($input) && $1; ++i) {
116 PyObject * temp = PySequence_GetItem($input, i);
118 if ((SWIG_ConvertPtrAndOwn(temp, (void **)&temp_selection, $descriptor(ModelHighAPI_Selection*), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
119 if (temp_selection) {
128 } else if (PyBool_Check($input)) {
135 %typemap(in) const std::pair<std::list<ModelHighAPI_Selection>, bool> & (std::pair<std::list<ModelHighAPI_Selection>, bool> temp) {
136 ModelHighAPI_Selection* temp_selection;
137 std::list<ModelHighAPI_Selection> temp_selectionlist;
139 std::list<PyObject*> temp_inputlist;
140 if (PySequence_Check($input)) {
141 for (Py_ssize_t i = 0; i < PySequence_Size($input); ++i) {
142 PyObject * temp = PySequence_GetItem($input, i);
144 if ((SWIG_ConvertPtrAndOwn(temp, (void **)&temp_selection, $descriptor(ModelHighAPI_Selection*), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
145 if (temp_selection) {
146 temp_selectionlist.push_back(*temp_selection);
147 if (newmem & SWIG_CAST_NEW_MEMORY) {
148 delete temp_selection;
152 PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_Selection.");
156 temp = std::pair<std::list<ModelHighAPI_Selection>, bool>(temp_selectionlist, false);
157 } else if (PyBool_Check($input)) {
158 temp = std::pair<std::list<ModelHighAPI_Selection>, bool>(std::list<ModelHighAPI_Selection>(), $input == Py_True);
160 PyErr_SetString(PyExc_TypeError, "argument must be std::list<ModelHighAPI_Selection> or bool.");
166 // fix compilation error: 'res*' was not declared in this scope
167 %typemap(freearg) const std::pair<std::list<ModelHighAPI_Selection>, bool> & {}
170 %typecheck(SWIG_TYPECHECK_POINTER) std::pair<ModelHighAPI_Selection, ModelHighAPI_Double>, const std::pair<ModelHighAPI_Selection, ModelHighAPI_Double> & {
171 ModelHighAPI_Selection* temp_selection;
173 if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_selection, $descriptor(ModelHighAPI_Selection*), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
174 if (temp_selection) {
180 $1 = ((PyFloat_Check($input) || PyLong_Check($input) || PyUnicode_Check($input)) && !PyBool_Check($input)) ? 1 : 0;
184 %typemap(in) const std::pair<ModelHighAPI_Selection, ModelHighAPI_Double> & (std::pair<ModelHighAPI_Selection, ModelHighAPI_Double> temp) {
185 ModelHighAPI_Selection* temp_selection;
187 if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_selection, $descriptor(ModelHighAPI_Selection*), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
188 if (temp_selection) {
189 temp = std::pair<ModelHighAPI_Selection, ModelHighAPI_Double>(*temp_selection, ModelHighAPI_Double(0.0));
190 if (newmem & SWIG_CAST_NEW_MEMORY) {
191 delete temp_selection;
194 } else if (PyFloat_Check($input) || PyLong_Check($input)) {
195 temp = std::pair<ModelHighAPI_Selection, ModelHighAPI_Double>(ModelHighAPI_Selection(), ModelHighAPI_Double(PyFloat_AsDouble($input)));
196 } else if (PyUnicode_Check($input)) {
198 temp = std::pair<ModelHighAPI_Selection, ModelHighAPI_Double>(ModelHighAPI_Selection(), ModelHighAPI_Double(PyUnicode_AsWideCharString($input, &size)));
199 } else if ((SWIG_ConvertPtr($input, (void **)&$1, $1_descriptor, SWIG_POINTER_EXCEPTION)) == 0) {
200 temp = std::pair<ModelHighAPI_Selection, ModelHighAPI_Double>($1->first, $1->second);
202 PyErr_SetString(PyExc_ValueError, "argument must be selection, ModelHighAPI_Double, float, int or string.");
208 // fix compilation error: 'res*' was not declared in this scope
209 %typemap(freearg) const std::pair<ModelHighAPI_Selection, ModelHighAPI_Double> & {}
212 // all supported interfaces
213 %include "FeaturesAPI_BooleanCut.h"
214 %include "FeaturesAPI_BooleanFuse.h"
215 %include "FeaturesAPI_BooleanCommon.h"
216 %include "FeaturesAPI_BooleanSmash.h"
217 %include "FeaturesAPI_BooleanFill.h"
218 %include "FeaturesAPI_BoundingBox.h"
219 %include "FeaturesAPI_Chamfer.h"
220 %include "FeaturesAPI_Copy.h"
221 %include "FeaturesAPI_Defeaturing.h"
222 %include "FeaturesAPI_Extrusion.h"
223 %include "FeaturesAPI_ExtrusionBoolean.h"
224 %include "FeaturesAPI_Fillet.h"
225 %include "FeaturesAPI_FusionFaces.h"
226 %include "FeaturesAPI_GeometryCalculation.h"
227 %include "FeaturesAPI_GlueFaces.h"
228 %include "FeaturesAPI_ImportResult.h"
229 %include "FeaturesAPI_Intersection.h"
230 %include "FeaturesAPI_LimitTolerance.h"
231 %include "FeaturesAPI_Loft.h"
232 %include "FeaturesAPI_Measurement.h"
233 %include "FeaturesAPI_NormalToFace.h"
234 %include "FeaturesAPI_MultiRotation.h"
235 %include "FeaturesAPI_MultiTranslation.h"
236 %include "FeaturesAPI_Partition.h"
237 %include "FeaturesAPI_Pipe.h"
238 %include "FeaturesAPI_Placement.h"
239 %include "FeaturesAPI_PointCloudOnFace.h"
240 %include "FeaturesAPI_PointCoordinates.h"
241 %include "FeaturesAPI_Recover.h"
242 %include "FeaturesAPI_RemoveResults.h"
243 %include "FeaturesAPI_RemoveSubShapes.h"
244 %include "FeaturesAPI_Revolution.h"
245 %include "FeaturesAPI_RevolutionBoolean.h"
246 %include "FeaturesAPI_Rotation.h"
247 %include "FeaturesAPI_Scale.h"
248 %include "FeaturesAPI_Sewing.h"
249 %include "FeaturesAPI_SharedFaces.h"
250 %include "FeaturesAPI_Symmetry.h"
251 %include "FeaturesAPI_Translation.h"
252 %include "FeaturesAPI_Union.h"