From be64ac512378281d54e4a73e8edb68ae43d0c5a7 Mon Sep 17 00:00:00 2001 From: azv Date: Fri, 18 Oct 2019 15:36:35 +0300 Subject: [PATCH] Issue #3052: Conflicting constraint after trim ellipse Prefer make coincident the boundary of the trimmed feature with an edge instead of point, because it decreases only 1 DoF. --- src/SketchPlugin/SketchPlugin_Trim.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/SketchPlugin/SketchPlugin_Trim.cpp b/src/SketchPlugin/SketchPlugin_Trim.cpp index 33ff36ab4..b7d0535db 100644 --- a/src/SketchPlugin/SketchPlugin_Trim.cpp +++ b/src/SketchPlugin/SketchPlugin_Trim.cpp @@ -372,7 +372,19 @@ void SketchPlugin_Trim::execute() { if (aRefIt->first->isEqual(aPoint)) { anInfo = aRefIt->second; - break; + // prefer a segment instead of a point, because further coincidence with a segment + // decreases only 1 DoF (instead of 2 for point) and prevents an overconstraint situation. + bool isEdge = false; + for (std::list::const_iterator anIt = anInfo.second.begin(); + anIt != anInfo.second.end() && !isEdge; ++anIt) { + ResultPtr aResult = std::dynamic_pointer_cast(*anIt); + if (aResult) { + GeomShapePtr aShape = aResult->shape(); + isEdge = aShape && aShape->isEdge(); + } + } + if (isEdge) + break; } } const std::list& anObjects = anInfo.second; -- 2.39.2