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