]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Prohibit creation of tangent arc on same points (issue #1336)
authorazv <azv@opencascade.com>
Fri, 4 Mar 2016 06:21:51 +0000 (09:21 +0300)
committerazv <azv@opencascade.com>
Fri, 4 Mar 2016 06:22:45 +0000 (09:22 +0300)
src/SketchPlugin/SketchPlugin_Validators.cpp

index 1110db427cbbfc69de07925d6d025687b6bc089a..6b4b55c9276e0e7eccf423d9e4edc8941dd53bf3 100755 (executable)
@@ -752,6 +752,19 @@ bool SketchPlugin_ArcTangentPointValidator::isValid(const AttributePtr& theAttri
     return false;
   }
 
+  // Check the tangent point is equal to arc end
+  FeaturePtr anArc = std::dynamic_pointer_cast<ModelAPI_Feature>(aRefAttr->owner());
+  std::shared_ptr<GeomDataAPI_Point2D> anEndPoint = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+      anArc->attribute(SketchPlugin_Arc::END_ID()));
+  if (anEndPoint->isInitialized()) {
+    std::shared_ptr<GeomDataAPI_Point2D> aTangPt =
+        std::dynamic_pointer_cast<GeomDataAPI_Point2D>(anAttr);
+    if (aTangPt->pnt()->distance(anEndPoint->pnt()) < tolerance) {
+      theError = "Unable to build arc on same points";
+      return false;
+    }
+  }
+
   return true;
 }