From 2ae0a313a2a59637880f7cc0016fb589770d64ae Mon Sep 17 00:00:00 2001 From: Sergo Date: Wed, 8 Mar 2017 01:01:32 -0500 Subject: [PATCH] fix revolve and groove when no sketches in selection or when no sketches in active body --- src/Mod/PartDesign/Gui/Command.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Mod/PartDesign/Gui/Command.cpp b/src/Mod/PartDesign/Gui/Command.cpp index 5f24a6e7f6..0a7b66fd2f 100644 --- a/src/Mod/PartDesign/Gui/Command.cpp +++ b/src/Mod/PartDesign/Gui/Command.cpp @@ -724,7 +724,7 @@ void prepareProfileBased(Gui::Command* cmd, const std::string& which, Gui::Command::openCommand((std::string("Make ") + which).c_str()); Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().addObject(\"PartDesign::%s\",\"%s\")", - which.c_str(), FeatName.c_str()); + which.c_str(), FeatName.c_str()); if (feature->isDerivedFrom(Part::Part2DObject::getClassTypeId())) { Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().%s.Profile = App.activeDocument().%s", @@ -739,7 +739,12 @@ void prepareProfileBased(Gui::Command* cmd, const std::string& which, }; //if a profile is selected we can make our life easy and fast - auto selection = cmd->getSelection().getSelectionEx(0, Part::Part2DObject::getClassTypeId()); + std::vector selection; + std::string cmdName = cmd->getName(); + if (cmdName == "PartDesign_Revolution" || cmdName == "PartDesign_Groove") + selection = cmd->getSelection().getSelectionEx(0, Part::Part2DObject::getClassTypeId()); + else + selection = cmd->getSelection().getSelectionEx(); if (!selection.empty() && selection.front().hasSubNames()) { base_worker(selection.front().getObject(), selection.front().getSubNames().front()); return; @@ -774,7 +779,7 @@ void prepareProfileBased(Gui::Command* cmd, const std::string& which, return true; }; - auto sketch_worker = [&](std::vector features) { + auto sketch_worker = [&, base_worker](std::vector features) { base_worker(features.front(), ""); };