1 // Copyright (C) 2014-2022 CEA/DEN, EDF R&D
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
23 #include "GeomAlgoAPI_swig.h"
25 // fix for SWIG v4.1.1
26 #if PY_VERSION_HEX >= 0x03020000
27 # define SWIGPY_SLICEOBJECT PyObject
29 # define SWIGPY_SLICEOBJECT PySliceObject
32 // fix for SWIG v2.0.4
33 #define SWIGPY_SLICE_ARG(obj) ((SWIGPY_SLICEOBJECT*)(obj))
36 // import other modules
39 // to avoid error on this
40 #define GEOMALGOAPI_EXPORT
42 // standard definitions
44 %include "std_string.i"
46 %include "std_shared_ptr.i"
47 %include "std_vector.i"
49 %exceptionclass GeomAlgoAPI_Exception;
55 catch (GeomAlgoAPI_Exception exc) {
56 // Reraise with SWIG_Python_Raise
57 SWIG_Python_Raise(SWIG_NewPointerObj((new GeomAlgoAPI_Exception(static_cast< const GeomAlgoAPI_Exception& >(exc))), SWIGTYPE_p_GeomAlgoAPI_Exception, SWIG_POINTER_OWN), "GeomAlgoAPI_Exception", SWIGTYPE_p_GeomAlgoAPI_Exception);
62 %typemap(out) std::list< std::shared_ptr< GeomAPI_Shape > >::value_type & {
63 $result = SWIG_NewPointerObj(SWIG_as_voidptr(new std::shared_ptr<GeomAPI_Shape>(*$1)), $descriptor(std::shared_ptr<GeomAPI_Shape> *), SWIG_POINTER_OWN | 0 );
66 %template(ShapeList) std::list<std::shared_ptr<GeomAPI_Shape> >;
67 %template(ValuesList) std::list<GeomAlgoAPI_InfoValue>;
68 %template(VectorOfDouble) std::vector<double>;
70 %typemap(in) std::vector<double>& (std::vector<double> temp) {
71 if (PyList_Check($input)) {
72 for (Py_ssize_t i = 0; i < PyList_Size($input); ++i) {
73 PyObject * item = PySequence_GetItem($input, i);
74 if (PyNumber_Check(item)) {
75 temp.push_back(PyFloat_AsDouble(item));
77 PyErr_SetString(PyExc_TypeError, "argument must be double value.");
84 PyErr_SetString(PyExc_ValueError, "argument must be a list of double values.");
89 %typemap(argout) std::vector<double>& {
90 PyObject* outList = PyList_New(0);
92 std::vector<double>::iterator it;
93 for ( it=$1->begin() ; it != $1->end(); it++ )
95 error = PyList_Append(outList, PyFloat_FromDouble(*it));
99 if ((!$result) || ($result == Py_None)) {
102 PyObject *aObj1, *aObj2;
103 if (!PyTuple_Check($result)) {
104 PyObject* aObj = $result;
105 $result = PyTuple_New(1);
106 PyTuple_SetItem($result,0,aObj);
108 aObj2 = PyTuple_New(1);
109 PyTuple_SetItem(aObj2,0,outList);
111 $result = PySequence_Concat(aObj1,aObj2);
117 %typecheck(SWIG_TYPECHECK_POINTER) std::vector<double>, const std::vector<double>& {
118 if (PyTuple_Check($input)) {
119 for (Py_ssize_t i = 0; i < PyTuple_Size($input); ++i) {
120 PyObject * item = PySequence_GetItem($input, i);
121 if (PyNumber_Check(item)) {
134 %typemap(in) double& (double temp) {
135 if (PyFloat_Check($input)) {
136 temp = PyFloat_AsDouble($input);
139 PyErr_SetString(PyExc_ValueError, "argument must be a double value.");
144 %typemap(argout) double& {
145 if ((!$result) || ($result == Py_None)) {
146 $result = PyFloat_FromDouble(*$1);
148 PyObject *aObj1, *aObj2;
149 if (!PyTuple_Check($result)) {
150 PyObject* aObj = $result;
151 $result = PyTuple_New(1);
152 PyTuple_SetItem($result,0,aObj);
154 aObj2 = PyTuple_New(1);
155 PyTuple_SetItem(aObj2,0,PyFloat_FromDouble(*$1));
157 $result = PySequence_Concat(aObj1,aObj2);
164 %shared_ptr(GeomAlgoAPI_Boolean)
165 %shared_ptr(GeomAlgoAPI_Intersection)
166 %shared_ptr(GeomAlgoAPI_MakeShape)
167 %shared_ptr(GeomAlgoAPI_MakeShapeCustom)
168 %shared_ptr(GeomAlgoAPI_MakeShapeList)
169 %shared_ptr(GeomAlgoAPI_MakeSweep)
170 %shared_ptr(GeomAlgoAPI_PaveFiller)
171 %shared_ptr(GeomAlgoAPI_Pipe)
172 %shared_ptr(GeomAlgoAPI_Placement)
173 %shared_ptr(GeomAlgoAPI_Prism)
174 %shared_ptr(GeomAlgoAPI_Revolution)
175 %shared_ptr(GeomAlgoAPI_Rotation)
176 %shared_ptr(GeomAlgoAPI_Sewing)
177 %shared_ptr(GeomAlgoAPI_SketchBuilder)
178 %shared_ptr(GeomAlgoAPI_ShapeBuilder)
179 %shared_ptr(GeomAlgoAPI_Translation)
180 %shared_ptr(GeomAlgoAPI_Transform)
181 %shared_ptr(GeomAlgoAPI_Box)
182 %shared_ptr(GeomAlgoAPI_ConeSegment)
183 %shared_ptr(GeomAlgoAPI_Copy)
184 %shared_ptr(GeomAlgoAPI_Symmetry)
185 %shared_ptr(GeomAlgoAPI_MapShapesAndAncestors)
186 %shared_ptr(GeomAlgoAPI_WireBuilder)
188 // all supported interfaces
189 %include "GeomAlgoAPI_MakeShape.h"
190 %include "GeomAlgoAPI_Boolean.h"
191 %include "GeomAlgoAPI_Circ2dBuilder.h"
192 %include "GeomAlgoAPI_CompoundBuilder.h"
193 %include "GeomAlgoAPI_CurveBuilder.h"
194 %include "GeomAlgoAPI_DFLoader.h"
195 %include "GeomAlgoAPI_EdgeBuilder.h"
196 %include "GeomAlgoAPI_FaceBuilder.h"
197 %include "GeomAlgoAPI_MakeShapeCustom.h"
198 %include "GeomAlgoAPI_MakeShapeList.h"
199 %include "GeomAlgoAPI_MakeSweep.h"
200 %include "GeomAlgoAPI_Transform.h"
201 %include "GeomAlgoAPI_Translation.h"
202 %include "GeomAlgoAPI_Placement.h"
203 %include "GeomAlgoAPI_PointBuilder.h"
204 %include "GeomAlgoAPI_Prism.h"
205 %include "GeomAlgoAPI_Revolution.h"
206 %include "GeomAlgoAPI_Rotation.h"
207 %include "GeomAlgoAPI_ShapeTools.h"
208 %include "GeomAlgoAPI_SketchBuilder.h"
209 %include "GeomAlgoAPI_BREPExport.h"
210 %include "GeomAlgoAPI_IGESExport.h"
211 %include "GeomAlgoAPI_STEPExport.h"
212 %include "GeomAlgoAPI_BREPImport.h"
213 %include "GeomAlgoAPI_IGESImport.h"
214 %include "GeomAlgoAPI_STEPImport.h"
215 %include "GeomAlgoAPI_Tools.h"
216 %include "GeomAlgoAPI_PaveFiller.h"
217 %include "GeomAlgoAPI_Intersection.h"
218 %include "GeomAlgoAPI_Pipe.h"
219 %include "GeomAlgoAPI_WireBuilder.h"
220 %include "GeomAlgoAPI_Sewing.h"
221 %include "GeomAlgoAPI_ShapeBuilder.h"
222 %include "GeomAlgoAPI_Exception.h"
223 %include "GeomAlgoAPI_ShapeAPI.h"
224 %include "GeomAlgoAPI_Copy.h"
225 %include "GeomAlgoAPI_Symmetry.h"
226 %include "GeomAlgoAPI_Box.h"
227 %include "GeomAlgoAPI_MapShapesAndAncestors.h"
228 %include "GeomAlgoAPI_ShapeInfo.h"
229 %include "GeomAlgoAPI_CanonicalRecognition.h"