From: azv Date: Fri, 18 Oct 2019 12:36:35 +0000 (+0300) Subject: Issue #3052: Conflicting constraint after trim ellipse X-Git-Tag: V9_5_0a1~167^2~27 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=be64ac512378281d54e4a73e8edb68ae43d0c5a7;p=modules%2Fshaper.git 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. --- 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;