From e7a96ac26f5eeff47c0b47b250f3df4e01504d4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Tr=C3=B6ger?= Date: Sat, 8 Aug 2015 15:08:35 +0200 Subject: [PATCH] fix body booleans --- src/Mod/PartDesign/Gui/Command.cpp | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/src/Mod/PartDesign/Gui/Command.cpp b/src/Mod/PartDesign/Gui/Command.cpp index 93abbf32a..214857722 100644 --- a/src/Mod/PartDesign/Gui/Command.cpp +++ b/src/Mod/PartDesign/Gui/Command.cpp @@ -1839,37 +1839,28 @@ CmdPartDesignBoolean::CmdPartDesignBoolean() void CmdPartDesignBoolean::activated(int iMsg) { + PartDesign::Body *pcActiveBody = PartDesignGui::getBody(/*messageIfNot = */true); + if (!pcActiveBody) return; + Gui::SelectionFilter BodyFilter("SELECT PartDesign::Body COUNT 1.."); - PartDesign::Body* body; + PartDesign::Body* body = nullptr; std::string bodyString(""); if (BodyFilter.match()) { body = static_cast(BodyFilter.Result[0][0].getObject()); std::vector bodies; std::vector >::iterator i = BodyFilter.Result.begin(); - i++; for (; i != BodyFilter.Result.end(); i++) { for (std::vector::iterator j = i->begin(); j != i->end(); j++) { - bodies.push_back(j->getObject()); + if(j->getObject() != pcActiveBody) + bodies.push_back(j->getObject()); } } bodyString = PartDesignGui::buildLinkListPythonStr(bodies); - } else { - QMessageBox::warning(Gui::getMainWindow(), QObject::tr("No body selected"), - QObject::tr("Please select a body for the boolean operation")); - return; } openCommand("Create Boolean"); - PartDesign::Body* activeBody = Gui::Application::Instance->activeView()->getActiveObject(PDBODYKEY); - // Make sure we are working on the selected body - if (body != activeBody) { - Gui::Selection().clearSelection(); - Gui::Selection().addSelection(body->getDocument()->getName(), body->Tip.getValue()->getNameInDocument()); - Gui::Command::doCommand(Gui::Command::Gui,"FreeCADGui.runCommand('PartDesign_MoveTip')"); - } - std::string FeatName = getUniqueObjectName("Boolean"); doCommand(Doc,"App.activeDocument().addObject('PartDesign::Boolean','%s')",FeatName.c_str());