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_Circle)
30 %shared_ptr(SketchAPI_Constraint)
31 %shared_ptr(SketchAPI_IntersectionPoint)
32 %shared_ptr(SketchAPI_Line)
33 %shared_ptr(SketchAPI_Mirror)
34 %shared_ptr(SketchAPI_Sketch)
35 %shared_ptr(SketchAPI_SketchEntity)
36 %shared_ptr(SketchAPI_Point)
37 %shared_ptr(SketchAPI_Projection)
38 %shared_ptr(SketchAPI_Rectangle)
39 %shared_ptr(SketchAPI_Rotation)
40 %shared_ptr(SketchAPI_Translation)
43 %template(InterfaceList) std::list<std::shared_ptr<ModelHighAPI_Interface> >;
44 %template(EntityList) std::list<std::shared_ptr<SketchAPI_SketchEntity> >;
46 %typecheck(SWIG_TYPECHECK_POINTER) std::shared_ptr<ModelAPI_Feature>, const std::shared_ptr<ModelAPI_Feature> & {
47 std::shared_ptr<ModelAPI_Feature> * temp_feature;
48 std::shared_ptr<ModelHighAPI_Interface> * temp_interface;
50 if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_feature, $descriptor(std::shared_ptr<ModelAPI_Feature> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
57 if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_interface, $descriptor(std::shared_ptr<ModelHighAPI_Interface> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
67 %typemap(in) const std::shared_ptr<ModelAPI_Feature> & (std::shared_ptr<ModelAPI_Feature> temp) {
68 std::shared_ptr<ModelAPI_Feature> * temp_feature;
69 std::shared_ptr<ModelHighAPI_Interface> * temp_interface;
71 if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_feature, $descriptor(std::shared_ptr<ModelAPI_Feature> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
73 PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_Interface.");
76 temp = (*temp_feature);
77 if (newmem & SWIG_CAST_NEW_MEMORY) {
82 if ((SWIG_ConvertPtrAndOwn($input, (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 ModelHighAPI_Interface.");
87 temp = (*temp_interface)->feature();
88 if (newmem & SWIG_CAST_NEW_MEMORY) {
89 delete temp_interface;
93 if ((SWIG_ConvertPtr($input, (void **)&$1, $1_descriptor, SWIG_POINTER_EXCEPTION)) == 0) {
95 PyErr_SetString(PyExc_ValueError, "argument must be ModelHighAPI_Interface.");
100 %typemap(in) const ModelHighAPI_RefAttr & (ModelHighAPI_RefAttr temp) {
101 std::shared_ptr<ModelAPI_Attribute> * temp_attribute;
102 std::shared_ptr<ModelAPI_Object> * temp_object;
103 std::shared_ptr<ModelHighAPI_Interface> * temp_interface;
104 ModelHighAPI_Selection* temp_selection;
106 if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_selection, $descriptor(ModelHighAPI_Selection*), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
107 if (!temp_selection) {
108 PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_RefAttr, ModelHighAPI_Selection, ModelHighAPI_Interface, ModelAPI_Attribute or ModelAPI_Object.");
111 temp = ModelHighAPI_RefAttr(std::shared_ptr<ModelAPI_Object>(temp_selection->resultSubShapePair().first));
112 if (newmem & SWIG_CAST_NEW_MEMORY) {
113 delete temp_selection;
117 if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_attribute, $descriptor(std::shared_ptr<ModelAPI_Attribute> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
118 if (!temp_attribute) {
119 PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_RefAttr, ModelHighAPI_Selection, ModelHighAPI_Interface, ModelAPI_Attribute or ModelAPI_Object.");
122 temp = ModelHighAPI_RefAttr(*temp_attribute);
123 if (newmem & SWIG_CAST_NEW_MEMORY) {
124 delete temp_attribute;
128 if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_object, $descriptor(std::shared_ptr<ModelAPI_Object> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
130 PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_RefAttr, ModelHighAPI_Selection, ModelHighAPI_Interface, ModelAPI_Attribute or ModelAPI_Object.");
133 temp = ModelHighAPI_RefAttr(*temp_object);
134 if (newmem & SWIG_CAST_NEW_MEMORY) {
139 if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_interface, $descriptor(std::shared_ptr<ModelHighAPI_Interface> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
140 if (!temp_interface) {
141 PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_RefAttr, ModelHighAPI_Selection, ModelHighAPI_Interface, ModelAPI_Attribute or ModelAPI_Object.");
144 temp = ModelHighAPI_RefAttr(*temp_interface);
145 if (newmem & SWIG_CAST_NEW_MEMORY) {
146 delete temp_interface;
150 if ((SWIG_ConvertPtr($input, (void **)&$1, $1_descriptor, SWIG_POINTER_EXCEPTION)) == 0) {
152 PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_RefAttr, ModelHighAPI_Selection, ModelHighAPI_Interface, ModelAPI_Attribute or ModelAPI_Object.");
157 %typemap(in) const std::list<std::shared_ptr<ModelAPI_Object> > & (std::list<std::shared_ptr<ModelAPI_Object> > temp) {
158 std::shared_ptr<ModelAPI_Object> * temp_object;
159 std::shared_ptr<ModelHighAPI_Interface> * temp_interface;
160 ModelHighAPI_Selection* temp_selection;
162 if (PySequence_Check($input)) {
163 for (Py_ssize_t i = 0; i < PySequence_Size($input); ++i) {
164 PyObject * item = PySequence_GetItem($input, i);
165 if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_selection, $descriptor(ModelHighAPI_Selection*), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
166 if (!temp_selection) {
167 PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_Interface, ModelHighAPI_Selection or ModelAPI_Object.");
170 temp.push_back(temp_selection->resultSubShapePair().first);
171 if (newmem & SWIG_CAST_NEW_MEMORY) {
172 delete temp_selection;
175 if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_object, $descriptor(std::shared_ptr<ModelAPI_Object> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
177 PyErr_SetString(PyExc_TypeError, "argument must be list of ModelHighAPI_Interface, ModelHighAPI_Selection or ModelAPI_Object.");
180 temp.push_back(*temp_object);
181 if (newmem & SWIG_CAST_NEW_MEMORY) {
185 if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_interface, $descriptor(std::shared_ptr<ModelHighAPI_Interface> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
186 if (!temp_interface) {
187 PyErr_SetString(PyExc_TypeError, "argument must be list of ModelHighAPI_Interface, ModelHighAPI_Selection or ModelAPI_Object.");
190 temp.push_back((*temp_interface)->defaultResult());
191 if (newmem & SWIG_CAST_NEW_MEMORY) {
192 delete temp_interface;
199 PyErr_SetString(PyExc_ValueError, "argument must be list of ModelHighAPI_Interface or ModelAPI_Object.");
204 // all supported interfaces (the order is very important according dependencies: base class first)
205 %include "SketchAPI_SketchEntity.h"
206 %include "SketchAPI_Point.h"
207 %include "SketchAPI_IntersectionPoint.h"
208 %include "SketchAPI_Line.h"
209 %include "SketchAPI_Circle.h"
210 %include "SketchAPI_Arc.h"
211 %include "SketchAPI_Projection.h"
212 %include "SketchAPI_Mirror.h"
213 %include "SketchAPI_Translation.h"
214 %include "SketchAPI_Rectangle.h"
215 %include "SketchAPI_Rotation.h"
216 %include "SketchAPI_Sketch.h"
217 %include "SketchAPI_Constraint.h"