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