From: azv Date: Fri, 18 Dec 2015 05:16:30 +0000 (+0300) Subject: Update for correct movement of sketch elements, when the sketch contains arcs and... X-Git-Tag: V_2.1.0~145 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=35f780e05b0abb99b7ae43c5bbbbe438d7a273a2;p=modules%2Fshaper.git Update for correct movement of sketch elements, when the sketch contains arcs and coincidences. --- diff --git a/src/SketchSolver/SketchSolver_Storage.cpp b/src/SketchSolver/SketchSolver_Storage.cpp index af6b022be..8db3eaa5c 100644 --- a/src/SketchSolver/SketchSolver_Storage.cpp +++ b/src/SketchSolver/SketchSolver_Storage.cpp @@ -50,7 +50,7 @@ void SketchSolver_Storage::addEntity(FeaturePtr theFeature, EntityWrapperPtr theSolverEntity) { std::map::const_iterator aFound = myFeatureMap.find(theFeature); - if (aFound == myFeatureMap.end() || !aFound->second->isEqual(theSolverEntity)) + if (aFound == myFeatureMap.end() || !aFound->second || !aFound->second->isEqual(theSolverEntity)) setNeedToResolve(true); // the entity is new or modified myFeatureMap[theFeature] = theSolverEntity; @@ -60,7 +60,7 @@ void SketchSolver_Storage::addEntity(AttributePtr theAttribute, EntityWrapperPtr theSolverEntity) { std::map::const_iterator aFound = myAttributeMap.find(theAttribute); - if (aFound == myAttributeMap.end() || !aFound->second->isEqual(theSolverEntity)) + if (aFound == myAttributeMap.end() || !aFound->second || !aFound->second->isEqual(theSolverEntity)) setNeedToResolve(true); // the entity is new or modified myAttributeMap[theAttribute] = theSolverEntity; diff --git a/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Solver.cpp b/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Solver.cpp index de1cc3edd..a46a7c0b3 100644 --- a/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Solver.cpp +++ b/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Solver.cpp @@ -82,8 +82,8 @@ void SolveSpaceSolver_Solver::setConstraints(Slvs_Constraint* theConstraints, in SketchSolver_SolveStatus SolveSpaceSolver_Solver::solve() { - if (myEquationsSystem.constraints <= 0) - return STATUS_EMPTYSET; + //if (myEquationsSystem.constraints <= 0) + // return STATUS_EMPTYSET; myEquationsSystem.calculateFaileds = myFindFaileds ? 1 : 0; diff --git a/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Storage.cpp b/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Storage.cpp index c8113afb8..5fe40328e 100644 --- a/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Storage.cpp +++ b/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Storage.cpp @@ -19,6 +19,7 @@ #include #include #include +#include /** \brief Search the entity/parameter with specified ID in the list of elements * \param[in] theEntityID unique ID of the element @@ -174,7 +175,18 @@ bool SolveSpaceSolver_Storage::update(EntityWrapperPtr& theEntity) if (anEntity->type() == ENTITY_SKETCH) storeWorkplane(anEntity); + + // For the correct work with arcs we will add them if their parameter is added + if (theEntity->baseAttribute()) { + FeaturePtr aFeature = ModelAPI_Feature::feature(theEntity->baseAttribute()->owner()); + if (aFeature->getKind() == SketchPlugin_Arc::ID() && + myFeatureMap.find(aFeature) == myFeatureMap.end()) { + myFeatureMap[aFeature] = EntityWrapperPtr(); + return SketchSolver_Storage::update(aFeature, myGroupID); + } + } } + return isUpdated; }