]> SALOME platform Git repositories - modules/shaper.git/blob - src/FeaturesAPI/FeaturesAPI.i
Salome HOME
added new GlueFaces feature
[modules/shaper.git] / src / FeaturesAPI / FeaturesAPI.i
1 // Copyright (C) 2014-2022  CEA/DEN, EDF R&D
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 /* FeaturesAPI.i */
21
22 %module FeaturesAPI
23
24 %{
25   #include "FeaturesAPI_swig.h"
26 %}
27
28 %include "doxyhelp.i"
29
30 // import other modules
31 %import "ModelHighAPI.i"
32
33 // to avoid error on this
34 #define FEATURESAPI_EXPORT
35
36 // standard definitions
37 %include "typemaps.i"
38 %include "std_shared_ptr.i"
39
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") addMultiRotation;
49 %feature("kwargs") addMultiTranslation;
50 %feature("kwargs") addPartition;
51 %feature("kwargs") addPlacement;
52 %feature("kwargs") addRotation;
53 %feature("kwargs") addScale;
54 %feature("kwargs") addSewing;
55 %feature("kwargs") addSplit;
56 %feature("kwargs") addSmash;
57 %feature("kwargs") addSymmetry;
58 %feature("kwargs") addTranslation;
59 %feature("kwargs") addUnion;
60
61 // shared pointers
62 %shared_ptr(FeaturesAPI_BooleanCut)
63 %shared_ptr(FeaturesAPI_BooleanFuse)
64 %shared_ptr(FeaturesAPI_BooleanCommon)
65 %shared_ptr(FeaturesAPI_BooleanSmash)
66 %shared_ptr(FeaturesAPI_BooleanFill)
67 %shared_ptr(FeaturesAPI_Chamfer)
68 %shared_ptr(FeaturesAPI_NormalToFace)
69 %shared_ptr(FeaturesAPI_Extrusion)
70 %shared_ptr(FeaturesAPI_ExtrusionBoolean)
71 %shared_ptr(FeaturesAPI_ExtrusionCut)
72 %shared_ptr(FeaturesAPI_ExtrusionFuse)
73 %shared_ptr(FeaturesAPI_Fillet)
74 %shared_ptr(FeaturesAPI_Fillet1D)
75 %shared_ptr(FeaturesAPI_Fillet2D)
76 %shared_ptr(FeaturesAPI_GlueFaces)
77 %shared_ptr(FeaturesAPI_Intersection)
78 %shared_ptr(FeaturesAPI_MultiRotation)
79 %shared_ptr(FeaturesAPI_MultiTranslation)
80 %shared_ptr(FeaturesAPI_Partition)
81 %shared_ptr(FeaturesAPI_Pipe)
82 %shared_ptr(FeaturesAPI_Loft)
83 %shared_ptr(FeaturesAPI_Placement)
84 %shared_ptr(FeaturesAPI_PointCloudOnFace)
85 %shared_ptr(FeaturesAPI_Recover)
86 %shared_ptr(FeaturesAPI_RemoveSubShapes)
87 %shared_ptr(FeaturesAPI_Revolution)
88 %shared_ptr(FeaturesAPI_RevolutionBoolean)
89 %shared_ptr(FeaturesAPI_RevolutionCut)
90 %shared_ptr(FeaturesAPI_RevolutionFuse)
91 %shared_ptr(FeaturesAPI_Rotation)
92 %shared_ptr(FeaturesAPI_Scale)
93 %shared_ptr(FeaturesAPI_Sewing)
94 %shared_ptr(FeaturesAPI_Symmetry)
95 %shared_ptr(FeaturesAPI_Translation)
96 %shared_ptr(FeaturesAPI_Union)
97 %shared_ptr(FeaturesAPI_FusionFaces)
98 %shared_ptr(FeaturesAPI_RemoveResults)
99 %shared_ptr(FeaturesAPI_Copy)
100 %shared_ptr(FeaturesAPI_ImportResult)
101 %shared_ptr(FeaturesAPI_Defeaturing)
102 %shared_ptr(FeaturesAPI_BoundingBox)
103
104
105 %typecheck(SWIG_TYPECHECK_POINTER) std::pair<std::list<ModelHighAPI_Selection>, bool>, const std::pair<std::list<ModelHighAPI_Selection>, bool> & {
106   ModelHighAPI_Selection* temp_selection;
107   bool* temp_bool;
108   int newmem = 0;
109   $1 = 1;
110   std::list<PyObject*> temp_inputlist;
111   if (PySequence_Check($input)) {
112     for (Py_ssize_t i = 0; i < PySequence_Size($input) && $1; ++i) {
113       PyObject * temp = PySequence_GetItem($input, i);
114
115       if ((SWIG_ConvertPtrAndOwn(temp, (void **)&temp_selection, $descriptor(ModelHighAPI_Selection*), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
116         if (temp_selection) {
117           $1 = 1;
118         } else {
119           $1 = 0;
120         }
121       } else {
122         $1 = 0;
123       }
124     }
125   } else if (PyBool_Check($input)) {
126     $1 = 1;
127   } else {
128     $1 = 0;
129   }
130 }
131
132 %typemap(in) const std::pair<std::list<ModelHighAPI_Selection>, bool> & (std::pair<std::list<ModelHighAPI_Selection>, bool> temp) {
133   ModelHighAPI_Selection* temp_selection;
134   std::list<ModelHighAPI_Selection> temp_selectionlist;
135   int newmem = 0;
136   std::list<PyObject*> temp_inputlist;
137   if (PySequence_Check($input)) {
138     for (Py_ssize_t i = 0; i < PySequence_Size($input); ++i) {
139       PyObject * temp = PySequence_GetItem($input, i);
140
141       if ((SWIG_ConvertPtrAndOwn(temp, (void **)&temp_selection, $descriptor(ModelHighAPI_Selection*), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
142         if (temp_selection) {
143           temp_selectionlist.push_back(*temp_selection);
144           if (newmem & SWIG_CAST_NEW_MEMORY) {
145             delete temp_selection;
146           }
147         }
148       } else {
149         PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_Selection.");
150         return NULL;
151       }
152     }
153     temp = std::pair<std::list<ModelHighAPI_Selection>, bool>(temp_selectionlist, false);
154   } else if (PyBool_Check($input)) {
155     temp = std::pair<std::list<ModelHighAPI_Selection>, bool>(std::list<ModelHighAPI_Selection>(), $input == Py_True);
156   } else {
157     PyErr_SetString(PyExc_TypeError, "argument must be std::list<ModelHighAPI_Selection> or bool.");
158     return NULL;
159   }
160   $1 = &temp;
161 }
162
163 // fix compilation error: 'res*' was not declared in this scope
164 %typemap(freearg) const std::pair<std::list<ModelHighAPI_Selection>, bool> & {}
165
166
167 %typecheck(SWIG_TYPECHECK_POINTER) std::pair<ModelHighAPI_Selection, ModelHighAPI_Double>, const std::pair<ModelHighAPI_Selection, ModelHighAPI_Double> & {
168   ModelHighAPI_Selection* temp_selection;
169   int newmem = 0;
170   if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_selection, $descriptor(ModelHighAPI_Selection*), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
171     if (temp_selection) {
172       $1 = 1;
173     } else {
174       $1 = 0;
175     }
176   } else {
177     $1 = ((PyFloat_Check($input) || PyLong_Check($input) || PyUnicode_Check($input)) && !PyBool_Check($input)) ? 1 : 0;
178   }
179 }
180
181 %typemap(in) const std::pair<ModelHighAPI_Selection, ModelHighAPI_Double> & (std::pair<ModelHighAPI_Selection, ModelHighAPI_Double> temp) {
182   ModelHighAPI_Selection* temp_selection;
183   int newmem = 0;
184   if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_selection, $descriptor(ModelHighAPI_Selection*), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
185     if (temp_selection) {
186       temp = std::pair<ModelHighAPI_Selection, ModelHighAPI_Double>(*temp_selection, ModelHighAPI_Double(0.0));
187       if (newmem & SWIG_CAST_NEW_MEMORY) {
188         delete temp_selection;
189       }
190     }
191   } else if (PyFloat_Check($input) || PyLong_Check($input)) {
192     temp = std::pair<ModelHighAPI_Selection, ModelHighAPI_Double>(ModelHighAPI_Selection(), ModelHighAPI_Double(PyFloat_AsDouble($input)));
193   } else if (PyUnicode_Check($input)) {
194     Py_ssize_t size;
195     temp = std::pair<ModelHighAPI_Selection, ModelHighAPI_Double>(ModelHighAPI_Selection(), ModelHighAPI_Double(PyUnicode_AsWideCharString($input, &size)));
196   } else if ((SWIG_ConvertPtr($input, (void **)&$1, $1_descriptor, SWIG_POINTER_EXCEPTION)) == 0) {
197     temp = std::pair<ModelHighAPI_Selection, ModelHighAPI_Double>($1->first, $1->second);
198   } else {
199     PyErr_SetString(PyExc_ValueError, "argument must be selection, ModelHighAPI_Double, float, int or string.");
200     return NULL;
201   }
202   $1 = &temp;
203 }
204
205 // fix compilation error: 'res*' was not declared in this scope
206 %typemap(freearg) const std::pair<ModelHighAPI_Selection, ModelHighAPI_Double> & {}
207
208
209 // all supported interfaces
210 %include "FeaturesAPI_BooleanCut.h"
211 %include "FeaturesAPI_BooleanFuse.h"
212 %include "FeaturesAPI_BooleanCommon.h"
213 %include "FeaturesAPI_BooleanSmash.h"
214 %include "FeaturesAPI_BooleanFill.h"
215 %include "FeaturesAPI_Chamfer.h"
216 %include "FeaturesAPI_Defeaturing.h"
217 %include "FeaturesAPI_Extrusion.h"
218 %include "FeaturesAPI_ExtrusionBoolean.h"
219 %include "FeaturesAPI_Fillet.h"
220 %include "FeaturesAPI_GlueFaces.h"
221 %include "FeaturesAPI_Intersection.h"
222 %include "FeaturesAPI_Measurement.h"
223 %include "FeaturesAPI_NormalToFace.h"
224 %include "FeaturesAPI_MultiRotation.h"
225 %include "FeaturesAPI_MultiTranslation.h"
226 %include "FeaturesAPI_Partition.h"
227 %include "FeaturesAPI_Pipe.h"
228 %include "FeaturesAPI_Loft.h"
229 %include "FeaturesAPI_Placement.h"
230 %include "FeaturesAPI_PointCloudOnFace.h"
231 %include "FeaturesAPI_Recover.h"
232 %include "FeaturesAPI_RemoveSubShapes.h"
233 %include "FeaturesAPI_Revolution.h"
234 %include "FeaturesAPI_RevolutionBoolean.h"
235 %include "FeaturesAPI_Rotation.h"
236 %include "FeaturesAPI_Scale.h"
237 %include "FeaturesAPI_Sewing.h"
238 %include "FeaturesAPI_Symmetry.h"
239 %include "FeaturesAPI_Translation.h"
240 %include "FeaturesAPI_Union.h"
241 %include "FeaturesAPI_FusionFaces.h"
242 %include "FeaturesAPI_RemoveResults.h"
243 %include "FeaturesAPI_Copy.h"
244 %include "FeaturesAPI_ImportResult.h"
245 %include "FeaturesAPI_PointCoordinates.h"
246 %include "FeaturesAPI_GeometryCalculation.h"
247 %include "FeaturesAPI_BoundingBox.h"