]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #3052: Conflicting constraint after trim ellipse
authorazv <azv@opencascade.com>
Fri, 18 Oct 2019 12:36:35 +0000 (15:36 +0300)
committerazv <azv@opencascade.com>
Mon, 21 Oct 2019 08:03:09 +0000 (11:03 +0300)
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

index 33ff36ab46b71cc56dd2d72fac4bcc3fc47d65ba..b7d0535dbda926736024358be4e355e0f6a20c59 100644 (file)
@@ -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<ObjectPtr>::const_iterator anIt = anInfo.second.begin();
+             anIt != anInfo.second.end() && !isEdge; ++anIt) {
+          ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(*anIt);
+          if (aResult) {
+            GeomShapePtr aShape = aResult->shape();
+            isEdge = aShape && aShape->isEdge();
+          }
+        }
+        if (isEdge)
+          break;
       }
     }
     const std::list<ObjectPtr>& anObjects = anInfo.second;