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