]> SALOME platform Git repositories - modules/shaper.git/blob - src/FeaturesAPI/FeaturesAPI.i
Salome HOME
Task 3.2. To keep compounds’ sub-shapes for all operations (issue #3139)
[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") addSplit;
47 %feature("kwargs") addSmash;
48 %feature("kwargs") addUnion;
49
50 // shared pointers
51 %shared_ptr(FeaturesAPI_BooleanCut)
52 %shared_ptr(FeaturesAPI_BooleanFuse)
53 %shared_ptr(FeaturesAPI_BooleanCommon)
54 %shared_ptr(FeaturesAPI_BooleanSmash)
55 %shared_ptr(FeaturesAPI_BooleanFill)
56 %shared_ptr(FeaturesAPI_Chamfer)
57 %shared_ptr(FeaturesAPI_Extrusion)
58 %shared_ptr(FeaturesAPI_ExtrusionBoolean)
59 %shared_ptr(FeaturesAPI_ExtrusionCut)
60 %shared_ptr(FeaturesAPI_ExtrusionFuse)
61 %shared_ptr(FeaturesAPI_Fillet)
62 %shared_ptr(FeaturesAPI_Intersection)
63 %shared_ptr(FeaturesAPI_MultiRotation)
64 %shared_ptr(FeaturesAPI_MultiTranslation)
65 %shared_ptr(FeaturesAPI_Partition)
66 %shared_ptr(FeaturesAPI_Pipe)
67 %shared_ptr(FeaturesAPI_Placement)
68 %shared_ptr(FeaturesAPI_Recover)
69 %shared_ptr(FeaturesAPI_RemoveSubShapes)
70 %shared_ptr(FeaturesAPI_Revolution)
71 %shared_ptr(FeaturesAPI_RevolutionBoolean)
72 %shared_ptr(FeaturesAPI_RevolutionCut)
73 %shared_ptr(FeaturesAPI_RevolutionFuse)
74 %shared_ptr(FeaturesAPI_Rotation)
75 %shared_ptr(FeaturesAPI_Scale)
76 %shared_ptr(FeaturesAPI_Symmetry)
77 %shared_ptr(FeaturesAPI_Translation)
78 %shared_ptr(FeaturesAPI_Union)
79 %shared_ptr(FeaturesAPI_FusionFaces)
80 %shared_ptr(FeaturesAPI_RemoveResults)
81 %shared_ptr(FeaturesAPI_Copy)
82 %shared_ptr(FeaturesAPI_ImportResult)
83 %shared_ptr(FeaturesAPI_Defeaturing)
84
85
86 %typecheck(SWIG_TYPECHECK_POINTER) std::pair<std::list<ModelHighAPI_Selection>, bool>, const std::pair<std::list<ModelHighAPI_Selection>, bool> & {
87   ModelHighAPI_Selection* temp_selection;
88   bool* temp_bool;
89   int newmem = 0;
90   $1 = 1;
91   std::list<PyObject*> temp_inputlist;
92   if (PySequence_Check($input)) {
93     for (Py_ssize_t i = 0; i < PySequence_Size($input) && $1; ++i) {
94       PyObject * temp = PySequence_GetItem($input, i);
95
96       if ((SWIG_ConvertPtrAndOwn(temp, (void **)&temp_selection, $descriptor(ModelHighAPI_Selection*), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
97         if (temp_selection) {
98           $1 = 1;
99         } else {
100           $1 = 0;
101         }
102       } else {
103         $1 = 0;
104       }
105     }
106   } else if (PyBool_Check($input)) {
107     $1 = 1;
108   } else {
109     $1 = 0;
110   }
111 }
112
113 %typemap(in) const std::pair<std::list<ModelHighAPI_Selection>, bool> & (std::pair<std::list<ModelHighAPI_Selection>, bool> temp) {
114   ModelHighAPI_Selection* temp_selection;
115   std::list<ModelHighAPI_Selection> temp_selectionlist;
116   int newmem = 0;
117   std::list<PyObject*> temp_inputlist;
118   if (PySequence_Check($input)) {
119     for (Py_ssize_t i = 0; i < PySequence_Size($input); ++i) {
120       PyObject * temp = PySequence_GetItem($input, i);
121
122       if ((SWIG_ConvertPtrAndOwn(temp, (void **)&temp_selection, $descriptor(ModelHighAPI_Selection*), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
123         if (temp_selection) {
124           temp_selectionlist.push_back(*temp_selection);
125           if (newmem & SWIG_CAST_NEW_MEMORY) {
126             delete temp_selection;
127           }
128         }
129       } else {
130         PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_Selection.");
131         return NULL;
132       }
133     }
134     temp = std::pair<std::list<ModelHighAPI_Selection>, bool>(temp_selectionlist, false);
135   } else if (PyBool_Check($input)) {
136     temp = std::pair<std::list<ModelHighAPI_Selection>, bool>(std::list<ModelHighAPI_Selection>(), $input == Py_True);
137   } else {
138     PyErr_SetString(PyExc_TypeError, "argument must be std::list<ModelHighAPI_Selection> or bool.");
139     return NULL;
140   }
141   $1 = &temp;
142 }
143
144 // fix compilation error: 'res*' was not declared in this scope
145 %typemap(freearg) const std::pair<std::list<ModelHighAPI_Selection>, bool> & {}
146
147 // all supported interfaces
148 %include "FeaturesAPI_BooleanCut.h"
149 %include "FeaturesAPI_BooleanFuse.h"
150 %include "FeaturesAPI_BooleanCommon.h"
151 %include "FeaturesAPI_BooleanSmash.h"
152 %include "FeaturesAPI_BooleanFill.h"
153 %include "FeaturesAPI_Chamfer.h"
154 %include "FeaturesAPI_Defeaturing.h"
155 %include "FeaturesAPI_Extrusion.h"
156 %include "FeaturesAPI_ExtrusionBoolean.h"
157 %include "FeaturesAPI_Fillet.h"
158 %include "FeaturesAPI_Intersection.h"
159 %include "FeaturesAPI_Measurement.h"
160 %include "FeaturesAPI_MultiRotation.h"
161 %include "FeaturesAPI_MultiTranslation.h"
162 %include "FeaturesAPI_Partition.h"
163 %include "FeaturesAPI_Pipe.h"
164 %include "FeaturesAPI_Placement.h"
165 %include "FeaturesAPI_Recover.h"
166 %include "FeaturesAPI_RemoveSubShapes.h"
167 %include "FeaturesAPI_Revolution.h"
168 %include "FeaturesAPI_RevolutionBoolean.h"
169 %include "FeaturesAPI_Rotation.h"
170 %include "FeaturesAPI_Scale.h"
171 %include "FeaturesAPI_Symmetry.h"
172 %include "FeaturesAPI_Translation.h"
173 %include "FeaturesAPI_Union.h"
174 %include "FeaturesAPI_FusionFaces.h"
175 %include "FeaturesAPI_RemoveResults.h"
176 %include "FeaturesAPI_Copy.h"
177 %include "FeaturesAPI_ImportResult.h"