From ed4b5fa20ff109765df155b62de64617ab1db214 Mon Sep 17 00:00:00 2001 From: vsv Date: Thu, 16 Apr 2015 15:51:54 +0300 Subject: [PATCH] Create radius dimension --- src/PartSet/PartSet_SketcherMgr.cpp | 11 +++++++++++ src/SketcherPrs/SketcherPrs_Radius.cpp | 17 +++++++++-------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/PartSet/PartSet_SketcherMgr.cpp b/src/PartSet/PartSet_SketcherMgr.cpp index cb1250a76..e46d1a60c 100644 --- a/src/PartSet/PartSet_SketcherMgr.cpp +++ b/src/PartSet/PartSet_SketcherMgr.cpp @@ -324,6 +324,17 @@ void PartSet_SketcherMgr::onMousePressed(ModuleBase_IViewWindow* theWnd, QMouseE get2dPoint(theWnd, theEvent, myCurrentPoint); myDragDone = false; launchEditing(); + // Init flyout point for radius rotation + FeaturePtr aFeature = myCurrentSelection.begin().key(); + std::shared_ptr aSPFeature = + std::dynamic_pointer_cast(aFeature); + if (aSPFeature->getKind() == SketchPlugin_ConstraintRadius::ID()) { + DataPtr aData = aSPFeature->data(); + AttributePtr aAttr = aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()); + std::shared_ptr aFPAttr = + std::dynamic_pointer_cast(aAttr); + aFPAttr->setValue(myCurrentPoint.myCurX, myCurrentPoint.myCurY); + } } else if (isSketchOpe && isEditing) { // If selected another object commit current result diff --git a/src/SketcherPrs/SketcherPrs_Radius.cpp b/src/SketcherPrs/SketcherPrs_Radius.cpp index 6f3988036..5d7135e06 100644 --- a/src/SketcherPrs/SketcherPrs_Radius.cpp +++ b/src/SketcherPrs/SketcherPrs_Radius.cpp @@ -84,14 +84,15 @@ void SketcherPrs_Radius::Compute(const Handle(PrsMgr_PresentationManager3d)& the GeomAPI_Circ aCircle(aCenter, aNormal, aRadius); - std::shared_ptr anAnchor = aCircle.project(aFlyoutPnt); - std::shared_ptr anAnchorXYZ = anAnchor->xyz(); - anAnchorXYZ = anAnchorXYZ->decreased(aCenter->xyz()); - std::shared_ptr aDeltaDir(new GeomAPI_Dir(anAnchorXYZ)); - const double aDelta = 1e-3; - anAnchor->setX(anAnchor->x() + aDelta * aDeltaDir->x()); - anAnchor->setY(anAnchor->y() + aDelta * aDeltaDir->y()); - anAnchor->setZ(anAnchor->z() + aDelta * aDeltaDir->z()); + std::shared_ptr anAnchor = SketcherPrs_Tools::getAnchorPoint(myConstraint, myPlane); + //std::shared_ptr anAnchor = aCircle.project(aFlyoutPnt); + //std::shared_ptr anAnchorXYZ = anAnchor->xyz(); + //anAnchorXYZ = anAnchorXYZ->decreased(aCenter->xyz()); + //std::shared_ptr aDeltaDir(new GeomAPI_Dir(anAnchorXYZ)); + //const double aDelta = 1e-3; + //anAnchor->setX(anAnchor->x() + aDelta * aDeltaDir->x()); + //anAnchor->setY(anAnchor->y() + aDelta * aDeltaDir->y()); + //anAnchor->setZ(anAnchor->z() + aDelta * aDeltaDir->z()); SetMeasuredGeometry(aCircle.impl(), anAnchor->impl()); SetCustomValue(aRadius); -- 2.39.2