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