Salome HOME
ba30a72da6938d6d677faf9fbecc8a08e9ea12ec
[modules/shaper.git] / src / SketchAPI / SketchAPI.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 /* SketchAPI.i */
21
22 %module SketchAPI
23
24 %{
25   #include "SketchAPI_swig.h"
26   #include "ModelHighAPI_swig.h"
27
28   // fix for SWIG v2.0.4
29   #define SWIGPY_SLICE_ARG(obj) ((PyObject*)(obj))
30 %}
31
32 %include "doxyhelp.i"
33
34 // import other modules
35 %import "GeomAPI.i"
36 %import "ModelAPI.i"
37 %import "ModelHighAPI.i"
38
39 // to avoid error on this
40 #define SKETCHAPI_EXPORT
41
42 // standard definitions
43 %include "typemaps.i"
44 %include "std_list.i"
45 %include "std_pair.i"
46 %include "std_shared_ptr.i"
47
48 // function with named parameters
49 %feature("kwargs") SketchAPI_BSpline::controlPoles;
50 %feature("kwargs") SketchAPI_BSpline::controlPolygon;
51 %feature("kwargs") SketchAPI_Ellipse::construction;
52 %feature("kwargs") SketchAPI_EllipticArc::construction;
53 %feature("kwargs") SketchAPI_Sketch::addSpline;
54 %feature("kwargs") SketchAPI_Sketch::addInterpolation;
55 %feature("kwargs") SketchAPI_Sketch::addApproximation;
56 %feature("kwargs") SketchAPI_Sketch::setAngle;
57
58 // shared pointers
59 %shared_ptr(SketchAPI_Arc)
60 %shared_ptr(SketchAPI_MacroArc)
61 %shared_ptr(SketchAPI_Circle)
62 %shared_ptr(SketchAPI_MacroCircle)
63 %shared_ptr(SketchAPI_Ellipse)
64 %shared_ptr(SketchAPI_MacroEllipse)
65 %shared_ptr(SketchAPI_EllipticArc)
66 %shared_ptr(SketchAPI_MacroEllipticArc)
67 %shared_ptr(SketchAPI_BSpline)
68 %shared_ptr(SketchAPI_BSplinePeriodic)
69 %shared_ptr(SketchAPI_Constraint)
70 %shared_ptr(SketchAPI_ConstraintAngle)
71 %shared_ptr(SketchAPI_IntersectionPoint)
72 %shared_ptr(SketchAPI_Line)
73 %shared_ptr(SketchAPI_Mirror)
74 %shared_ptr(SketchAPI_Sketch)
75 %shared_ptr(SketchAPI_SketchEntity)
76 %shared_ptr(SketchAPI_Point)
77 %shared_ptr(SketchAPI_Projection)
78 %shared_ptr(SketchAPI_Rectangle)
79 %shared_ptr(SketchAPI_Rotation)
80 %shared_ptr(SketchAPI_Translation)
81
82 // std::list -> []
83 %template(InterfaceList) std::list<std::shared_ptr<ModelHighAPI_Interface> >;
84 %template(EntityList)    std::list<std::shared_ptr<SketchAPI_SketchEntity> >;
85 %template(SketchPointList) std::list<std::shared_ptr<SketchAPI_Point> >;
86 %template(GeomPnt2dList) std::list<std::shared_ptr<GeomAPI_Pnt2d> >;
87 // std::pair -> []
88 %template(PointRefAttrPair) std::pair<std::shared_ptr<GeomAPI_Pnt2d>, ModelHighAPI_RefAttr>;
89
90 %typecheck(SWIG_TYPECHECK_POINTER) std::shared_ptr<ModelAPI_Feature>, const std::shared_ptr<ModelAPI_Feature> & {
91   std::shared_ptr<ModelAPI_Feature> * temp_feature;
92   std::shared_ptr<ModelHighAPI_Interface> * temp_interface;
93   int newmem = 0;
94   if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_feature, $descriptor(std::shared_ptr<ModelAPI_Feature> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
95     if (temp_feature) {
96       $1 = 1;
97     } else {
98       $1 = 0;
99     }
100   } else
101   if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_interface, $descriptor(std::shared_ptr<ModelHighAPI_Interface> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
102     if (temp_interface) {
103       $1 = 1;
104     } else {
105       $1 = 0;
106     }
107   } else
108     $1 = 0;
109 }
110
111 %typemap(in) const std::shared_ptr<ModelAPI_Feature> & (std::shared_ptr<ModelAPI_Feature> temp) {
112   std::shared_ptr<ModelAPI_Feature> * temp_feature;
113   std::shared_ptr<ModelHighAPI_Interface> * temp_interface;
114   int newmem = 0;
115   if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_feature, $descriptor(std::shared_ptr<ModelAPI_Feature> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
116     if (!temp_feature) {
117       PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_Interface.");
118       return NULL;
119     }
120     temp = (*temp_feature);
121     if (newmem & SWIG_CAST_NEW_MEMORY) {
122       delete temp_feature;
123     }
124     $1 = &temp;
125   } else
126   if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_interface, $descriptor(std::shared_ptr<ModelHighAPI_Interface> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
127     if (!temp_interface) {
128       PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_Interface.");
129       return NULL;
130     }
131     temp = (*temp_interface)->feature();
132     if (newmem & SWIG_CAST_NEW_MEMORY) {
133       delete temp_interface;
134     }
135     $1 = &temp;
136   } else
137   if ((SWIG_ConvertPtr($input, (void **)&$1, $1_descriptor, SWIG_POINTER_EXCEPTION)) == 0) {
138   } else {
139     PyErr_SetString(PyExc_ValueError, "argument must be ModelHighAPI_Interface.");
140     return NULL;
141   }
142 }
143
144 %typemap(in) const std::list<std::shared_ptr<ModelAPI_Object> > & (std::list<std::shared_ptr<ModelAPI_Object> > temp) {
145   std::shared_ptr<ModelAPI_Object> * temp_object;
146   std::shared_ptr<ModelHighAPI_Interface> * temp_interface;
147   ModelHighAPI_Selection* temp_selection;
148   int newmem = 0;
149   if (PySequence_Check($input)) {
150     for (Py_ssize_t i = 0; i < PySequence_Size($input); ++i) {
151       PyObject * item = PySequence_GetItem($input, i);
152       if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_selection, $descriptor(ModelHighAPI_Selection*), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
153         if (!temp_selection) {
154           PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_Interface, ModelHighAPI_Selection or ModelAPI_Object.");
155           return NULL;
156         }
157         temp.push_back(temp_selection->resultSubShapePair().first);
158         if (newmem & SWIG_CAST_NEW_MEMORY) {
159           delete temp_selection;
160         }
161       } else
162       if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_object, $descriptor(std::shared_ptr<ModelAPI_Object> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
163         if (!temp_object) {
164           PyErr_SetString(PyExc_TypeError, "argument must be list of ModelHighAPI_Interface, ModelHighAPI_Selection or ModelAPI_Object.");
165           return NULL;
166         }
167         temp.push_back(*temp_object);
168         if (newmem & SWIG_CAST_NEW_MEMORY) {
169           delete temp_object;
170         }
171       } else
172       if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_interface, $descriptor(std::shared_ptr<ModelHighAPI_Interface> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
173         if (!temp_interface) {
174           PyErr_SetString(PyExc_TypeError, "argument must be list of ModelHighAPI_Interface, ModelHighAPI_Selection or ModelAPI_Object.");
175           return NULL;
176         }
177         temp.push_back((*temp_interface)->defaultResult());
178         if (newmem & SWIG_CAST_NEW_MEMORY) {
179           delete temp_interface;
180         }
181       }
182       Py_DECREF(item);
183     }
184     $1 = &temp;
185   } else {
186     PyErr_SetString(PyExc_ValueError, "argument must be list of ModelHighAPI_Interface or ModelAPI_Object.");
187     return NULL;
188   }
189 }
190
191 %typecheck(SWIG_TYPECHECK_POINTER) std::pair<std::shared_ptr<GeomAPI_Pnt2d>, ModelHighAPI_RefAttr>, const std::pair<std::shared_ptr<GeomAPI_Pnt2d>, ModelHighAPI_RefAttr> & {
192   std::shared_ptr<ModelAPI_Attribute> * temp_attribute;
193   std::shared_ptr<ModelAPI_Object> * temp_object;
194   std::shared_ptr<ModelHighAPI_Interface> * temp_interface;
195   ModelHighAPI_Selection* temp_selection;
196   std::pair<std::shared_ptr<GeomAPI_Pnt2d>, ModelHighAPI_RefAttr>* temp_pair;
197   std::shared_ptr<GeomAPI_Pnt2d> * temp_point;
198   ModelHighAPI_RefAttr temp_refattr;
199   int newmem = 0;
200   std::list<PyObject*> temp_inputlist;
201   if (PySequence_Check($input)) {
202     for (Py_ssize_t i = 0; i < PySequence_Size($input); ++i) {
203       PyObject * temp = PySequence_GetItem($input, i);
204       temp_inputlist.push_back(temp);
205     }
206   } else {
207     temp_inputlist.push_back($input);
208   }
209
210   $1 = 1;
211   for (std::list<PyObject*>::iterator it = temp_inputlist.begin(); it != temp_inputlist.end() && $1; ++it) {
212     PyObject* item = *it;
213
214     if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_selection, $descriptor(ModelHighAPI_Selection*), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
215       if (temp_selection) {
216         $1 = 1;
217       } else {
218         $1 = 0;
219       }
220     } else
221     if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_attribute, $descriptor(std::shared_ptr<ModelAPI_Attribute> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
222       if (temp_attribute) {
223         $1 = 1;
224       } else {
225         $1 = 0;
226       }
227     } else
228     if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_object, $descriptor(std::shared_ptr<ModelAPI_Object> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
229       if (temp_object) {
230         $1 = 1;
231       } else {
232         $1 = 0;
233       }
234     } else
235     if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_interface, $descriptor(std::shared_ptr<ModelHighAPI_Interface> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
236       if (temp_interface) {
237         $1 = 1;
238       } else {
239         $1 = 0;
240       }
241     } else
242     if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_pair, $descriptor(std::pair<std::shared_ptr<GeomAPI_Pnt2d>, ModelHighAPI_RefAttr> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
243       if (temp_pair) {
244         $1 = 1;
245       } else {
246         $1 = 0;
247       }
248     } else
249     if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_point, $descriptor(std::shared_ptr<GeomAPI_Pnt2d> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
250       if (temp_point) {
251         $1 = 1;
252       } else {
253         $1 = 0;
254       }
255     } else {
256       $1 = 0;
257     }
258   }
259 }
260
261 %typemap(in) const std::pair<std::shared_ptr<GeomAPI_Pnt2d>, ModelHighAPI_RefAttr> & (std::pair<std::shared_ptr<GeomAPI_Pnt2d>, ModelHighAPI_RefAttr> temp) {
262   std::shared_ptr<ModelAPI_Attribute> * temp_attribute;
263   std::shared_ptr<ModelAPI_Object> * temp_object;
264   std::shared_ptr<ModelHighAPI_Interface> * temp_interface;
265   ModelHighAPI_Selection* temp_selection;
266   std::pair<std::shared_ptr<GeomAPI_Pnt2d>, ModelHighAPI_RefAttr>* temp_pair;
267   std::shared_ptr<GeomAPI_Pnt2d> * temp_point = 0;
268   ModelHighAPI_RefAttr temp_refattr;
269   int newmem = 0;
270   std::list<PyObject*> temp_inputlist;
271   if (PySequence_Check($input)) {
272     for (Py_ssize_t i = 0; i < PySequence_Size($input); ++i) {
273       PyObject * temp = PySequence_GetItem($input, i);
274       temp_inputlist.push_back(temp);
275     }
276   } else {
277     temp_inputlist.push_back($input);
278   }
279
280   for (std::list<PyObject*>::iterator it = temp_inputlist.begin(); it != temp_inputlist.end(); ++it) {
281     PyObject* item = *it;
282
283     if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_selection, $descriptor(ModelHighAPI_Selection*), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
284       if (temp_selection) {
285         temp_refattr = ModelHighAPI_RefAttr(std::shared_ptr<ModelAPI_Object>(temp_selection->resultSubShapePair().first));
286         if (newmem & SWIG_CAST_NEW_MEMORY) {
287           delete temp_selection;
288         }
289       }
290     } else
291     if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_attribute, $descriptor(std::shared_ptr<ModelAPI_Attribute> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
292       if (temp_attribute) {
293         temp_refattr = ModelHighAPI_RefAttr(*temp_attribute);
294         if (newmem & SWIG_CAST_NEW_MEMORY) {
295           delete temp_attribute;
296         }
297       }
298     } else
299     if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_object, $descriptor(std::shared_ptr<ModelAPI_Object> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
300       if (temp_object) {
301         temp_refattr = ModelHighAPI_RefAttr(*temp_object);
302         if (newmem & SWIG_CAST_NEW_MEMORY) {
303           delete temp_object;
304         }
305       }
306     } else
307     if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_interface, $descriptor(std::shared_ptr<ModelHighAPI_Interface> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
308       if (temp_interface) {
309         temp_refattr = ModelHighAPI_RefAttr(*temp_interface);
310         if (newmem & SWIG_CAST_NEW_MEMORY) {
311           delete temp_interface;
312         }
313       }
314     } else
315     if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_pair, $descriptor(std::pair<std::shared_ptr<GeomAPI_Pnt2d>, ModelHighAPI_RefAttr> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
316       if (temp_pair) {
317         temp_point = &temp_pair->first;
318         temp_refattr = temp_pair->second;
319         if (newmem & SWIG_CAST_NEW_MEMORY) {
320           delete temp_pair;
321         }
322       }
323     } else
324     if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_point, $descriptor(std::shared_ptr<GeomAPI_Pnt2d> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
325       // fall through
326     }
327   }
328
329   if (temp_point || !temp_refattr.isEmpty()) {
330     if (temp_point) {
331       temp = std::pair<std::shared_ptr<GeomAPI_Pnt2d>, ModelHighAPI_RefAttr>(*temp_point, temp_refattr);
332     } else {
333       temp = std::pair<std::shared_ptr<GeomAPI_Pnt2d>, ModelHighAPI_RefAttr>(std::shared_ptr<GeomAPI_Pnt2d>(), temp_refattr);
334     }
335     if (temp_point && (newmem & SWIG_CAST_NEW_MEMORY)) {
336       delete temp_point;
337     }
338     $1 = &temp;
339   } else {
340     PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_RefAttr, ModelHighAPI_Selection, ModelHighAPI_Interface, ModelAPI_Attribute or ModelAPI_Object.");
341     return NULL;
342   }
343 }
344
345 // fix compilarion error: 'res*' was not declared in this scope
346 %typemap(freearg) const std::pair<std::shared_ptr<GeomAPI_Pnt2d>, ModelHighAPI_RefAttr> & {}
347
348
349 %typemap(in) const std::list<std::pair<std::shared_ptr<GeomAPI_Pnt2d>, ModelHighAPI_RefAttr> > & (std::list<std::pair<std::shared_ptr<GeomAPI_Pnt2d>, ModelHighAPI_RefAttr> > temp) {
350   if (PySequence_Check($input)) {
351     for (Py_ssize_t i = 0; i < PySequence_Size($input); ++i) {
352       PyObject * item = PySequence_GetItem($input, i);
353
354       std::list<PyObject*> temp_inputlist;
355       if (PySequence_Check(item)) {
356         for (Py_ssize_t i = 0; i < PySequence_Size(item); ++i) {
357           PyObject * tmpItem = PySequence_GetItem(item, i);
358           temp_inputlist.push_back(tmpItem);
359         }
360       } else {
361         temp_inputlist.push_back(item);
362       }
363
364       std::shared_ptr<ModelAPI_Attribute> * temp_attribute = 0;
365       std::shared_ptr<ModelAPI_Object> * temp_object = 0;
366       std::shared_ptr<ModelHighAPI_Interface> * temp_interface = 0;
367       ModelHighAPI_Selection* temp_selection = 0;
368       std::pair<std::shared_ptr<GeomAPI_Pnt2d>, ModelHighAPI_RefAttr>* temp_pair = 0;
369       std::shared_ptr<GeomAPI_Pnt2d> * temp_point = 0;
370       ModelHighAPI_RefAttr temp_refattr;
371       int newmem = 0;
372       int clearmem = 0;
373
374       for (std::list<PyObject*>::iterator it = temp_inputlist.begin(); it != temp_inputlist.end(); ++it) {
375         PyObject* item = *it;
376
377         if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_selection, $descriptor(ModelHighAPI_Selection*), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
378           if (temp_selection) {
379             temp_refattr = ModelHighAPI_RefAttr(std::shared_ptr<ModelAPI_Object>(temp_selection->resultSubShapePair().first));
380             if (newmem & SWIG_CAST_NEW_MEMORY) {
381               delete temp_selection;
382             }
383           }
384         } else
385         if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_attribute, $descriptor(std::shared_ptr<ModelAPI_Attribute> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
386           if (temp_attribute) {
387             temp_refattr = ModelHighAPI_RefAttr(*temp_attribute);
388             if (newmem & SWIG_CAST_NEW_MEMORY) {
389               delete temp_attribute;
390             }
391           }
392         } else
393         if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_object, $descriptor(std::shared_ptr<ModelAPI_Object> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
394           if (temp_object) {
395             temp_refattr = ModelHighAPI_RefAttr(*temp_object);
396             if (newmem & SWIG_CAST_NEW_MEMORY) {
397               delete temp_object;
398             }
399           }
400         } else
401         if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_interface, $descriptor(std::shared_ptr<ModelHighAPI_Interface> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
402           if (temp_interface) {
403             temp_refattr = ModelHighAPI_RefAttr(*temp_interface);
404             if (newmem & SWIG_CAST_NEW_MEMORY) {
405               delete temp_interface;
406             }
407           }
408         } else
409         if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_pair, $descriptor(std::pair<std::shared_ptr<GeomAPI_Pnt2d>, ModelHighAPI_RefAttr> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
410           if (temp_pair) {
411             temp_point = &temp_pair->first;
412             temp_refattr = temp_pair->second;
413             if (newmem & SWIG_CAST_NEW_MEMORY) {
414               delete temp_pair;
415             }
416           }
417         } else
418         if (PyTuple_Check(item)) {
419           if (PyTuple_Size(item) == 2) {
420             double x = (double)PyFloat_AsDouble(PySequence_GetItem(item, 0));
421             double y = (double)PyFloat_AsDouble(PySequence_GetItem(item, 1));
422             temp_point = new std::shared_ptr<GeomAPI_Pnt2d>(new GeomAPI_Pnt2d(x, y));
423             clearmem = 1;
424           } else {
425             PyErr_SetString(PyExc_TypeError, "argument must a list of 2D points.");
426             return NULL;
427           }
428         } else
429         if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_point, $descriptor(std::shared_ptr<GeomAPI_Pnt2d> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
430           // fall through
431         } else
432         if (PyNumber_Check(item)) {
433           PyObject* item1 = *(++it);
434           if (PyNumber_Check(item1)) {
435             double x = (double)PyFloat_AsDouble(item);
436             double y = (double)PyFloat_AsDouble(item1);
437             temp_point = new std::shared_ptr<GeomAPI_Pnt2d>(new GeomAPI_Pnt2d(x, y));
438             clearmem = 1;
439           } else {
440             PyErr_SetString(PyExc_TypeError, "argument must a list of 2D points.");
441             return NULL;
442           }
443         }
444       }
445
446       if (temp_point || !temp_refattr.isEmpty()) {
447         if (temp_point) {
448           temp.push_back(std::pair<std::shared_ptr<GeomAPI_Pnt2d>, ModelHighAPI_RefAttr>(*temp_point, temp_refattr));
449         } else {
450           temp.push_back(std::pair<std::shared_ptr<GeomAPI_Pnt2d>, ModelHighAPI_RefAttr>(std::shared_ptr<GeomAPI_Pnt2d>(), temp_refattr));
451         }
452         if (temp_point && ((newmem & SWIG_CAST_NEW_MEMORY) || clearmem)) {
453           delete temp_point;
454         }
455       } else {
456         PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_RefAttr, ModelHighAPI_Selection, ModelHighAPI_Interface, ModelAPI_Attribute or ModelAPI_Object.");
457         return NULL;
458       }
459       Py_DECREF(item);
460     }
461     $1 = &temp;
462   } else {
463     PyErr_SetString(PyExc_ValueError, "argument must be a tuple of lists.");
464     return NULL;
465   }
466 }
467
468 %typecheck(SWIG_TYPECHECK_POINTER) std::list<std::pair<std::shared_ptr<GeomAPI_Pnt2d>, ModelHighAPI_RefAttr> >, const std::list<std::pair<std::shared_ptr<GeomAPI_Pnt2d>, ModelHighAPI_RefAttr> >& {
469   int newmem = 0;
470   if (PySequence_Check($input)) {
471     for (Py_ssize_t i = 0; i < PySequence_Size($input) && $1; ++i) {
472       PyObject * item = PySequence_GetItem($input, i);
473
474       std::list<PyObject*> temp_inputlist;
475       if (PySequence_Check(item)) {
476         for (Py_ssize_t i = 0; i < PySequence_Size(item); ++i) {
477           PyObject * tmpItem = PySequence_GetItem(item, i);
478           temp_inputlist.push_back(tmpItem);
479         }
480       } else {
481         temp_inputlist.push_back(item);
482       }
483
484       std::shared_ptr<ModelAPI_Attribute> * temp_attribute = 0;
485       std::shared_ptr<ModelAPI_Object> * temp_object = 0;
486       std::shared_ptr<ModelHighAPI_Interface> * temp_interface = 0;
487       ModelHighAPI_Selection* temp_selection = 0;
488       std::pair<std::shared_ptr<GeomAPI_Pnt2d>, ModelHighAPI_RefAttr>* temp_pair = 0;
489       std::shared_ptr<GeomAPI_Pnt2d> * temp_point = 0;
490       ModelHighAPI_RefAttr temp_refattr;
491
492       $1 = 1;
493       for (std::list<PyObject*>::iterator it = temp_inputlist.begin(); it != temp_inputlist.end() && $1; ++it) {
494         PyObject* item = *it;
495
496         if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_selection, $descriptor(ModelHighAPI_Selection*), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
497           if (temp_selection) {
498             $1 = 1;
499           } else {
500             $1 = 0;
501           }
502         } else
503         if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_attribute, $descriptor(std::shared_ptr<ModelAPI_Attribute> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
504           if (temp_attribute) {
505             $1 = 1;
506           } else {
507             $1 = 0;
508           }
509         } else
510         if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_object, $descriptor(std::shared_ptr<ModelAPI_Object> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
511           if (temp_object) {
512             $1 = 1;
513           } else {
514             $1 = 0;
515           }
516         } else
517         if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_interface, $descriptor(std::shared_ptr<ModelHighAPI_Interface> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
518           if (temp_interface) {
519             $1 = 1;
520           } else {
521             $1 = 0;
522           }
523         } else
524         if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_pair, $descriptor(std::pair<std::shared_ptr<GeomAPI_Pnt2d>, ModelHighAPI_RefAttr> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
525           if (temp_pair) {
526             $1 = 1;
527           } else {
528             $1 = 0;
529           }
530         } else
531         if (PyTuple_Check(item)) {
532           if (PyTuple_Size(item) == 2) {
533             if (PyNumber_Check(PySequence_GetItem(item, 0)) && PyNumber_Check(PySequence_GetItem(item, 1))) {
534               $1 = 1;
535             } else {
536               $1 = 0;
537             }
538           } else {
539             $1 = 0;
540           }
541         } else
542         if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_point, $descriptor(std::shared_ptr<GeomAPI_Pnt2d> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
543           if (temp_point) {
544             $1 = 1;
545           } else {
546             $1 = 0;
547           }
548         } else
549         if (PyNumber_Check(item)) {
550           $1 = 1;
551         } else {
552           $1 = 0;
553         }
554       }
555       Py_DECREF(item);
556     }
557   } else {
558     $1 = 0;
559   }
560 }
561
562 // fix compilarion error: 'res*' was not declared in this scope
563 %typemap(freearg) const std::list<std::shared_ptr<GeomAPI_Pnt2d> > & {}
564
565
566 // all supported interfaces (the order is very important according dependencies: base class first)
567 %include "SketchAPI_SketchEntity.h"
568 %include "SketchAPI_Point.h"
569 %include "SketchAPI_IntersectionPoint.h"
570 %include "SketchAPI_Line.h"
571 %include "SketchAPI_Circle.h"
572 %include "SketchAPI_MacroCircle.h"
573 %include "SketchAPI_Arc.h"
574 %include "SketchAPI_MacroArc.h"
575 %include "SketchAPI_Ellipse.h"
576 %include "SketchAPI_MacroEllipse.h"
577 %include "SketchAPI_EllipticArc.h"
578 %include "SketchAPI_MacroEllipticArc.h"
579 %include "SketchAPI_BSpline.h"
580 %include "SketchAPI_Projection.h"
581 %include "SketchAPI_Mirror.h"
582 %include "SketchAPI_Translation.h"
583 %include "SketchAPI_Rectangle.h"
584 %include "SketchAPI_Rotation.h"
585 %include "SketchAPI_Sketch.h"
586 %include "SketchAPI_Constraint.h"
587 %include "SketchAPI_ConstraintAngle.h"