From: azv Date: Tue, 16 Aug 2016 09:12:04 +0000 (+0300) Subject: Dump Python in the High Level Parameterized Geometry API (issue #1648) X-Git-Tag: V_2.5.0~137^2~40 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c805537232d2c4e40e89cc4c659d1345cb8d9956;p=modules%2Fshaper.git Dump Python in the High Level Parameterized Geometry API (issue #1648) * Convert ModelHighAPI_Selection to ModelHighAPI_RefAttr --- diff --git a/src/SketchAPI/SketchAPI.i b/src/SketchAPI/SketchAPI.i index eff688fa3..c81ea84ef 100644 --- a/src/SketchAPI/SketchAPI.i +++ b/src/SketchAPI/SketchAPI.i @@ -34,6 +34,63 @@ %shared_ptr(SketchAPI_Rotation) %shared_ptr(SketchAPI_Translation) +%typemap(in) const ModelHighAPI_RefAttr & (ModelHighAPI_RefAttr temp) { + std::shared_ptr * temp_attribute; + std::shared_ptr * temp_object; + std::shared_ptr * temp_interface; + ModelHighAPI_Selection* temp_selection; + int newmem = 0; + if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_selection, $descriptor(ModelHighAPI_Selection*), SWIG_POINTER_EXCEPTION, &newmem)) == 0) { + if (!temp_selection) { + PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_RefAttr, ModelHighAPI_Selection, ModelHighAPI_Interface, ModelAPI_Attribute or ModelAPI_Object."); + return NULL; + } + temp = ModelHighAPI_RefAttr(temp_selection->resultSubShapePair().first); + if (newmem & SWIG_CAST_NEW_MEMORY) { + delete temp_selection; + } + $1 = &temp; + } else + if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_attribute, $descriptor(std::shared_ptr *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) { + if (!temp_attribute) { + PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_RefAttr, ModelHighAPI_Selection, ModelHighAPI_Interface, ModelAPI_Attribute or ModelAPI_Object."); + return NULL; + } + temp = ModelHighAPI_RefAttr(*temp_attribute); + if (newmem & SWIG_CAST_NEW_MEMORY) { + delete temp_attribute; + } + $1 = &temp; + } else + if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_object, $descriptor(std::shared_ptr *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) { + if (!temp_object) { + PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_RefAttr, ModelHighAPI_Selection, ModelHighAPI_Interface, ModelAPI_Attribute or ModelAPI_Object."); + return NULL; + } + temp = ModelHighAPI_RefAttr(*temp_object); + if (newmem & SWIG_CAST_NEW_MEMORY) { + delete temp_object; + } + $1 = &temp; + } else + if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_interface, $descriptor(std::shared_ptr *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) { + if (!temp_interface) { + PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_RefAttr, ModelHighAPI_Selection, ModelHighAPI_Interface, ModelAPI_Attribute or ModelAPI_Object."); + return NULL; + } + temp = ModelHighAPI_RefAttr(*temp_interface); + if (newmem & SWIG_CAST_NEW_MEMORY) { + delete temp_interface; + } + $1 = &temp; + } else + if ((SWIG_ConvertPtr($input, (void **)&$1, $1_descriptor, SWIG_POINTER_EXCEPTION)) == 0) { + } else { + PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_RefAttr, ModelHighAPI_Selection, ModelHighAPI_Interface, ModelAPI_Attribute or ModelAPI_Object."); + return NULL; + } +} + // all supported interfaces (the order is very important according dependencies: base class first) %include "SketchAPI_SketchEntity.h" %include "SketchAPI_Point.h"