From 8e8ae7ea1f566f320bc38ed819ce03fc5dc55e73 Mon Sep 17 00:00:00 2001 From: mpv Date: Mon, 2 Mar 2015 15:08:24 +0300 Subject: [PATCH] Roll back the Compisite feature: too serious swig problem --- src/ModelAPI/ModelAPI.i | 1 + .../PythonFeaturesPlugin_Box.py | 21 +------------------ src/PythonFeaturesPlugin/extrusion.py | 2 ++ 3 files changed, 4 insertions(+), 20 deletions(-) diff --git a/src/ModelAPI/ModelAPI.i b/src/ModelAPI/ModelAPI.i index a6956f156..ff4b9e7ad 100644 --- a/src/ModelAPI/ModelAPI.i +++ b/src/ModelAPI/ModelAPI.i @@ -63,6 +63,7 @@ %feature("director") ModelAPI_Plugin; %feature("director") ModelAPI_Object; %feature("director") ModelAPI_Feature; +%feature("director") ModelAPI_CompositeFeature; %feature("director") ModelAPI_Data; // shared pointers diff --git a/src/PythonFeaturesPlugin/PythonFeaturesPlugin_Box.py b/src/PythonFeaturesPlugin/PythonFeaturesPlugin_Box.py index d84e3394f..a8b79c9ea 100644 --- a/src/PythonFeaturesPlugin/PythonFeaturesPlugin_Box.py +++ b/src/PythonFeaturesPlugin/PythonFeaturesPlugin_Box.py @@ -5,7 +5,7 @@ import extrusion import sketch -class PythonFeaturesPlugin_Box(ModelAPI.ModelAPI_CompositeFeature): +class PythonFeaturesPlugin_Box(ModelAPI.ModelAPI_Feature): "Feature to create a box by drawing a sketch and extruding it" @@ -123,25 +123,6 @@ class PythonFeaturesPlugin_Box(ModelAPI.ModelAPI_CompositeFeature): self.reference(self.HEIGHT_REF_ID()).setValue(aHeightFeature.firstResult()) return aHeightFeature - def addFeature(self, theID): - pass - - def numberOfSubs(self): - # extrusion and sketch - return 2 - - def subFeature(self, theIndex): - if theIndex = 1: # sketch - return self.mySketch - return self.myExtrusion - - def subFeatureId(self, theIndex): - return 0 - - def isSub(self, theFeature): - if theFeature = self.mySketch or theFeature = self.myExtrusion: - return True - return False # TEST """ diff --git a/src/PythonFeaturesPlugin/extrusion.py b/src/PythonFeaturesPlugin/extrusion.py index 9008479a0..225bd9e12 100644 --- a/src/PythonFeaturesPlugin/extrusion.py +++ b/src/PythonFeaturesPlugin/extrusion.py @@ -5,6 +5,8 @@ def addNew(builder, length, part, edges=None, reverse=False): feature = part.addFeature("Extrusion") feature.selection("extrusion_face").setValue(builder.geometry(), builder.face()) + if length < 0.0000001: + length = 50 feature.real("extrusion_size").setValue(length) feature.boolean("extrusion_reverse").setValue(reverse) feature.execute() -- 2.39.2