]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/SketchPlugin/SketchPlugin_Arc.cpp
Salome HOME
Allow arc parameters to be recalculated by sketch solver
[modules/shaper.git] / src / SketchPlugin / SketchPlugin_Arc.cpp
index 1890400ce34dec026540fe287b3b2ae79d0f8f3e..0dac256a86de36f03ecb8112087fd267a97fd520 100644 (file)
@@ -222,31 +222,25 @@ void SketchPlugin_Arc::attributeChanged(const std::string& theID)
       return;
     std::shared_ptr<GeomAPI_Circ2d> aCircleForArc(new GeomAPI_Circ2d(aCenter, aStart));
 
-    bool aWasBlocked = data()->blockSendAttributeUpdated(true);
-    // The Arc end point is projected
-    // on the circle formed by center and start points
+    // Do not recalculate REVERSED flag if the arc is not consistent
     std::shared_ptr<GeomAPI_Pnt2d> aProjection = aCircleForArc->project(anEnd);
-    if (aProjection && anEnd->distance(aProjection) > tolerance) {
-      anEndAttr->setValue(aProjection);
-      anEnd = aProjection;
-    }
-    data()->blockSendAttributeUpdated(aWasBlocked, false);
-
-    double aParameterNew = 0.0;
-    if(aCircleForArc->parameter(anEnd, paramTolerance, aParameterNew)) {
-      bool aWasBlocked = data()->blockSendAttributeUpdated(true);
-      if(myParamBefore <= PI / 2.0 && aParameterNew >= PI * 1.5) {
-        if(!boolean(REVERSED_ID())->value()) {
-          boolean(REVERSED_ID())->setValue(true);
-        }
-      } else if(myParamBefore >= PI * 1.5 && aParameterNew <= PI / 2.0) {
-        if(boolean(REVERSED_ID())->value()) {
-          boolean(REVERSED_ID())->setValue(false);
+    if (aProjection && anEnd->distance(aProjection) <= tolerance) {
+      double aParameterNew = 0.0;
+      if(aCircleForArc->parameter(anEnd, paramTolerance, aParameterNew)) {
+        bool aWasBlocked = data()->blockSendAttributeUpdated(true);
+        if(myParamBefore <= PI / 2.0 && aParameterNew >= PI * 1.5) {
+          if(!boolean(REVERSED_ID())->value()) {
+            boolean(REVERSED_ID())->setValue(true);
+          }
+        } else if(myParamBefore >= PI * 1.5 && aParameterNew <= PI / 2.0) {
+          if(boolean(REVERSED_ID())->value()) {
+            boolean(REVERSED_ID())->setValue(false);
+          }
         }
+        data()->blockSendAttributeUpdated(aWasBlocked, false);
       }
-      data()->blockSendAttributeUpdated(aWasBlocked, false);
+      myParamBefore = aParameterNew;
     }
-    myParamBefore = aParameterNew;
   }
 
   double aRadius = 0;