Bug fixes for Body feature insert/remove functionality
This commit is contained in:
parent
3e4986f163
commit
ee47c53339
|
@ -257,16 +257,20 @@ void Body::removeFeature(App::DocumentObject* feature)
|
|||
if (tipFeature == feature) {
|
||||
// Set the Tip to the previous feature if possible, otherwise to the next feature
|
||||
std::vector<App::DocumentObject*>::const_iterator prev = it, next = it;
|
||||
prev--;
|
||||
next++;
|
||||
if (it != model.begin()) {
|
||||
prev--;
|
||||
next++;
|
||||
|
||||
if (prev != model.end()) {
|
||||
Tip.setValue(*prev);
|
||||
if (prev != model.end()) {
|
||||
Tip.setValue(*prev);
|
||||
} else {
|
||||
if (next != model.end())
|
||||
Tip.setValue(*next);
|
||||
else
|
||||
Tip.setValue(NULL);
|
||||
}
|
||||
} else {
|
||||
if (next != model.end())
|
||||
Tip.setValue(*next);
|
||||
else
|
||||
Tip.setValue(NULL);
|
||||
Tip.setValue(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,8 @@
|
|||
#include <Gui/Command.h>
|
||||
#include <Mod/PartDesign/App/FeatureGroove.h>
|
||||
#include <Mod/Sketcher/App/SketchObject.h>
|
||||
|
||||
#include <Mod/PartDesign/App/Body.h>
|
||||
#include "Workbench.h"
|
||||
|
||||
using namespace PartDesignGui;
|
||||
using namespace Gui;
|
||||
|
@ -336,6 +337,19 @@ bool TaskDlgGrooveParameters::reject()
|
|||
pcSupport = pcSketch->Support.getValue();
|
||||
}
|
||||
|
||||
// Body housekeeping
|
||||
if (ActivePartObject != NULL) {
|
||||
ActivePartObject->removeFeature(pcGroove);
|
||||
// Make the new Tip and the previous solid feature visible again
|
||||
App::DocumentObject* tip = ActivePartObject->Tip.getValue();
|
||||
App::DocumentObject* prev = ActivePartObject->getPrevSolidFeature();
|
||||
if (tip != NULL) {
|
||||
Gui::Application::Instance->getViewProvider(tip)->show();
|
||||
if ((tip != prev) && (prev != NULL))
|
||||
Gui::Application::Instance->getViewProvider(prev)->show();
|
||||
}
|
||||
}
|
||||
|
||||
// role back the done things
|
||||
Gui::Command::abortCommand();
|
||||
Gui::Command::doCommand(Gui::Command::Gui,"Gui.activeDocument().resetEdit()");
|
||||
|
|
|
@ -45,7 +45,9 @@
|
|||
#include <Gui/Command.h>
|
||||
#include <Mod/PartDesign/App/FeaturePad.h>
|
||||
#include <Mod/Sketcher/App/SketchObject.h>
|
||||
#include <Mod/PartDesign/App/Body.h>
|
||||
#include "ReferenceSelection.h"
|
||||
#include "Workbench.h"
|
||||
|
||||
using namespace PartDesignGui;
|
||||
using namespace Gui;
|
||||
|
@ -553,6 +555,19 @@ bool TaskDlgPadParameters::reject()
|
|||
pcSketch = static_cast<Sketcher::SketchObject*>(pcPad->Sketch.getValue());
|
||||
}
|
||||
|
||||
// Body housekeeping
|
||||
if (ActivePartObject != NULL) {
|
||||
ActivePartObject->removeFeature(pcPad);
|
||||
// Make the new Tip and the previous solid feature visible again
|
||||
App::DocumentObject* tip = ActivePartObject->Tip.getValue();
|
||||
App::DocumentObject* prev = ActivePartObject->getPrevSolidFeature();
|
||||
if (tip != NULL) {
|
||||
Gui::Application::Instance->getViewProvider(tip)->show();
|
||||
if ((tip != prev) && (prev != NULL))
|
||||
Gui::Application::Instance->getViewProvider(prev)->show();
|
||||
}
|
||||
}
|
||||
|
||||
// roll back the done things
|
||||
Gui::Command::abortCommand();
|
||||
Gui::Command::doCommand(Gui::Command::Gui,"Gui.activeDocument().resetEdit()");
|
||||
|
|
|
@ -46,7 +46,9 @@
|
|||
#include <Gui/Command.h>
|
||||
#include <Mod/PartDesign/App/FeaturePocket.h>
|
||||
#include <Mod/Sketcher/App/SketchObject.h>
|
||||
#include <Mod/PartDesign/App/Body.h>
|
||||
#include "ReferenceSelection.h"
|
||||
#include "Workbench.h"
|
||||
|
||||
using namespace PartDesignGui;
|
||||
using namespace Gui;
|
||||
|
@ -499,6 +501,19 @@ bool TaskDlgPocketParameters::reject()
|
|||
pcSupport = pcSketch->Support.getValue();
|
||||
}
|
||||
|
||||
// Body housekeeping
|
||||
if (ActivePartObject != NULL) {
|
||||
ActivePartObject->removeFeature(pcPocket);
|
||||
// Make the new Tip and the previous solid feature visible again
|
||||
App::DocumentObject* tip = ActivePartObject->Tip.getValue();
|
||||
App::DocumentObject* prev = ActivePartObject->getPrevSolidFeature();
|
||||
if (tip != NULL) {
|
||||
Gui::Application::Instance->getViewProvider(tip)->show();
|
||||
if ((tip != prev) && (prev != NULL))
|
||||
Gui::Application::Instance->getViewProvider(prev)->show();
|
||||
}
|
||||
}
|
||||
|
||||
// roll back the done things
|
||||
Gui::Command::abortCommand();
|
||||
Gui::Command::doCommand(Gui::Command::Gui,"Gui.activeDocument().resetEdit()");
|
||||
|
|
|
@ -41,6 +41,8 @@
|
|||
#include <Gui/Command.h>
|
||||
#include <Mod/PartDesign/App/FeatureRevolution.h>
|
||||
#include <Mod/Sketcher/App/SketchObject.h>
|
||||
#include <Mod/PartDesign/App/Body.h>
|
||||
#include "Workbench.h"
|
||||
|
||||
|
||||
using namespace PartDesignGui;
|
||||
|
@ -336,6 +338,19 @@ bool TaskDlgRevolutionParameters::reject()
|
|||
pcSupport = pcSketch->Support.getValue();
|
||||
}
|
||||
|
||||
// Body housekeeping
|
||||
if (ActivePartObject != NULL) {
|
||||
ActivePartObject->removeFeature(pcRevolution);
|
||||
// Make the new Tip and the previous solid feature visible again
|
||||
App::DocumentObject* tip = ActivePartObject->Tip.getValue();
|
||||
App::DocumentObject* prev = ActivePartObject->getPrevSolidFeature();
|
||||
if (tip != NULL) {
|
||||
Gui::Application::Instance->getViewProvider(tip)->show();
|
||||
if ((tip != prev) && (prev != NULL))
|
||||
Gui::Application::Instance->getViewProvider(prev)->show();
|
||||
}
|
||||
}
|
||||
|
||||
// role back the done things
|
||||
Gui::Command::abortCommand();
|
||||
Gui::Command::doCommand(Gui::Command::Gui,"Gui.activeDocument().resetEdit()");
|
||||
|
|
|
@ -82,9 +82,11 @@ bool ViewProvider::onDelete(const std::vector<std::string> &)
|
|||
// Make the new Tip and the previous solid feature visible again
|
||||
App::DocumentObject* tip = body->Tip.getValue();
|
||||
App::DocumentObject* prev = body->getPrevSolidFeature();
|
||||
Gui::Application::Instance->getViewProvider(tip)->show();
|
||||
if (tip != prev)
|
||||
Gui::Application::Instance->getViewProvider(prev)->show();
|
||||
if (tip != NULL) {
|
||||
Gui::Application::Instance->getViewProvider(tip)->show();
|
||||
if ((tip != prev) && (prev != NULL))
|
||||
Gui::Application::Instance->getViewProvider(prev)->show();
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Ask user what to do about dependent objects, e.g. Sketches that have this feature as their support
|
||||
|
|
|
@ -157,7 +157,8 @@ void ViewProviderBody::updateTree()
|
|||
for (std::vector<App::DocumentObject*>::const_iterator f = features.begin(); f != features.end(); f++) {
|
||||
//Base::Console().Error("Highlighting %s: %s\n", (*f)->getNameInDocument(), highlight ? "true" : "false");
|
||||
Gui::ViewProviderDocumentObject* vp = dynamic_cast<Gui::ViewProviderDocumentObject*>(Gui::Application::Instance->getViewProvider(*f));
|
||||
ActiveGuiDoc->signalHighlightObject(*vp, Gui::LightBlue, active ? highlight : false);
|
||||
if (vp != NULL)
|
||||
ActiveGuiDoc->signalHighlightObject(*vp, Gui::LightBlue, active ? highlight : false);
|
||||
if (highlight && (tip == *f))
|
||||
highlight = false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user