]> SALOME platform Git repositories - modules/shaper.git/blob - src/FeaturesAPI/FeaturesAPI.i
Salome HOME
c2fc5179589d2cc28f7f645f9ad0b9769c54019b
[modules/shaper.git] / src / FeaturesAPI / FeaturesAPI.i
1 // Copyright (C) 2014-2019  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") addCommon;
42 %feature("kwargs") addCut;
43 %feature("kwargs") addFuse;
44 %feature("kwargs") addPartition;
45 %feature("kwargs") addPlacement;
46 %feature("kwargs") addRotation;
47 %feature("kwargs") addSplit;
48 %feature("kwargs") addSmash;
49 %feature("kwargs") addTranslation;
50 %feature("kwargs") addUnion;
51
52 // shared pointers
53 %shared_ptr(FeaturesAPI_BooleanCut)
54 %shared_ptr(FeaturesAPI_BooleanFuse)
55 %shared_ptr(FeaturesAPI_BooleanCommon)
56 %shared_ptr(FeaturesAPI_BooleanSmash)
57 %shared_ptr(FeaturesAPI_BooleanFill)
58 %shared_ptr(FeaturesAPI_Chamfer)
59 %shared_ptr(FeaturesAPI_Extrusion)
60 %shared_ptr(FeaturesAPI_ExtrusionBoolean)
61 %shared_ptr(FeaturesAPI_ExtrusionCut)
62 %shared_ptr(FeaturesAPI_ExtrusionFuse)
63 %shared_ptr(FeaturesAPI_Fillet)
64 %shared_ptr(FeaturesAPI_Intersection)
65 %shared_ptr(FeaturesAPI_MultiRotation)
66 %shared_ptr(FeaturesAPI_MultiTranslation)
67 %shared_ptr(FeaturesAPI_Partition)
68 %shared_ptr(FeaturesAPI_Pipe)
69 %shared_ptr(FeaturesAPI_Placement)
70 %shared_ptr(FeaturesAPI_Recover)
71 %shared_ptr(FeaturesAPI_RemoveSubShapes)
72 %shared_ptr(FeaturesAPI_Revolution)
73 %shared_ptr(FeaturesAPI_RevolutionBoolean)
74 %shared_ptr(FeaturesAPI_RevolutionCut)
75 %shared_ptr(FeaturesAPI_RevolutionFuse)
76 %shared_ptr(FeaturesAPI_Rotation)
77 %shared_ptr(FeaturesAPI_Scale)
78 %shared_ptr(FeaturesAPI_Symmetry)
79 %shared_ptr(FeaturesAPI_Translation)
80 %shared_ptr(FeaturesAPI_Union)
81 %shared_ptr(FeaturesAPI_FusionFaces)
82 %shared_ptr(FeaturesAPI_RemoveResults)
83 %shared_ptr(FeaturesAPI_Copy)
84 %shared_ptr(FeaturesAPI_ImportResult)
85 %shared_ptr(FeaturesAPI_Defeaturing)
86
87
88 %typecheck(SWIG_TYPECHECK_POINTER) std::pair<std::list<ModelHighAPI_Selection>, bool>, const std::pair<std::list<ModelHighAPI_Selection>, bool> & {
89   ModelHighAPI_Selection* temp_selection;
90   bool* temp_bool;
91   int newmem = 0;
92   $1 = 1;
93   std::list<PyObject*> temp_inputlist;
94   if (PySequence_Check($input)) {
95     for (Py_ssize_t i = 0; i < PySequence_Size($input) && $1; ++i) {
96       PyObject * temp = PySequence_GetItem($input, i);
97
98       if ((SWIG_ConvertPtrAndOwn(temp, (void **)&temp_selection, $descriptor(ModelHighAPI_Selection*), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
99         if (temp_selection) {
100           $1 = 1;
101         } else {
102           $1 = 0;
103         }
104       } else {
105         $1 = 0;
106       }
107     }
108   } else if (PyBool_Check($input)) {
109     $1 = 1;
110   } else {
111     $1 = 0;
112   }
113 }
114
115 %typemap(in) const std::pair<std::list<ModelHighAPI_Selection>, bool> & (std::pair<std::list<ModelHighAPI_Selection>, bool> temp) {
116   ModelHighAPI_Selection* temp_selection;
117   std::list<ModelHighAPI_Selection> temp_selectionlist;
118   int newmem = 0;
119   std::list<PyObject*> temp_inputlist;
120   if (PySequence_Check($input)) {
121     for (Py_ssize_t i = 0; i < PySequence_Size($input); ++i) {
122       PyObject * temp = PySequence_GetItem($input, i);
123
124       if ((SWIG_ConvertPtrAndOwn(temp, (void **)&temp_selection, $descriptor(ModelHighAPI_Selection*), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
125         if (temp_selection) {
126           temp_selectionlist.push_back(*temp_selection);
127           if (newmem & SWIG_CAST_NEW_MEMORY) {
128             delete temp_selection;
129           }
130         }
131       } else {
132         PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_Selection.");
133         return NULL;
134       }
135     }
136     temp = std::pair<std::list<ModelHighAPI_Selection>, bool>(temp_selectionlist, false);
137   } else if (PyBool_Check($input)) {
138     temp = std::pair<std::list<ModelHighAPI_Selection>, bool>(std::list<ModelHighAPI_Selection>(), $input == Py_True);
139   } else {
140     PyErr_SetString(PyExc_TypeError, "argument must be std::list<ModelHighAPI_Selection> or bool.");
141     return NULL;
142   }
143   $1 = &temp;
144 }
145
146 // fix compilation error: 'res*' was not declared in this scope
147 %typemap(freearg) const std::pair<std::list<ModelHighAPI_Selection>, bool> & {}
148
149
150 %typecheck(SWIG_TYPECHECK_POINTER) std::pair<ModelHighAPI_Selection, ModelHighAPI_Double>, const std::pair<ModelHighAPI_Selection, ModelHighAPI_Double> & {
151   ModelHighAPI_Selection* temp_selection;
152   int newmem = 0;
153   if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_selection, $descriptor(ModelHighAPI_Selection*), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
154     if (temp_selection) {
155       $1 = 1;
156     } else {
157       $1 = 0;
158     }
159   } else {
160     $1 = ((PyFloat_Check($input) || PyLong_Check($input) || PyUnicode_Check($input)) && !PyBool_Check($input)) ? 1 : 0;
161   }
162 }
163
164 %typemap(in) const std::pair<ModelHighAPI_Selection, ModelHighAPI_Double> & (std::pair<ModelHighAPI_Selection, ModelHighAPI_Double> temp) {
165   ModelHighAPI_Selection* temp_selection;
166   int newmem = 0;
167   if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_selection, $descriptor(ModelHighAPI_Selection*), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
168     if (temp_selection) {
169       temp = std::pair<ModelHighAPI_Selection, ModelHighAPI_Double>(*temp_selection, ModelHighAPI_Double(0.0));
170       if (newmem & SWIG_CAST_NEW_MEMORY) {
171         delete temp_selection;
172       }
173     }
174   } else if (PyFloat_Check($input) || PyLong_Check($input)) {
175     temp = std::pair<ModelHighAPI_Selection, ModelHighAPI_Double>(ModelHighAPI_Selection(), ModelHighAPI_Double(PyFloat_AsDouble($input)));
176   } else if (PyUnicode_Check($input)) {
177     temp = std::pair<ModelHighAPI_Selection, ModelHighAPI_Double>(ModelHighAPI_Selection(), ModelHighAPI_Double(PyUnicode_AsUTF8($input)));
178   } else if ((SWIG_ConvertPtr($input, (void **)&$1, $1_descriptor, SWIG_POINTER_EXCEPTION)) == 0) {
179     temp = std::pair<ModelHighAPI_Selection, ModelHighAPI_Double>($1->first, $1->second);
180   } else {
181     PyErr_SetString(PyExc_ValueError, "argument must be selection, ModelHighAPI_Double, float, int or string.");
182     return NULL;
183   }
184   $1 = &temp;
185 }
186
187 // fix compilation error: 'res*' was not declared in this scope
188 %typemap(freearg) const std::pair<ModelHighAPI_Selection, ModelHighAPI_Double> & {}
189
190
191 // all supported interfaces
192 %include "FeaturesAPI_BooleanCut.h"
193 %include "FeaturesAPI_BooleanFuse.h"
194 %include "FeaturesAPI_BooleanCommon.h"
195 %include "FeaturesAPI_BooleanSmash.h"
196 %include "FeaturesAPI_BooleanFill.h"
197 %include "FeaturesAPI_Chamfer.h"
198 %include "FeaturesAPI_Defeaturing.h"
199 %include "FeaturesAPI_Extrusion.h"
200 %include "FeaturesAPI_ExtrusionBoolean.h"
201 %include "FeaturesAPI_Fillet.h"
202 %include "FeaturesAPI_Intersection.h"
203 %include "FeaturesAPI_Measurement.h"
204 %include "FeaturesAPI_MultiRotation.h"
205 %include "FeaturesAPI_MultiTranslation.h"
206 %include "FeaturesAPI_Partition.h"
207 %include "FeaturesAPI_Pipe.h"
208 %include "FeaturesAPI_Placement.h"
209 %include "FeaturesAPI_Recover.h"
210 %include "FeaturesAPI_RemoveSubShapes.h"
211 %include "FeaturesAPI_Revolution.h"
212 %include "FeaturesAPI_RevolutionBoolean.h"
213 %include "FeaturesAPI_Rotation.h"
214 %include "FeaturesAPI_Scale.h"
215 %include "FeaturesAPI_Symmetry.h"
216 %include "FeaturesAPI_Translation.h"
217 %include "FeaturesAPI_Union.h"
218 %include "FeaturesAPI_FusionFaces.h"
219 %include "FeaturesAPI_RemoveResults.h"
220 %include "FeaturesAPI_Copy.h"
221 %include "FeaturesAPI_ImportResult.h"