X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchPlugin%2FSketchPlugin_MultiRotation.cpp;h=90aa282a54599510dbd6e9182fa2f5130905eb30;hb=ce72dd01645885d720b731795d676e2feeabc8d6;hp=12ded259fa8d2d395b030e56e908ee3f7cd8b21a;hpb=6e421e939851e0de46554ae45a3ca0e1f67cd91d;p=modules%2Fshaper.git diff --git a/src/SketchPlugin/SketchPlugin_MultiRotation.cpp b/src/SketchPlugin/SketchPlugin_MultiRotation.cpp index 12ded259f..90aa282a5 100644 --- a/src/SketchPlugin/SketchPlugin_MultiRotation.cpp +++ b/src/SketchPlugin/SketchPlugin_MultiRotation.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2019 CEA/DEN, EDF R&D +// Copyright (C) 2014-2020 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -100,6 +100,11 @@ void SketchPlugin_MultiRotation::execute() if (isUpdateFlushed) Events_Loop::loop()->setFlushed(anUpdateEvent, false); + // Save the current feature of the document, because new features may appear while executing. + // In this case, they will become current. But if the number of copies is updated from outside + // of sketch (e.g. by parameter change), the history line should not hold in sketch. + keepCurrentFeature(); + std::shared_ptr aData = data(); AttributeRefListPtr aRefListOfShapes = std::dynamic_pointer_cast( aData->attribute(SketchPlugin_Constraint::ENTITY_A())); @@ -152,6 +157,7 @@ void SketchPlugin_MultiRotation::execute() anInitIter++; } ModelAPI_Tools::removeFeaturesAndReferences(aFeaturesToBeRemoved); + aFeaturesToBeRemoved.clear(); // change number of copies if (aCurrentNbCopies != 0 && aNbCopies != aCurrentNbCopies) { bool isAdd = aNbCopies > aCurrentNbCopies; @@ -162,7 +168,6 @@ void SketchPlugin_MultiRotation::execute() aTargetList = aRefListOfRotated->list(); aTargetIter = aTargetList.begin(); ObjectPtr anObjToCopy = *aTargetIter; - std::set aFeaturesToBeRemoved; while (aTargetIter != aTargetList.end()) { aRefListOfRotated->remove(*aTargetIter); aTargetIter++; @@ -195,6 +200,7 @@ void SketchPlugin_MultiRotation::execute() } } ModelAPI_Tools::removeFeaturesAndReferences(aFeaturesToBeRemoved); + aFeaturesToBeRemoved.clear(); for (aTargetIter = aTargetList.begin(); aTargetIter != aTargetList.end(); aTargetIter++) aRefListOfRotated->append(*aTargetIter); @@ -210,16 +216,7 @@ void SketchPlugin_MultiRotation::execute() } } -//// if (fabs(anAngle) > 1.e-12) { -//// // Recalculate positions of features -//// aTargetList = aRefListOfRotated->list(); -//// aTargetIter = aTargetList.begin(); -//// while (aTargetIter != aTargetList.end()) { -//// ObjectPtr anInitialObject = *aTargetIter++; -//// for (int i = 0; i < aNbCopies && aTargetIter != aTargetList.end(); i++, aTargetIter++) -//// rotateFeature(anInitialObject, *aTargetIter, aCenter->x(), aCenter->y(), anAngle * (i + 1)); -//// } -//// } + restoreCurrentFeature(); // send events to update the sub-features by the solver if (isUpdateFlushed)