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"
26 // import other modules
29 // to avoid error on this
30 #define GEOMALGOAPI_EXPORT
32 // standard definitions
34 %include "std_string.i"
36 %include "std_shared_ptr.i"
37 %include "std_vector.i"
39 %exceptionclass GeomAlgoAPI_Exception;
45 catch (GeomAlgoAPI_Exception exc) {
46 // Reraise with SWIG_Python_Raise
47 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);
52 %typemap(out) std::list< std::shared_ptr< GeomAPI_Shape > >::value_type & {
53 $result = SWIG_NewPointerObj(SWIG_as_voidptr(new std::shared_ptr<GeomAPI_Shape>(*$1)), $descriptor(std::shared_ptr<GeomAPI_Shape> *), SWIG_POINTER_OWN | 0 );
56 %template(ShapeList) std::list<std::shared_ptr<GeomAPI_Shape> >;
57 %template(ValuesList) std::list<GeomAlgoAPI_InfoValue>;
58 %template(VectorOfDouble) std::vector<double>;
60 %typemap(in) std::vector<double>& (std::vector<double> temp) {
61 if (PyList_Check($input)) {
62 for (Py_ssize_t i = 0; i < PyList_Size($input); ++i) {
63 PyObject * item = PySequence_GetItem($input, i);
64 if (PyNumber_Check(item)) {
65 temp.push_back(PyFloat_AsDouble(item));
67 PyErr_SetString(PyExc_TypeError, "argument must be double value.");
74 PyErr_SetString(PyExc_ValueError, "argument must be a list of double values.");
79 %typemap(argout) std::vector<double>& {
80 PyObject* outList = PyList_New(0);
82 std::vector<double>::iterator it;
83 for ( it=$1->begin() ; it != $1->end(); it++ )
85 error = PyList_Append(outList, PyFloat_FromDouble(*it));
89 if ((!$result) || ($result == Py_None)) {
92 PyObject *aObj1, *aObj2;
93 if (!PyTuple_Check($result)) {
94 PyObject* aObj = $result;
95 $result = PyTuple_New(1);
96 PyTuple_SetItem($result,0,aObj);
98 aObj2 = PyTuple_New(1);
99 PyTuple_SetItem(aObj2,0,outList);
101 $result = PySequence_Concat(aObj1,aObj2);
107 %typecheck(SWIG_TYPECHECK_POINTER) std::vector<double>, const std::vector<double>& {
108 if (PyTuple_Check($input)) {
109 for (Py_ssize_t i = 0; i < PyTuple_Size($input); ++i) {
110 PyObject * item = PySequence_GetItem($input, i);
111 if (PyNumber_Check(item)) {
124 %typemap(in) double& (double temp) {
125 if (PyFloat_Check($input)) {
126 temp = PyFloat_AsDouble($input);
129 PyErr_SetString(PyExc_ValueError, "argument must be a double value.");
134 %typemap(argout) double& {
135 if ((!$result) || ($result == Py_None)) {
136 $result = PyFloat_FromDouble(*$1);
138 PyObject *aObj1, *aObj2;
139 if (!PyTuple_Check($result)) {
140 PyObject* aObj = $result;
141 $result = PyTuple_New(1);
142 PyTuple_SetItem($result,0,aObj);
144 aObj2 = PyTuple_New(1);
145 PyTuple_SetItem(aObj2,0,PyFloat_FromDouble(*$1));
147 $result = PySequence_Concat(aObj1,aObj2);
154 %shared_ptr(GeomAlgoAPI_Boolean)
155 %shared_ptr(GeomAlgoAPI_Intersection)
156 %shared_ptr(GeomAlgoAPI_MakeShape)
157 %shared_ptr(GeomAlgoAPI_MakeShapeCustom)
158 %shared_ptr(GeomAlgoAPI_MakeShapeList)
159 %shared_ptr(GeomAlgoAPI_MakeSweep)
160 %shared_ptr(GeomAlgoAPI_PaveFiller)
161 %shared_ptr(GeomAlgoAPI_Pipe)
162 %shared_ptr(GeomAlgoAPI_Placement)
163 %shared_ptr(GeomAlgoAPI_Prism)
164 %shared_ptr(GeomAlgoAPI_Revolution)
165 %shared_ptr(GeomAlgoAPI_Rotation)
166 %shared_ptr(GeomAlgoAPI_Sewing)
167 %shared_ptr(GeomAlgoAPI_SketchBuilder)
168 %shared_ptr(GeomAlgoAPI_ShapeBuilder)
169 %shared_ptr(GeomAlgoAPI_Translation)
170 %shared_ptr(GeomAlgoAPI_Transform)
171 %shared_ptr(GeomAlgoAPI_Box)
172 %shared_ptr(GeomAlgoAPI_ConeSegment)
173 %shared_ptr(GeomAlgoAPI_Copy)
174 %shared_ptr(GeomAlgoAPI_Symmetry)
175 %shared_ptr(GeomAlgoAPI_MapShapesAndAncestors)
176 %shared_ptr(GeomAlgoAPI_WireBuilder)
178 // all supported interfaces
179 %include "GeomAlgoAPI_MakeShape.h"
180 %include "GeomAlgoAPI_Boolean.h"
181 %include "GeomAlgoAPI_Circ2dBuilder.h"
182 %include "GeomAlgoAPI_CompoundBuilder.h"
183 %include "GeomAlgoAPI_CurveBuilder.h"
184 %include "GeomAlgoAPI_DFLoader.h"
185 %include "GeomAlgoAPI_EdgeBuilder.h"
186 %include "GeomAlgoAPI_FaceBuilder.h"
187 %include "GeomAlgoAPI_MakeShapeCustom.h"
188 %include "GeomAlgoAPI_MakeShapeList.h"
189 %include "GeomAlgoAPI_MakeSweep.h"
190 %include "GeomAlgoAPI_Transform.h"
191 %include "GeomAlgoAPI_Translation.h"
192 %include "GeomAlgoAPI_Placement.h"
193 %include "GeomAlgoAPI_PointBuilder.h"
194 %include "GeomAlgoAPI_Prism.h"
195 %include "GeomAlgoAPI_Revolution.h"
196 %include "GeomAlgoAPI_Rotation.h"
197 %include "GeomAlgoAPI_ShapeTools.h"
198 %include "GeomAlgoAPI_SketchBuilder.h"
199 %include "GeomAlgoAPI_BREPExport.h"
200 %include "GeomAlgoAPI_IGESExport.h"
201 %include "GeomAlgoAPI_STEPExport.h"
202 %include "GeomAlgoAPI_BREPImport.h"
203 %include "GeomAlgoAPI_IGESImport.h"
204 %include "GeomAlgoAPI_STEPImport.h"
205 %include "GeomAlgoAPI_Tools.h"
206 %include "GeomAlgoAPI_PaveFiller.h"
207 %include "GeomAlgoAPI_Intersection.h"
208 %include "GeomAlgoAPI_Pipe.h"
209 %include "GeomAlgoAPI_WireBuilder.h"
210 %include "GeomAlgoAPI_Sewing.h"
211 %include "GeomAlgoAPI_ShapeBuilder.h"
212 %include "GeomAlgoAPI_Exception.h"
213 %include "GeomAlgoAPI_ShapeAPI.h"
214 %include "GeomAlgoAPI_Copy.h"
215 %include "GeomAlgoAPI_Symmetry.h"
216 %include "GeomAlgoAPI_Box.h"
217 %include "GeomAlgoAPI_MapShapesAndAncestors.h"
218 %include "GeomAlgoAPI_ShapeInfo.h"
219 %include "GeomAlgoAPI_CanonicalRecognition.h"