From: azv Date: Fri, 31 Mar 2017 12:00:32 +0000 (+0300) Subject: Issue #2077: mirror constraint is destroyed X-Git-Tag: V_2.7.0~115 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=07444a809f396ba009b9da3fe09ba4c5952f6a59;p=modules%2Fshaper.git Issue #2077: mirror constraint is destroyed Prohibit to move copied entities. Fix error with incorrect blocking of attribute changed event. --- 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); }