From: azv Date: Fri, 4 Mar 2016 06:21:51 +0000 (+0300) Subject: Prohibit creation of tangent arc on same points (issue #1336) X-Git-Tag: V_2.2.0~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=67c5d6f074d25d661cba6b93a7437651ffba798b;p=modules%2Fshaper.git Prohibit creation of tangent arc on same points (issue #1336) --- diff --git a/src/SketchPlugin/SketchPlugin_Validators.cpp b/src/SketchPlugin/SketchPlugin_Validators.cpp index 1110db427..6b4b55c92 100755 --- a/src/SketchPlugin/SketchPlugin_Validators.cpp +++ b/src/SketchPlugin/SketchPlugin_Validators.cpp @@ -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(aRefAttr->owner()); + std::shared_ptr anEndPoint = std::dynamic_pointer_cast( + anArc->attribute(SketchPlugin_Arc::END_ID())); + if (anEndPoint->isInitialized()) { + std::shared_ptr aTangPt = + std::dynamic_pointer_cast(anAttr); + if (aTangPt->pnt()->distance(anEndPoint->pnt()) < tolerance) { + theError = "Unable to build arc on same points"; + return false; + } + } + return true; }