From: vsv Date: Thu, 30 May 2019 09:55:25 +0000 (+0300) Subject: Optimization of sketch plane update X-Git-Tag: VEDF2019Lot4~114^2~16 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=00e9f3fccc42555c62af487523224277ae0de237;p=modules%2Fshaper.git Optimization of sketch plane update --- diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index ee3f43ae5..f202db9f6 100644 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -1516,7 +1516,9 @@ void PartSet_Module::processEvent(const std::shared_ptr& theMess else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY)) { CompositeFeaturePtr aSketch = mySketchMgr->activeSketch(); if (aSketch.get()) { - mySketchMgr->previewSketchPlane()->createSketchPlane(aSketch, myWorkshop); + ModuleBase_Operation* anOperation = myWorkshop->currentOperation(); + if (PartSet_SketcherMgr::isSketchOperation(anOperation)) + mySketchMgr->previewSketchPlane()->createSketchPlane(aSketch, myWorkshop); } } } diff --git a/src/PartSet/PartSet_PreviewSketchPlane.cpp b/src/PartSet/PartSet_PreviewSketchPlane.cpp index 55db2ece6..43d7005ee 100644 --- a/src/PartSet/PartSet_PreviewSketchPlane.cpp +++ b/src/PartSet/PartSet_PreviewSketchPlane.cpp @@ -68,6 +68,14 @@ void PartSet_PreviewSketchPlane::createSketchPlane(const CompositeFeaturePtr& th if (!PartSet_Tools::sketchPlane(theSketch).get()) return; + AttributeSelectionPtr aSelAttr = std::dynamic_pointer_cast + (theSketch->data()->attribute(SketchPlugin_SketchEntity::EXTERNAL_ID())); + if (!aSelAttr) + return; + + if (myShape.get() && myShape->isSame(aSelAttr->value())) + return; + XGUI_Displayer* aDisp = XGUI_Tools::workshop(theWorkshop)->displayer(); if (myPreviewIsDisplayed) { aDisp->eraseAIS(myPlane, false); @@ -75,15 +83,12 @@ void PartSet_PreviewSketchPlane::createSketchPlane(const CompositeFeaturePtr& th // Create Preview // selected linear face parameters - AttributeSelectionPtr aSelAttr = std::dynamic_pointer_cast - (theSketch->data()->attribute(SketchPlugin_SketchEntity::EXTERNAL_ID())); - if (aSelAttr) { - myShape = aSelAttr->value(); - // this case is needed by constructing sketch on a plane, where result shape is equal - // to context result, therefore value() returns NULL and we should use shape of context. - if (!myShape.get() && aSelAttr->context().get()) - myShape = aSelAttr->context()->shape(); - } + myShape = aSelAttr->value(); + // this case is needed by constructing sketch on a plane, where result shape is equal + // to context result, therefore value() returns NULL and we should use shape of context. + if (!myShape.get() && aSelAttr->context().get()) + myShape = aSelAttr->context()->shape(); + if (!myShape.get()) { // Create Preview for default planes std::shared_ptr anOrigin = std::dynamic_pointer_cast(