6 #include "SketchAPI_swig.h"
11 // import other modules
12 %import "ModelHighAPI.i"
14 // to avoid error on this
15 #define SKETCHAPI_EXPORT
17 // standard definitions
20 %include "std_shared_ptr.i"
23 %shared_ptr(SketchAPI_Arc)
24 %shared_ptr(SketchAPI_Circle)
25 %shared_ptr(SketchAPI_IntersectionPoint)
26 %shared_ptr(SketchAPI_Line)
27 %shared_ptr(SketchAPI_Mirror)
28 %shared_ptr(SketchAPI_Sketch)
29 %shared_ptr(SketchAPI_SketchEntity)
30 %shared_ptr(SketchAPI_Point)
31 %shared_ptr(SketchAPI_Rotation)
32 %shared_ptr(SketchAPI_Translation)
34 // TODO(spo): move typemaps into ModelHighAPI package
36 // fix compilarion error: ‘res*’ was not declared in this scope
37 %typemap(freearg) const std::list<ModelHighAPI_RefAttr> & {}
38 %typemap(freearg) const std::list<std::shared_ptr<ModelAPI_Object> > & {}
40 %typemap(in) const std::list<ModelHighAPI_RefAttr> & (std::list<ModelHighAPI_RefAttr> temp) {
41 std::shared_ptr<ModelAPI_Attribute> * temp_attribute;
43 if (PySequence_Check($input)) {
44 for (Py_ssize_t i = 0; i < PySequence_Size($input); ++i) {
45 PyObject * item = PySequence_GetItem($input, i);
46 if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_attribute, $descriptor(std::shared_ptr<ModelAPI_Attribute> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
47 if (!temp_attribute) {
48 PyErr_SetString(PyExc_TypeError, "argument must be list of ModelHighAPI_RefAttr, ModelHighAPI_Interface, ModelAPI_Attribute or ModelAPI_Object.");
51 temp.push_back(ModelHighAPI_RefAttr(*temp_attribute));
52 if (newmem & SWIG_CAST_NEW_MEMORY) {
53 delete temp_attribute;
60 PyErr_SetString(PyExc_ValueError, "argument must be list of ModelHighAPI_RefAttr, ModelHighAPI_Interface, ModelAPI_Attribute or ModelAPI_Object.");
65 %typemap(in) const std::list<std::shared_ptr<ModelAPI_Object> > & (std::list<std::shared_ptr<ModelAPI_Object> > temp) {
66 std::shared_ptr<ModelAPI_Object> * temp_object;
67 std::shared_ptr<ModelHighAPI_Interface> * temp_interface;
69 if (PySequence_Check($input)) {
70 for (Py_ssize_t i = 0; i < PySequence_Size($input); ++i) {
71 PyObject * item = PySequence_GetItem($input, i);
72 if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_object, $descriptor(std::shared_ptr<ModelAPI_Object> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
74 PyErr_SetString(PyExc_TypeError, "argument must be list of ModelHighAPI_Interface or ModelAPI_Object.");
77 temp.push_back(*temp_object);
78 if (newmem & SWIG_CAST_NEW_MEMORY) {
82 if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_interface, $descriptor(std::shared_ptr<ModelHighAPI_Interface> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
83 if (!temp_interface) {
84 PyErr_SetString(PyExc_TypeError, "argument must be list of ModelHighAPI_Interface or ModelAPI_Object.");
87 temp.push_back((*temp_interface)->defaultResult());
88 if (newmem & SWIG_CAST_NEW_MEMORY) {
89 delete temp_interface;
96 PyErr_SetString(PyExc_ValueError, "argument must be list of ModelHighAPI_Interface or ModelAPI_Object.");
101 // all supported interfaces (the order is very important according dependencies: base class first)
102 %include "SketchAPI_SketchEntity.h"
103 %include "SketchAPI_Point.h"
104 %include "SketchAPI_IntersectionPoint.h"
105 %include "SketchAPI_Line.h"
106 %include "SketchAPI_Circle.h"
107 %include "SketchAPI_Arc.h"
108 %include "SketchAPI_Mirror.h"
109 %include "SketchAPI_Translation.h"
110 %include "SketchAPI_Rotation.h"
111 %include "SketchAPI_Sketch.h"