From: azv Date: Tue, 14 Apr 2015 05:45:31 +0000 (+0300) Subject: Issue #393: Make fixed feature movable X-Git-Tag: V_1.1.0~35 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f123cb42293b018c34dcd29ecdcbef3ab85041d1;p=modules%2Fshaper.git Issue #393: Make fixed feature movable --- diff --git a/src/SketchSolver/SketchSolver_ConstraintRigid.cpp b/src/SketchSolver/SketchSolver_ConstraintRigid.cpp index 3483973fe..49fded073 100644 --- a/src/SketchSolver/SketchSolver_ConstraintRigid.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintRigid.cpp @@ -35,17 +35,23 @@ void SketchSolver_ConstraintRigid::process() if (!myErrorMsg.empty() || myFeatureMap.empty()) return; + Slvs_hEntity anEntID = myFeatureMap.begin()->second; + if (myStorage->isEntityFixed(anEntID, true)) { + myErrorMsg = SketchSolver_Error::ALREADY_FIXED(); + return; + } + if (myFeatureMap.begin()->first->getKind() == SketchPlugin_Line::ID()) { - Slvs_Entity aLine = myStorage->getEntity(myFeatureMap.begin()->second); + Slvs_Entity aLine = myStorage->getEntity(anEntID); fixLine(aLine); } else if (myFeatureMap.begin()->first->getKind() == SketchPlugin_Arc::ID()) { - Slvs_Entity anArc = myStorage->getEntity(myFeatureMap.begin()->second); + Slvs_Entity anArc = myStorage->getEntity(anEntID); fixArc(anArc); } else if (myFeatureMap.begin()->first->getKind() == SketchPlugin_Circle::ID()) { - Slvs_Entity aCirc = myStorage->getEntity(myFeatureMap.begin()->second); - fixArc(aCirc); + Slvs_Entity aCirc = myStorage->getEntity(anEntID); + fixCircle(aCirc); } } diff --git a/src/SketchSolver/SketchSolver_Error.h b/src/SketchSolver/SketchSolver_Error.h index e0446b558..0ae33d3c6 100644 --- a/src/SketchSolver/SketchSolver_Error.h +++ b/src/SketchSolver/SketchSolver_Error.h @@ -59,6 +59,12 @@ class SketchSolver_Error static const std::string MY_ERROR_VALUE("Mirror constraint has wrong attributes"); return MY_ERROR_VALUE; } + /// Entity is already fixed + inline static const std::string& ALREADY_FIXED() + { + static const std::string MY_ERROR_VALUE("Entity already fixed"); + return MY_ERROR_VALUE; + } /// Crash in SolveSpace inline static const std::string& SOLVESPACE_CRASH() { diff --git a/src/SketchSolver/SketchSolver_Group.cpp b/src/SketchSolver/SketchSolver_Group.cpp index 58d822786..9a4623428 100644 --- a/src/SketchSolver/SketchSolver_Group.cpp +++ b/src/SketchSolver/SketchSolver_Group.cpp @@ -278,7 +278,8 @@ void SketchSolver_Group::moveFeature(std::shared_ptr theFe return; aConstraint->setGroup(this); aConstraint->setStorage(myStorage); - setTemporary(aConstraint); + if (aConstraint->error().empty()) + setTemporary(aConstraint); } // ============================================================================