From fb19ea5089c4533e90b096cafecdce2b5d1167f7 Mon Sep 17 00:00:00 2001 From: wmayer Date: Tue, 6 Jan 2015 15:00:24 +0100 Subject: [PATCH] + fixes #0001870: Revolution and Groove in Part-Design do not hide the sketch and parent-feature for some geometries --- .../PartDesign/Gui/TaskGrooveParameters.cpp | 19 ++++++++++++++++++- .../Gui/TaskRevolutionParameters.cpp | 19 ++++++++++++++++++- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/src/Mod/PartDesign/Gui/TaskGrooveParameters.cpp b/src/Mod/PartDesign/Gui/TaskGrooveParameters.cpp index 9e83c07b9..f6e0bbad6 100644 --- a/src/Mod/PartDesign/Gui/TaskGrooveParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskGrooveParameters.cpp @@ -288,7 +288,18 @@ void TaskDlgGrooveParameters::clicked(int) bool TaskDlgGrooveParameters::accept() { - std::string name = GrooveView->getObject()->getNameInDocument(); + App::DocumentObject* groove = GrooveView->getObject(); + std::string name = groove->getNameInDocument(); + + // retrieve sketch and its support object + App::DocumentObject* sketch = 0; + App::DocumentObject* support = 0; + if (groove->getTypeId().isDerivedFrom(PartDesign::Groove::getClassTypeId())) { + sketch = static_cast(groove)->Sketch.getValue(); + if (sketch) { + support = static_cast(sketch)->Support.getValue(); + } + } //Gui::Command::openCommand("Groove changed"); Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Angle = %f",name.c_str(),parameter->getAngle()); @@ -297,6 +308,12 @@ bool TaskDlgGrooveParameters::accept() Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Midplane = %i",name.c_str(),parameter->getMidplane()?1:0); Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Reversed = %i",name.c_str(),parameter->getReversed()?1:0); Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.recompute()"); + if (groove->isValid()) { + if (sketch) + Gui::Command::doCommand(Gui::Command::Gui,"Gui.activeDocument().hide(\"%s\")",sketch->getNameInDocument()); + if (support) + Gui::Command::doCommand(Gui::Command::Gui,"Gui.activeDocument().hide(\"%s\")",support->getNameInDocument()); + } Gui::Command::doCommand(Gui::Command::Gui,"Gui.activeDocument().resetEdit()"); Gui::Command::commitCommand(); diff --git a/src/Mod/PartDesign/Gui/TaskRevolutionParameters.cpp b/src/Mod/PartDesign/Gui/TaskRevolutionParameters.cpp index 696ffe826..3d88170a0 100644 --- a/src/Mod/PartDesign/Gui/TaskRevolutionParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskRevolutionParameters.cpp @@ -288,7 +288,18 @@ void TaskDlgRevolutionParameters::clicked(int) bool TaskDlgRevolutionParameters::accept() { - std::string name = RevolutionView->getObject()->getNameInDocument(); + App::DocumentObject* revolve = RevolutionView->getObject(); + std::string name = revolve->getNameInDocument(); + + // retrieve sketch and its support object + App::DocumentObject* sketch = 0; + App::DocumentObject* support = 0; + if (revolve->getTypeId().isDerivedFrom(PartDesign::Revolution::getClassTypeId())) { + sketch = static_cast(revolve)->Sketch.getValue(); + if (sketch) { + support = static_cast(sketch)->Support.getValue(); + } + } //Gui::Command::openCommand("Revolution changed"); Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Angle = %f",name.c_str(),parameter->getAngle()); @@ -297,6 +308,12 @@ bool TaskDlgRevolutionParameters::accept() Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Midplane = %i",name.c_str(),parameter->getMidplane()?1:0); Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Reversed = %i",name.c_str(),parameter->getReversed()?1:0); Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.recompute()"); + if (revolve->isValid()) { + if (sketch) + Gui::Command::doCommand(Gui::Command::Gui,"Gui.activeDocument().hide(\"%s\")",sketch->getNameInDocument()); + if (support) + Gui::Command::doCommand(Gui::Command::Gui,"Gui.activeDocument().hide(\"%s\")",support->getNameInDocument()); + } Gui::Command::doCommand(Gui::Command::Gui,"Gui.activeDocument().resetEdit()"); Gui::Command::commitCommand();