]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #2190: Sketcher : 2 successive circles having the same center (the origin)
authorazv <azv@opencascade.com>
Wed, 14 Jun 2017 12:07:34 +0000 (15:07 +0300)
committerazv <azv@opencascade.com>
Wed, 14 Jun 2017 12:07:34 +0000 (15:07 +0300)
Improve calculating of intermediate circle if the center is coincident with another point.

src/SketchPlugin/SketchPlugin_MacroCircle.cpp

index c2c47a60ecb60e01b02508782ddca0d82138431f..2b6829c729a7f62aa6058e1698f71e9dd6e1ad25 100644 (file)
@@ -227,10 +227,15 @@ void SketchPlugin_MacroCircle::fillByCenterAndPassed()
   if (!aCenterAttr->isInitialized() || !aPassedAttr->isInitialized())
     return;
 
-  AttributeRefAttrPtr aPassedRef = refattr(PASSED_POINT_REF_ID());
   // Calculate circle parameters
-  std::shared_ptr<GeomAPI_Pnt2d> aCenter =
-      std::dynamic_pointer_cast<GeomDataAPI_Point2D>(aCenterAttr)->pnt();
+  AttributeRefAttrPtr aCenterRef = refattr(CENTER_POINT_REF_ID());
+  std::shared_ptr<GeomAPI_Pnt2d> aCenter;
+  std::shared_ptr<GeomAPI_Shape> aCurve;
+  SketchPlugin_Tools::convertRefAttrToPointOrTangentCurve(
+      aCenterRef, aCenterAttr, aCurve, aCenter);
+  if (!aCenter)
+    aCenter = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(aCenterAttr)->pnt();
+  AttributeRefAttrPtr aPassedRef = refattr(PASSED_POINT_REF_ID());
   std::shared_ptr<GeomAPI_Pnt2d> aPassedPoint;
   std::shared_ptr<GeomAPI_Shape> aTangentCurve;
   SketchPlugin_Tools::convertRefAttrToPointOrTangentCurve(