From 2732872dd73bbc93a33bce53067c81245b55c0a4 Mon Sep 17 00:00:00 2001 From: mpv Date: Thu, 9 Jul 2015 15:24:05 +0300 Subject: [PATCH] Fix for Box Macro crash --- src/Model/Model_Objects.cpp | 4 +++- src/PythonAPI/modeler/extrusion.py | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Model/Model_Objects.cpp b/src/Model/Model_Objects.cpp index 1f15f72c2..b6ebc0869 100644 --- a/src/Model/Model_Objects.cpp +++ b/src/Model/Model_Objects.cpp @@ -118,10 +118,12 @@ void Model_Objects::addFeature(FeaturePtr theFeature, const FeaturePtr theAfterT } AddToRefArray(aFeaturesLab, aFeatureLab, aPrevFeateureLab); - initData(theFeature, aFeatureLab, TAG_FEATURE_ARGUMENTS); // keep the feature ID to restore document later correctly TDataStd_Comment::Set(aFeatureLab, theFeature->getKind().c_str()); myFeatures.Bind(aFeatureLab, theFeature); + // must be after binding to the map because of "Box" macro feature that + // creates other features in "initData" + initData(theFeature, aFeatureLab, TAG_FEATURE_ARGUMENTS); // event: feature is added static Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_CREATED); ModelAPI_EventCreator::get()->sendUpdated(theFeature, anEvent); diff --git a/src/PythonAPI/modeler/extrusion.py b/src/PythonAPI/modeler/extrusion.py index 3cea7291d..9b9b6de32 100644 --- a/src/PythonAPI/modeler/extrusion.py +++ b/src/PythonAPI/modeler/extrusion.py @@ -11,6 +11,7 @@ class Extrusion(): def __init__ (self, part, sketch, size): """Inserts an extrusion of the given Sketch to the given Part and executes the operation.""" self.my = part.addFeature("Extrusion") + self.my.string("CreationMethod").setValue("BySizes") self.my.data().selectionList("base").append(sketch.result(), sketch.buildShape()) if size < 0: self.my.data().real("from_size").setValue(-size) -- 2.39.2