diff --git a/src/Mod/PartDesign/Gui/Workbench.cpp b/src/Mod/PartDesign/Gui/Workbench.cpp index a2f26c1ad..62a6c3697 100644 --- a/src/Mod/PartDesign/Gui/Workbench.cpp +++ b/src/Mod/PartDesign/Gui/Workbench.cpp @@ -144,6 +144,9 @@ PartDesign::Body *Workbench::setUpPart(const App::Part *part) void switchToDocument(const App::Document* doc) { + bool groupCreated = false; + + if (doc == NULL) return; PartDesign::Body* activeBody = NULL; @@ -177,14 +180,14 @@ void switchToDocument(const App::Document* doc) std::vector features = doc->getObjects(); // Assign all non-PartDesign features to a new group - bool groupCreated = false; for (std::vector::iterator f = features.begin(); f != features.end(); ) { if ((*f)->getTypeId().isDerivedFrom(PartDesign::Feature::getClassTypeId()) || (*f)->getTypeId().isDerivedFrom(Part::Part2DObject::getClassTypeId())) { ++f; } else { if (!groupCreated) { - Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().addObject('App::DocumentObjectGroup','%s')", + Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().addObject('App::DocumentObjectGroup','NonBodyFeatures')"); + Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().ActiveObject.Label = '%s'", QObject::tr("NonBodyFeatures").toStdString().c_str()); groupCreated = true; } @@ -399,6 +402,10 @@ void switchToDocument(const App::Document* doc) if ((activeBody == NULL) && (bodies.size() == 1)) activeBody = static_cast(bodies.front()); + // add the non PartDesign feature group to the Part + if( groupCreated && doc->Tip.getValue() != NULL) + Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().Tip.addObject(App.activeDocument().NonBodyFeatures)"); + if (activeBody != NULL) { Gui::Command::doCommand(Gui::Command::Doc,"import PartDesignGui"); Gui::Command::doCommand(Gui::Command::Gui,"PartDesignGui.setActivePart(App.activeDocument().%s)", activeBody->getNameInDocument());