Work on inserting, removing, hiding and showing features in the body

This commit is contained in:
jrheinlaender
2013-04-10 17:41:26 +04:30
committed by Stefan Tröger
parent 218f386990
commit 8390bbb999
13 changed files with 365 additions and 160 deletions

View File

@@ -27,8 +27,11 @@
#endif
#include "ViewProvider.h"
#include "Workbench.h"
#include <Mod/PartDesign/App/Body.h>
#include <Mod/Part/App/PropertyTopoShape.h>
#include <Gui/Command.h>
#include <Gui/Application.h>
#include <Base/Exception.h>
using namespace PartDesignGui;
@@ -69,3 +72,25 @@ void ViewProvider::updateData(const App::Property* prop)
}
inherited::updateData(prop);
}
bool ViewProvider::onDelete(const std::vector<std::string> &)
{
// Body feature housekeeping
PartDesign::Body* body = PartDesign::Body::findBodyOf(getObject());
if (body != NULL) {
body->removeFeature(getObject());
// 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();
}
// TODO: Ask user what to do about dependent objects, e.g. Sketches that have this feature as their support
// 1. Delete
// 2. Suppress
// 3. Re-route
return true;
}