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