From a4506ff138df663c281b6635cef14d1451aef6c4 Mon Sep 17 00:00:00 2001 From: vsv Date: Thu, 25 Sep 2014 12:45:10 +0400 Subject: [PATCH] Set Flyout point for circle --- .../SketchPlugin_ConstraintRadius.cpp | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/SketchPlugin/SketchPlugin_ConstraintRadius.cpp b/src/SketchPlugin/SketchPlugin_ConstraintRadius.cpp index 36ec6c384..fd429a544 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintRadius.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintRadius.cpp @@ -79,9 +79,10 @@ AISObjectPtr SketchPlugin_ConstraintRadius::getAISObject(AISObjectPtr thePreviou // Flyout point boost::shared_ptr aFlyoutAttr = boost::dynamic_pointer_cast< GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT())); - if (!aFlyoutAttr->isInitialized()) - return thePrevious; - boost::shared_ptr aFlyoutPnt = sketch()->to3D(aFlyoutAttr->x(), aFlyoutAttr->y()); + boost::shared_ptr aFlyoutPnt; + if (aFlyoutAttr->isInitialized()) { + aFlyoutPnt = sketch()->to3D(aFlyoutAttr->x(), aFlyoutAttr->y()); + } // Prepare a circle aData = aFeature->data(); @@ -93,12 +94,26 @@ AISObjectPtr SketchPlugin_ConstraintRadius::getAISObject(AISObjectPtr thePreviou AttributeDoublePtr aCircRadius = boost::dynamic_pointer_cast( aData->attribute(SketchPlugin_Circle::RADIUS_ID())); aRadius = aCircRadius->value(); + if (!aFlyoutPnt) { + double aShift = aRadius * 1.1; + boost::shared_ptr aPnt = aCenterAttr->pnt(); + boost::shared_ptr aFPnt = + boost::shared_ptr(new GeomAPI_Pnt2d(aPnt->x() + aShift, aPnt->y() + aShift)); + aFlyoutAttr->setValue(aFPnt); + aFlyoutPnt = sketch()->to3D(aFPnt->x(), aFPnt->y()); + } } else if (aKind == SketchPlugin_Arc::ID()) { aCenterAttr = boost::dynamic_pointer_cast( aData->attribute(SketchPlugin_Arc::CENTER_ID())); boost::shared_ptr aStartAttr = boost::dynamic_pointer_cast< GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Arc::START_ID())); aRadius = aCenterAttr->pnt()->distance(aStartAttr->pnt()); + if (!aFlyoutPnt) { + boost::shared_ptr aStartAttr = boost::dynamic_pointer_cast< + GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Arc::START_ID())); + aFlyoutAttr->setValue(aStartAttr->pnt()); + aFlyoutPnt = sketch()->to3D(aStartAttr->pnt()->x(), aStartAttr->pnt()->y()); + } } boost::shared_ptr aCenter = sketch()->to3D(aCenterAttr->x(), aCenterAttr->y()); -- 2.39.2