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