From 58cd2cdf0944265453f410cc533fb389793a3a4a Mon Sep 17 00:00:00 2001 From: nds Date: Thu, 7 Apr 2016 13:11:14 +0300 Subject: [PATCH] Issue #1343. Improvement of Extrusion and Revolution operations: correction for case: plane selection filter is ignored in Sketch started under Extrusion --- src/PartSet/PartSet_SketcherMgr.cpp | 13 ++++--------- src/PartSet/PartSet_Tools.cpp | 3 ++- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/PartSet/PartSet_SketcherMgr.cpp b/src/PartSet/PartSet_SketcherMgr.cpp index 5aefe05ee..22c4b653a 100755 --- a/src/PartSet/PartSet_SketcherMgr.cpp +++ b/src/PartSet/PartSet_SketcherMgr.cpp @@ -891,18 +891,13 @@ void PartSet_SketcherMgr::startSketch(ModuleBase_Operation* theOperation) myModule->workshop()->viewer()->addSelectionFilter(myPlaneFilter); bool aHasPlane = false; std::shared_ptr aPln; - if (aFOperation->isEditOperation()) { - // If it is editing of sketch then it means that plane is already defined - aPln = PartSet_Tools::sketchPlane(myCurrentSketch); - if (aPln.get()) - aHasPlane = true; - } + aPln = PartSet_Tools::sketchPlane(myCurrentSketch); myPlaneFilter->setPlane(aPln); Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); - // all sketch objects should be activated in the sketch selection modes by edit operation start - // in case of creation operation, there is an active widget, which activates own selection mode - if (aFOperation->isEditOperation() && aHasPlane) + // all displayed objects should be activated in current selection modes according to switched + // plane filter + if (aPln.get()) aConnector->activateModuleSelectionModes(); } diff --git a/src/PartSet/PartSet_Tools.cpp b/src/PartSet/PartSet_Tools.cpp index 96e50d7ac..48a5c6a1c 100755 --- a/src/PartSet/PartSet_Tools.cpp +++ b/src/PartSet/PartSet_Tools.cpp @@ -397,7 +397,8 @@ std::shared_ptr PartSet_Tools::sketchPlane(CompositeFeaturePtr theS aData->attribute(SketchPlugin_Sketch::ORIGIN_ID())); std::shared_ptr aNormal = std::dynamic_pointer_cast( aData->attribute(SketchPlugin_Sketch::NORM_ID())); - if (aNormal && anOrigin) { + if (aNormal.get() && aNormal->isInitialized() && + anOrigin.get() && anOrigin->isInitialized()) { double adX = aNormal->x(); double adY = aNormal->y(); double adZ = aNormal->z(); -- 2.39.2