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_Constraint)
26 %shared_ptr(SketchAPI_IntersectionPoint)
27 %shared_ptr(SketchAPI_Line)
28 %shared_ptr(SketchAPI_Mirror)
29 %shared_ptr(SketchAPI_Sketch)
30 %shared_ptr(SketchAPI_SketchEntity)
31 %shared_ptr(SketchAPI_Point)
32 %shared_ptr(SketchAPI_Projection)
33 %shared_ptr(SketchAPI_Rectangle)
34 %shared_ptr(SketchAPI_Rotation)
35 %shared_ptr(SketchAPI_Translation)
37 %typemap(in) const ModelHighAPI_RefAttr & (ModelHighAPI_RefAttr temp) {
38 std::shared_ptr<ModelAPI_Attribute> * temp_attribute;
39 std::shared_ptr<ModelAPI_Object> * temp_object;
40 std::shared_ptr<ModelHighAPI_Interface> * temp_interface;
41 ModelHighAPI_Selection* temp_selection;
43 if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_selection, $descriptor(ModelHighAPI_Selection*), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
44 if (!temp_selection) {
45 PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_RefAttr, ModelHighAPI_Selection, ModelHighAPI_Interface, ModelAPI_Attribute or ModelAPI_Object.");
48 temp = ModelHighAPI_RefAttr(std::shared_ptr<ModelAPI_Object>(temp_selection->resultSubShapePair().first));
49 if (newmem & SWIG_CAST_NEW_MEMORY) {
50 delete temp_selection;
54 if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_attribute, $descriptor(std::shared_ptr<ModelAPI_Attribute> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
55 if (!temp_attribute) {
56 PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_RefAttr, ModelHighAPI_Selection, ModelHighAPI_Interface, ModelAPI_Attribute or ModelAPI_Object.");
59 temp = ModelHighAPI_RefAttr(*temp_attribute);
60 if (newmem & SWIG_CAST_NEW_MEMORY) {
61 delete temp_attribute;
65 if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_object, $descriptor(std::shared_ptr<ModelAPI_Object> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
67 PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_RefAttr, ModelHighAPI_Selection, ModelHighAPI_Interface, ModelAPI_Attribute or ModelAPI_Object.");
70 temp = ModelHighAPI_RefAttr(*temp_object);
71 if (newmem & SWIG_CAST_NEW_MEMORY) {
76 if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_interface, $descriptor(std::shared_ptr<ModelHighAPI_Interface> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
77 if (!temp_interface) {
78 PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_RefAttr, ModelHighAPI_Selection, ModelHighAPI_Interface, ModelAPI_Attribute or ModelAPI_Object.");
81 temp = ModelHighAPI_RefAttr(*temp_interface);
82 if (newmem & SWIG_CAST_NEW_MEMORY) {
83 delete temp_interface;
87 if ((SWIG_ConvertPtr($input, (void **)&$1, $1_descriptor, SWIG_POINTER_EXCEPTION)) == 0) {
89 PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_RefAttr, ModelHighAPI_Selection, ModelHighAPI_Interface, ModelAPI_Attribute or ModelAPI_Object.");
94 %typemap(in) const std::list<std::shared_ptr<ModelAPI_Object> > & (std::list<std::shared_ptr<ModelAPI_Object> > temp) {
95 std::shared_ptr<ModelAPI_Object> * temp_object;
96 std::shared_ptr<ModelHighAPI_Interface> * temp_interface;
97 ModelHighAPI_Selection* temp_selection;
99 if (PySequence_Check($input)) {
100 for (Py_ssize_t i = 0; i < PySequence_Size($input); ++i) {
101 PyObject * item = PySequence_GetItem($input, i);
102 if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_selection, $descriptor(ModelHighAPI_Selection*), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
103 if (!temp_selection) {
104 PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_Interface, ModelHighAPI_Selection or ModelAPI_Object.");
107 temp.push_back(temp_selection->resultSubShapePair().first);
108 if (newmem & SWIG_CAST_NEW_MEMORY) {
109 delete temp_selection;
112 if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_object, $descriptor(std::shared_ptr<ModelAPI_Object> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
114 PyErr_SetString(PyExc_TypeError, "argument must be list of ModelHighAPI_Interface, ModelHighAPI_Selection or ModelAPI_Object.");
117 temp.push_back(*temp_object);
118 if (newmem & SWIG_CAST_NEW_MEMORY) {
122 if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_interface, $descriptor(std::shared_ptr<ModelHighAPI_Interface> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
123 if (!temp_interface) {
124 PyErr_SetString(PyExc_TypeError, "argument must be list of ModelHighAPI_Interface, ModelHighAPI_Selection or ModelAPI_Object.");
127 temp.push_back((*temp_interface)->defaultResult());
128 if (newmem & SWIG_CAST_NEW_MEMORY) {
129 delete temp_interface;
136 PyErr_SetString(PyExc_ValueError, "argument must be list of ModelHighAPI_Interface or ModelAPI_Object.");
141 // all supported interfaces (the order is very important according dependencies: base class first)
142 %include "SketchAPI_SketchEntity.h"
143 %include "SketchAPI_Point.h"
144 %include "SketchAPI_IntersectionPoint.h"
145 %include "SketchAPI_Line.h"
146 %include "SketchAPI_Circle.h"
147 %include "SketchAPI_Arc.h"
148 %include "SketchAPI_Projection.h"
149 %include "SketchAPI_Mirror.h"
150 %include "SketchAPI_Translation.h"
151 %include "SketchAPI_Rectangle.h"
152 %include "SketchAPI_Rotation.h"
153 %include "SketchAPI_Sketch.h"
154 %include "SketchAPI_Constraint.h"