From 338e025bbe85ee0c7f5b546be0e2fb55b3530e2b Mon Sep 17 00:00:00 2001 From: spo Date: Wed, 3 Jun 2015 12:54:36 +0300 Subject: [PATCH] Fix: SWIG std::list> problem --- src/GeomAlgoAPI/GeomAlgoAPI.i | 3 +++ src/PythonAPI/modeler/sketcher.py | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/GeomAlgoAPI/GeomAlgoAPI.i b/src/GeomAlgoAPI/GeomAlgoAPI.i index f53434b4c..3c5f5a771 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI.i +++ b/src/GeomAlgoAPI/GeomAlgoAPI.i @@ -41,4 +41,7 @@ %include "GeomAlgoAPI_ShapeProps.h" %include "GeomAlgoAPI_SketchBuilder.h" +%typemap(out) std::list< std::shared_ptr< GeomAPI_Shape > >::value_type & { + $result = SWIG_NewPointerObj(SWIG_as_voidptr(new std::shared_ptr(*$1)), $descriptor(std::shared_ptr *), SWIG_POINTER_OWN | 0 ); +} %template(ShapeList) std::list >; \ No newline at end of file diff --git a/src/PythonAPI/modeler/sketcher.py b/src/PythonAPI/modeler/sketcher.py index b0b3376c5..c9737224e 100644 --- a/src/PythonAPI/modeler/sketcher.py +++ b/src/PythonAPI/modeler/sketcher.py @@ -161,10 +161,10 @@ class Sketch(): dx = geomDataAPI_Dir( self.my.data().attribute("DirX") ).dir() n = geomDataAPI_Dir( self.my.data().attribute("Norm") ).dir() - self.faces = ShapeList() # The faces are kept otherwise they are destroyed at exit - GeomAlgoAPI_SketchBuilder.createFaces(o, dx, n, self.selection, self.faces) + faces = ShapeList() # The faces are kept otherwise they are destroyed at exit + GeomAlgoAPI_SketchBuilder.createFaces(o, dx, n, self.selection, faces) #TODO: Deal with several faces - return self.faces[0] + return faces[0] def result (self): """Returns the result data of this Feature.""" -- 2.39.2