diff --git a/src/Mod/PartDesign/App/Body.cpp b/src/Mod/PartDesign/App/Body.cpp index 01f317ab4..7b33bc7fb 100644 --- a/src/Mod/PartDesign/App/Body.cpp +++ b/src/Mod/PartDesign/App/Body.cpp @@ -187,6 +187,17 @@ const bool Body::isAfterTip(const App::DocumentObject *f) { return (it > tip); } +const bool Body::isMemberOfMultiTransform(const App::DocumentObject* f) +{ + if (f == NULL) + return false; + + // This can be recognized because the Originals property is empty (it is contained + // in the MultiTransform instead) + return (f->getTypeId().isDerivedFrom(PartDesign::Transformed::getClassTypeId()) && + static_cast(f)->Originals.getValues().empty()); +} + const bool Body::isSolidFeature(const App::DocumentObject* f) { if (f == NULL) @@ -194,12 +205,7 @@ const bool Body::isSolidFeature(const App::DocumentObject* f) if (f->getTypeId().isDerivedFrom(PartDesign::Feature::getClassTypeId())) { // Transformed Features inside a MultiTransform are not solid features - // They can be recognized because the Originals property is empty (it is contained - // in the MultiTransform instead) - if (f->getTypeId().isDerivedFrom(PartDesign::Transformed::getClassTypeId()) && - static_cast(f)->Originals.getValues().empty()) - return false; - return true; + return !isMemberOfMultiTransform(f); } } diff --git a/src/Mod/PartDesign/App/Body.h b/src/Mod/PartDesign/App/Body.h index 345a90308..0d3d0e1ee 100644 --- a/src/Mod/PartDesign/App/Body.h +++ b/src/Mod/PartDesign/App/Body.h @@ -84,6 +84,9 @@ public: /// Remove the feature from the body void removeFeature(App::DocumentObject* feature); + /// Return true if the given feature is member of a MultiTransform feature + static const bool isMemberOfMultiTransform(const App::DocumentObject* f); + /** * Return true if the given feature is a solid feature allowed in a Body. Currently this is only valid * for features derived from PartDesign::Feature diff --git a/src/Mod/PartDesign/Gui/Workbench.cpp b/src/Mod/PartDesign/Gui/Workbench.cpp index 1849d87f4..def22f8c1 100644 --- a/src/Mod/PartDesign/Gui/Workbench.cpp +++ b/src/Mod/PartDesign/Gui/Workbench.cpp @@ -160,6 +160,9 @@ void switchToDocument(const App::Document* doc) do { std::set newInList; for (std::set::const_iterator o = inList.begin(); o != inList.end(); o++) { + // Omit members of a MultiTransform from the inList, to avoid migration errors + if (PartDesign::Body::isMemberOfMultiTransform(*o)) + continue; std::vector iL = doc->getInList(*o); newInList.insert(iL.begin(), iL.end()); } @@ -181,7 +184,14 @@ void switchToDocument(const App::Document* doc) if (!modelString.empty()) { modelString = std::string("[") + modelString + "]"; Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().%s.Model = %s", activeBody->getNameInDocument(), modelString.c_str()); - Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().%s.Tip = App.activeDocument().%s", activeBody->getNameInDocument(), bodyFeatures.back()->getNameInDocument()); + // Set the Tip, but not to a member of a MultiTransform! + for (std::vector::const_reverse_iterator f = bodyFeatures.rbegin(); f != bodyFeatures.rend(); f++) { + if (PartDesign::Body::isMemberOfMultiTransform(*f)) + continue; + Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().%s.Tip = App.activeDocument().%s", + activeBody->getNameInDocument(), (*f)->getNameInDocument()); + break; + } } // Initialize the BaseFeature property of all PartDesign solid features