From b88e3bc4aca98808bee5a0bcccc76f11ec04a409 Mon Sep 17 00:00:00 2001 From: azv Date: Fri, 17 Apr 2015 11:45:29 +0300 Subject: [PATCH] Issue #479: Conflicting constraints on multi-coincidence with the fixed point --- .../SketchSolver_ConstraintCoincidence.cpp | 16 ++++++++++++++++ .../SketchSolver_ConstraintCoincidence.h | 4 ++++ 2 files changed, 20 insertions(+) diff --git a/src/SketchSolver/SketchSolver_ConstraintCoincidence.cpp b/src/SketchSolver/SketchSolver_ConstraintCoincidence.cpp index bfa65c19e..4f1b07f8f 100644 --- a/src/SketchSolver/SketchSolver_ConstraintCoincidence.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintCoincidence.cpp @@ -103,6 +103,22 @@ void SketchSolver_ConstraintCoincidence::addConstraint(ConstraintPtr theConstrai myExtraCoincidence[aNewConstr] = theConstraint; } +void SketchSolver_ConstraintCoincidence::process() +{ + SketchSolver_Constraint::process(); + + // Fill the list of coincident points + std::list anAttrList = + myBaseConstraint->data()->attributes(ModelAPI_AttributeRefAttr::typeId()); + std::list::iterator anIt = anAttrList.begin(); + for (; anIt != anAttrList.end(); anIt++) { + AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast(*anIt); + if (!aRefAttr || aRefAttr->isObject()) + continue; + myCoincidentPoints.insert(aRefAttr->attr()); + } +} + bool SketchSolver_ConstraintCoincidence::remove(ConstraintPtr theConstraint) { cleanErrorMsg(); diff --git a/src/SketchSolver/SketchSolver_ConstraintCoincidence.h b/src/SketchSolver/SketchSolver_ConstraintCoincidence.h index e8cbb8e40..a5c885ade 100644 --- a/src/SketchSolver/SketchSolver_ConstraintCoincidence.h +++ b/src/SketchSolver/SketchSolver_ConstraintCoincidence.h @@ -41,6 +41,10 @@ public: /// \brief Append all data of coincidence constaint to the current void attach(std::shared_ptr theConstraint); +protected: + /// \brief Converts SketchPlugin constraint to a list of SolveSpace constraints + virtual void process(); + private: /// \brief Creates new coincidence constraint Slvs_hConstraint addConstraint(Slvs_hEntity thePoint1, Slvs_hEntity thePoint2); -- 2.39.2