6 #include "SketchAPI_swig.h"
7 #include "ModelHighAPI_swig.h"
10 #define SWIGPY_SLICE_ARG(obj) ((PySliceObject*)(obj))
15 // import other modules
17 %import "ModelHighAPI.i"
19 // to avoid error on this
20 #define SKETCHAPI_EXPORT
22 // standard definitions
25 %include "std_shared_ptr.i"
28 %shared_ptr(SketchAPI_Arc)
29 %shared_ptr(SketchAPI_MacroArc)
30 %shared_ptr(SketchAPI_Circle)
31 %shared_ptr(SketchAPI_MacroCircle)
32 %shared_ptr(SketchAPI_Constraint)
33 %shared_ptr(SketchAPI_IntersectionPoint)
34 %shared_ptr(SketchAPI_Line)
35 %shared_ptr(SketchAPI_Mirror)
36 %shared_ptr(SketchAPI_Sketch)
37 %shared_ptr(SketchAPI_SketchEntity)
38 %shared_ptr(SketchAPI_Point)
39 %shared_ptr(SketchAPI_Projection)
40 %shared_ptr(SketchAPI_Rectangle)
41 %shared_ptr(SketchAPI_Rotation)
42 %shared_ptr(SketchAPI_Translation)
45 %template(InterfaceList) std::list<std::shared_ptr<ModelHighAPI_Interface> >;
46 %template(EntityList) std::list<std::shared_ptr<SketchAPI_SketchEntity> >;
48 %typecheck(SWIG_TYPECHECK_POINTER) std::shared_ptr<ModelAPI_Feature>, const std::shared_ptr<ModelAPI_Feature> & {
49 std::shared_ptr<ModelAPI_Feature> * temp_feature;
50 std::shared_ptr<ModelHighAPI_Interface> * temp_interface;
52 if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_feature, $descriptor(std::shared_ptr<ModelAPI_Feature> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
59 if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_interface, $descriptor(std::shared_ptr<ModelHighAPI_Interface> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
69 %typemap(in) const std::shared_ptr<ModelAPI_Feature> & (std::shared_ptr<ModelAPI_Feature> temp) {
70 std::shared_ptr<ModelAPI_Feature> * temp_feature;
71 std::shared_ptr<ModelHighAPI_Interface> * temp_interface;
73 if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_feature, $descriptor(std::shared_ptr<ModelAPI_Feature> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
75 PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_Interface.");
78 temp = (*temp_feature);
79 if (newmem & SWIG_CAST_NEW_MEMORY) {
84 if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_interface, $descriptor(std::shared_ptr<ModelHighAPI_Interface> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
85 if (!temp_interface) {
86 PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_Interface.");
89 temp = (*temp_interface)->feature();
90 if (newmem & SWIG_CAST_NEW_MEMORY) {
91 delete temp_interface;
95 if ((SWIG_ConvertPtr($input, (void **)&$1, $1_descriptor, SWIG_POINTER_EXCEPTION)) == 0) {
97 PyErr_SetString(PyExc_ValueError, "argument must be ModelHighAPI_Interface.");
102 %typemap(in) const ModelHighAPI_RefAttr & (ModelHighAPI_RefAttr temp) {
103 std::shared_ptr<ModelAPI_Attribute> * temp_attribute;
104 std::shared_ptr<ModelAPI_Object> * temp_object;
105 std::shared_ptr<ModelHighAPI_Interface> * temp_interface;
106 ModelHighAPI_Selection* temp_selection;
108 if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_selection, $descriptor(ModelHighAPI_Selection*), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
109 if (!temp_selection) {
110 PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_RefAttr, ModelHighAPI_Selection, ModelHighAPI_Interface, ModelAPI_Attribute or ModelAPI_Object.");
113 temp = ModelHighAPI_RefAttr(std::shared_ptr<ModelAPI_Object>(temp_selection->resultSubShapePair().first));
114 if (newmem & SWIG_CAST_NEW_MEMORY) {
115 delete temp_selection;
119 if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_attribute, $descriptor(std::shared_ptr<ModelAPI_Attribute> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
120 if (!temp_attribute) {
121 PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_RefAttr, ModelHighAPI_Selection, ModelHighAPI_Interface, ModelAPI_Attribute or ModelAPI_Object.");
124 temp = ModelHighAPI_RefAttr(*temp_attribute);
125 if (newmem & SWIG_CAST_NEW_MEMORY) {
126 delete temp_attribute;
130 if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_object, $descriptor(std::shared_ptr<ModelAPI_Object> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
132 PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_RefAttr, ModelHighAPI_Selection, ModelHighAPI_Interface, ModelAPI_Attribute or ModelAPI_Object.");
135 temp = ModelHighAPI_RefAttr(*temp_object);
136 if (newmem & SWIG_CAST_NEW_MEMORY) {
141 if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_interface, $descriptor(std::shared_ptr<ModelHighAPI_Interface> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
142 if (!temp_interface) {
143 PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_RefAttr, ModelHighAPI_Selection, ModelHighAPI_Interface, ModelAPI_Attribute or ModelAPI_Object.");
146 temp = ModelHighAPI_RefAttr(*temp_interface);
147 if (newmem & SWIG_CAST_NEW_MEMORY) {
148 delete temp_interface;
152 if ((SWIG_ConvertPtr($input, (void **)&$1, $1_descriptor, SWIG_POINTER_EXCEPTION)) == 0) {
154 PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_RefAttr, ModelHighAPI_Selection, ModelHighAPI_Interface, ModelAPI_Attribute or ModelAPI_Object.");
159 %typemap(in) const std::list<std::shared_ptr<ModelAPI_Object> > & (std::list<std::shared_ptr<ModelAPI_Object> > temp) {
160 std::shared_ptr<ModelAPI_Object> * temp_object;
161 std::shared_ptr<ModelHighAPI_Interface> * temp_interface;
162 ModelHighAPI_Selection* temp_selection;
164 if (PySequence_Check($input)) {
165 for (Py_ssize_t i = 0; i < PySequence_Size($input); ++i) {
166 PyObject * item = PySequence_GetItem($input, i);
167 if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_selection, $descriptor(ModelHighAPI_Selection*), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
168 if (!temp_selection) {
169 PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_Interface, ModelHighAPI_Selection or ModelAPI_Object.");
172 temp.push_back(temp_selection->resultSubShapePair().first);
173 if (newmem & SWIG_CAST_NEW_MEMORY) {
174 delete temp_selection;
177 if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_object, $descriptor(std::shared_ptr<ModelAPI_Object> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
179 PyErr_SetString(PyExc_TypeError, "argument must be list of ModelHighAPI_Interface, ModelHighAPI_Selection or ModelAPI_Object.");
182 temp.push_back(*temp_object);
183 if (newmem & SWIG_CAST_NEW_MEMORY) {
187 if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_interface, $descriptor(std::shared_ptr<ModelHighAPI_Interface> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
188 if (!temp_interface) {
189 PyErr_SetString(PyExc_TypeError, "argument must be list of ModelHighAPI_Interface, ModelHighAPI_Selection or ModelAPI_Object.");
192 temp.push_back((*temp_interface)->defaultResult());
193 if (newmem & SWIG_CAST_NEW_MEMORY) {
194 delete temp_interface;
201 PyErr_SetString(PyExc_ValueError, "argument must be list of ModelHighAPI_Interface or ModelAPI_Object.");
206 // all supported interfaces (the order is very important according dependencies: base class first)
207 %include "SketchAPI_SketchEntity.h"
208 %include "SketchAPI_Point.h"
209 %include "SketchAPI_IntersectionPoint.h"
210 %include "SketchAPI_Line.h"
211 %include "SketchAPI_Circle.h"
212 %include "SketchAPI_MacroCircle.h"
213 %include "SketchAPI_Arc.h"
214 %include "SketchAPI_MacroArc.h"
215 %include "SketchAPI_Projection.h"
216 %include "SketchAPI_Mirror.h"
217 %include "SketchAPI_Translation.h"
218 %include "SketchAPI_Rectangle.h"
219 %include "SketchAPI_Rotation.h"
220 %include "SketchAPI_Sketch.h"
221 %include "SketchAPI_Constraint.h"