From 07444a809f396ba009b9da3fe09ba4c5952f6a59 Mon Sep 17 00:00:00 2001 From: azv Date: Fri, 31 Mar 2017 15:00:32 +0300 Subject: [PATCH] Issue #2077: mirror constraint is destroyed Prohibit to move copied entities. Fix error with incorrect blocking of attribute changed event. --- src/SketchSolver/SketchSolver_ConstraintFixed.cpp | 9 +++++++++ src/SketchSolver/SketchSolver_ConstraintMirror.cpp | 13 +++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/SketchSolver/SketchSolver_ConstraintFixed.cpp b/src/SketchSolver/SketchSolver_ConstraintFixed.cpp index 721efb4a1..3ee49eccf 100644 --- a/src/SketchSolver/SketchSolver_ConstraintFixed.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintFixed.cpp @@ -8,6 +8,7 @@ #include #include +#include #include @@ -125,6 +126,14 @@ void SketchSolver_ConstraintFixed::getAttributes( std::vector& theAttributes) { if (myBaseFeature) { + // if the feature is copy, do not move it + std::shared_ptr aSketchFeature = + std::dynamic_pointer_cast(myBaseFeature); + if (aSketchFeature && aSketchFeature->isCopy()) { + myStorage->setNeedToResolve(true); + return; + } + // The feature is fixed. EntityWrapperPtr aSolverEntity = getChangedEntity(myBaseFeature, myStorage); myStorage->update(myBaseFeature); diff --git a/src/SketchSolver/SketchSolver_ConstraintMirror.cpp b/src/SketchSolver/SketchSolver_ConstraintMirror.cpp index b338983ca..80cb647d8 100644 --- a/src/SketchSolver/SketchSolver_ConstraintMirror.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintMirror.cpp @@ -86,8 +86,7 @@ void SketchSolver_ConstraintMirror::process() void SketchSolver_ConstraintMirror::update() { cleanErrorMsg(); - remove(); - process(); + adjustConstraint(); } void SketchSolver_ConstraintMirror::adjustConstraint() @@ -132,6 +131,16 @@ void SketchSolver_ConstraintMirror::blockEvents(bool isBlocked) for (; anIt != myFeatures.end(); ++anIt) (*anIt)->data()->blockSendAttributeUpdated(isBlocked); + AttributeRefListPtr aMirroredRefList = + myBaseConstraint->reflist(SketchPlugin_Constraint::ENTITY_C()); + std::list aMirroredList = aMirroredRefList->list(); + std::list::iterator aMIt = aMirroredList.begin(); + for (; aMIt != aMirroredList.end(); ++aMIt) { + FeaturePtr aMirrored = ModelAPI_Feature::feature(*aMIt); + aMirrored->data()->blockSendAttributeUpdated(isBlocked); + } + + SketchSolver_Constraint::blockEvents(isBlocked); } -- 2.39.2