From 36a00f45b61462ac2267476381359ecbd6f7614a Mon Sep 17 00:00:00 2001 From: jrheinlaender Date: Fri, 26 Jul 2013 15:56:56 +0200 Subject: [PATCH] PartDesign Body migration: Fix migration of MultiTransform sub-features --- src/Mod/PartDesign/Gui/ViewProviderBody.cpp | 9 +++++++++ src/Mod/PartDesign/Gui/Workbench.cpp | 14 ++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/Mod/PartDesign/Gui/ViewProviderBody.cpp b/src/Mod/PartDesign/Gui/ViewProviderBody.cpp index e28d867d3..318884ae2 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderBody.cpp +++ b/src/Mod/PartDesign/Gui/ViewProviderBody.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -120,6 +121,14 @@ std::vector ViewProviderBody::claimChildren(void)const if (sketch != NULL) OutSet.insert(sketch); } + + // Transformations of a MultiTransform feature get claimed under the feature, too + if ((*it)->isDerivedFrom(PartDesign::MultiTransform::getClassTypeId())) { + std::vector trfs = static_cast(*it)->Transformations.getValues(); + for (std::vector::const_iterator t = trfs.begin(); t != trfs.end(); t++) + if ((*t) != NULL) + OutSet.insert(*t); + } } // remove the otherwise handled objects, preserving their order so the order in the TreeWidget is correct diff --git a/src/Mod/PartDesign/Gui/Workbench.cpp b/src/Mod/PartDesign/Gui/Workbench.cpp index be4fe5801..dcf40ed32 100644 --- a/src/Mod/PartDesign/Gui/Workbench.cpp +++ b/src/Mod/PartDesign/Gui/Workbench.cpp @@ -50,6 +50,7 @@ #include #include #include +#include #include #include @@ -141,6 +142,19 @@ void switchToDocument(const App::Document* doc) } } + // Set BaseFeature property to NULL for members of MultiTransform + for (std::vector::const_iterator f = features.begin(); f != features.end(); f++) { + if ((*f)->getTypeId().isDerivedFrom(PartDesign::MultiTransform::getClassTypeId())) { + std::vector trfs = static_cast(*f)->Transformations.getValues(); + for (std::vector::const_iterator t = trfs.begin(); t != trfs.end(); t++) { + if ((*t) != NULL) { + Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().%s.BaseFeature = None", + (*t)->getNameInDocument()); + } + } + } + } + // Re-route all sketches without support to the base planes Gui::Command::openCommand("Migrate part to Body feature"); std::vector::const_iterator prevf;