From d23e603b4e37a632f75eaceff75ce21adbd6174c Mon Sep 17 00:00:00 2001 From: usakhelo Date: Mon, 13 Mar 2017 16:13:36 -0400 Subject: [PATCH] fix groove --- src/Mod/PartDesign/Gui/Command.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/Mod/PartDesign/Gui/Command.cpp b/src/Mod/PartDesign/Gui/Command.cpp index b4002651b3e4..f3c7d3176da1 100644 --- a/src/Mod/PartDesign/Gui/Command.cpp +++ b/src/Mod/PartDesign/Gui/Command.cpp @@ -999,7 +999,7 @@ void CmdPartDesignRevolution::activated(int iMsg) return; Gui::Command* cmd = this; - auto worker = [this, cmd, pcActiveBody](Part::Feature* sketch, std::string FeatName) { + auto worker = [this, cmd, &pcActiveBody](Part::Feature* sketch, std::string FeatName) { if (FeatName.empty()) return; @@ -1059,12 +1059,19 @@ void CmdPartDesignGroove::activated(int iMsg) return; Gui::Command* cmd = this; - auto worker = [this, cmd](Part::Feature* sketch, std::string FeatName) { + auto worker = [this, cmd, &pcActiveBody](Part::Feature* sketch, std::string FeatName) { if (FeatName.empty()) return; - Gui::Command::doCommand(Doc,"App.activeDocument().%s.ReferenceAxis = (App.activeDocument().%s,['V_Axis'])", - FeatName.c_str(), sketch->getNameInDocument()); + if (sketch->isDerivedFrom(Part::Part2DObject::getClassTypeId())) { + Gui::Command::doCommand(Doc, "App.activeDocument().%s.ReferenceAxis = (App.activeDocument().%s,['V_Axis'])", + FeatName.c_str(), sketch->getNameInDocument()); + } + else { + Gui::Command::doCommand(Doc, "App.activeDocument().%s.ReferenceAxis = (App.activeDocument().%s,[\"\"])", + FeatName.c_str(), pcActiveBody->getOrigin()->getY()->getNameInDocument()); + } + Gui::Command::doCommand(Doc,"App.activeDocument().%s.Angle = 360.0",FeatName.c_str()); PartDesign::Groove* pcGroove = static_cast(cmd->getDocument()->getObject(FeatName.c_str())); if (pcGroove && pcGroove->suggestReversed())