From b84d5818293669947870e13f5089cd4059014068 Mon Sep 17 00:00:00 2001 From: vsv Date: Thu, 16 Apr 2015 19:57:40 +0300 Subject: [PATCH] Edit radius with variable --- src/PartSet/PartSet_SketcherMgr.cpp | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/PartSet/PartSet_SketcherMgr.cpp b/src/PartSet/PartSet_SketcherMgr.cpp index e46d1a60c..c3c96f9f4 100644 --- a/src/PartSet/PartSet_SketcherMgr.cpp +++ b/src/PartSet/PartSet_SketcherMgr.cpp @@ -318,24 +318,25 @@ void PartSet_SketcherMgr::onMousePressed(ModuleBase_IViewWindow* theWnd, QMouseE aOperation->abort(); return; } + // Init flyout point for radius rotation + FeaturePtr aFeature = myCurrentSelection.begin().key(); if (isSketcher) { myIsDragging = true; 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); + if (aFeature.get() != NULL) { + 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 aOperation->commit(); @@ -1120,7 +1121,7 @@ void PartSet_SketcherMgr::storeSelection(const bool theHighlightedOnly) FeaturePtr aFeature = anIt.key(); getCurrentSelection(aFeature, myCurrentSketch, aWorkshop, myCurrentSelection); } - //qDebug(QString(" storeSelection: %1").arg(myCurrentSelection.size()).toStdString().c_str()); + qDebug(QString(" storeSelection: %1").arg(myCurrentSelection.size()).toStdString().c_str()); } void PartSet_SketcherMgr::restoreSelection() -- 2.39.2