From: azv Date: Thu, 9 Apr 2015 05:25:57 +0000 (+0300) Subject: Update for properly work with Length constraint X-Git-Tag: V_1.1.0~52^2~8 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=caa079890d75a6f34a9c544558cec3e752e29b08;p=modules%2Fshaper.git Update for properly work with Length constraint --- diff --git a/src/SketchSolver/SketchSolver_ConstraintLength.cpp b/src/SketchSolver/SketchSolver_ConstraintLength.cpp index 3d1d1bf22..bf519342b 100644 --- a/src/SketchSolver/SketchSolver_ConstraintLength.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintLength.cpp @@ -34,3 +34,9 @@ void SketchSolver_ConstraintLength::process() adjustConstraint(); } +void SketchSolver_ConstraintLength::adjustConstraint() +{ + // No need to store the line, which length is constrained + myFeatureMap.clear(); +} + diff --git a/src/SketchSolver/SketchSolver_ConstraintLength.h b/src/SketchSolver/SketchSolver_ConstraintLength.h index 5d0583752..7f91d7e3a 100644 --- a/src/SketchSolver/SketchSolver_ConstraintLength.h +++ b/src/SketchSolver/SketchSolver_ConstraintLength.h @@ -27,6 +27,10 @@ public: protected: /// \brief Converts SketchPlugin constraint to a list of SolveSpace constraints virtual void process(); + + /// \brief This method is used in derived objects to check consistence of constraint. + /// E.g. the distance between line and point may be signed. + virtual void adjustConstraint(); }; #endif diff --git a/src/SketchSolver/SketchSolver_Storage.cpp b/src/SketchSolver/SketchSolver_Storage.cpp index 1690d7d56..d4a517132 100644 --- a/src/SketchSolver/SketchSolver_Storage.cpp +++ b/src/SketchSolver/SketchSolver_Storage.cpp @@ -151,19 +151,13 @@ bool SketchSolver_Storage::removeEntity(const Slvs_hEntity& theEntityID) if (anEntIter->distance == theEntityID) return false; } - std::set anEntAndSubs; - anEntAndSubs.insert(theEntityID); - for (int i = 0; i < 4; i++) - if (myEntities[aPos].point[i] != SLVS_E_UNKNOWN) - anEntAndSubs.insert(myEntities[aPos].point[i]); - std::vector::const_iterator aConstrIter = myConstraints.begin(); for (; aConstrIter != myConstraints.end(); aConstrIter++) { Slvs_hEntity anEntIDs[6] = {aConstrIter->ptA, aConstrIter->ptB, aConstrIter->entityA, aConstrIter->entityB, aConstrIter->entityC, aConstrIter->entityD}; for (int i = 0; i < 6; i++) - if (anEntAndSubs.find(anEntIDs[i]) != anEntAndSubs.end()) + if (anEntIDs[i] == theEntityID) return false; } // The entity is not used, remove it and its parameters