X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FFeaturesAPI%2FFeaturesAPI.i;h=c2fc5179589d2cc28f7f645f9ad0b9769c54019b;hb=7ae186c144dfecba2dedeaeba2b6691cef9408f8;hp=a1a7fbe1f9ff9d59c25704a4e4f2ff37a450b591;hpb=749e980caeebfe4d16441703b7028dbbb1f1d91a;p=modules%2Fshaper.git diff --git a/src/FeaturesAPI/FeaturesAPI.i b/src/FeaturesAPI/FeaturesAPI.i index a1a7fbe1f..c2fc51795 100644 --- a/src/FeaturesAPI/FeaturesAPI.i +++ b/src/FeaturesAPI/FeaturesAPI.i @@ -37,6 +37,18 @@ %include "typemaps.i" %include "std_shared_ptr.i" +// functions with named parameters +%feature("kwargs") addCommon; +%feature("kwargs") addCut; +%feature("kwargs") addFuse; +%feature("kwargs") addPartition; +%feature("kwargs") addPlacement; +%feature("kwargs") addRotation; +%feature("kwargs") addSplit; +%feature("kwargs") addSmash; +%feature("kwargs") addTranslation; +%feature("kwargs") addUnion; + // shared pointers %shared_ptr(FeaturesAPI_BooleanCut) %shared_ptr(FeaturesAPI_BooleanFuse) @@ -68,6 +80,113 @@ %shared_ptr(FeaturesAPI_Union) %shared_ptr(FeaturesAPI_FusionFaces) %shared_ptr(FeaturesAPI_RemoveResults) +%shared_ptr(FeaturesAPI_Copy) +%shared_ptr(FeaturesAPI_ImportResult) +%shared_ptr(FeaturesAPI_Defeaturing) + + +%typecheck(SWIG_TYPECHECK_POINTER) std::pair, bool>, const std::pair, bool> & { + ModelHighAPI_Selection* temp_selection; + bool* temp_bool; + int newmem = 0; + $1 = 1; + std::list temp_inputlist; + if (PySequence_Check($input)) { + for (Py_ssize_t i = 0; i < PySequence_Size($input) && $1; ++i) { + PyObject * temp = PySequence_GetItem($input, i); + + if ((SWIG_ConvertPtrAndOwn(temp, (void **)&temp_selection, $descriptor(ModelHighAPI_Selection*), SWIG_POINTER_EXCEPTION, &newmem)) == 0) { + if (temp_selection) { + $1 = 1; + } else { + $1 = 0; + } + } else { + $1 = 0; + } + } + } else if (PyBool_Check($input)) { + $1 = 1; + } else { + $1 = 0; + } +} + +%typemap(in) const std::pair, bool> & (std::pair, bool> temp) { + ModelHighAPI_Selection* temp_selection; + std::list temp_selectionlist; + int newmem = 0; + std::list temp_inputlist; + if (PySequence_Check($input)) { + for (Py_ssize_t i = 0; i < PySequence_Size($input); ++i) { + PyObject * temp = PySequence_GetItem($input, i); + + if ((SWIG_ConvertPtrAndOwn(temp, (void **)&temp_selection, $descriptor(ModelHighAPI_Selection*), SWIG_POINTER_EXCEPTION, &newmem)) == 0) { + if (temp_selection) { + temp_selectionlist.push_back(*temp_selection); + if (newmem & SWIG_CAST_NEW_MEMORY) { + delete temp_selection; + } + } + } else { + PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_Selection."); + return NULL; + } + } + temp = std::pair, bool>(temp_selectionlist, false); + } else if (PyBool_Check($input)) { + temp = std::pair, bool>(std::list(), $input == Py_True); + } else { + PyErr_SetString(PyExc_TypeError, "argument must be std::list or bool."); + return NULL; + } + $1 = &temp; +} + +// fix compilation error: 'res*' was not declared in this scope +%typemap(freearg) const std::pair, bool> & {} + + +%typecheck(SWIG_TYPECHECK_POINTER) std::pair, const std::pair & { + 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) { + $1 = 1; + } else { + $1 = 0; + } + } else { + $1 = ((PyFloat_Check($input) || PyLong_Check($input) || PyUnicode_Check($input)) && !PyBool_Check($input)) ? 1 : 0; + } +} + +%typemap(in) const std::pair & (std::pair temp) { + 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) { + temp = std::pair(*temp_selection, ModelHighAPI_Double(0.0)); + if (newmem & SWIG_CAST_NEW_MEMORY) { + delete temp_selection; + } + } + } else if (PyFloat_Check($input) || PyLong_Check($input)) { + temp = std::pair(ModelHighAPI_Selection(), ModelHighAPI_Double(PyFloat_AsDouble($input))); + } else if (PyUnicode_Check($input)) { + temp = std::pair(ModelHighAPI_Selection(), ModelHighAPI_Double(PyUnicode_AsUTF8($input))); + } else if ((SWIG_ConvertPtr($input, (void **)&$1, $1_descriptor, SWIG_POINTER_EXCEPTION)) == 0) { + temp = std::pair($1->first, $1->second); + } else { + PyErr_SetString(PyExc_ValueError, "argument must be selection, ModelHighAPI_Double, float, int or string."); + return NULL; + } + $1 = &temp; +} + +// fix compilation error: 'res*' was not declared in this scope +%typemap(freearg) const std::pair & {} + // all supported interfaces %include "FeaturesAPI_BooleanCut.h" @@ -76,6 +195,7 @@ %include "FeaturesAPI_BooleanSmash.h" %include "FeaturesAPI_BooleanFill.h" %include "FeaturesAPI_Chamfer.h" +%include "FeaturesAPI_Defeaturing.h" %include "FeaturesAPI_Extrusion.h" %include "FeaturesAPI_ExtrusionBoolean.h" %include "FeaturesAPI_Fillet.h" @@ -97,3 +217,5 @@ %include "FeaturesAPI_Union.h" %include "FeaturesAPI_FusionFaces.h" %include "FeaturesAPI_RemoveResults.h" +%include "FeaturesAPI_Copy.h" +%include "FeaturesAPI_ImportResult.h"