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