diff --git a/src/Mod/PartDesign/Gui/CommandBody.cpp b/src/Mod/PartDesign/Gui/CommandBody.cpp index f221c96ac0..e47bb66bc2 100644 --- a/src/Mod/PartDesign/Gui/CommandBody.cpp +++ b/src/Mod/PartDesign/Gui/CommandBody.cpp @@ -44,6 +44,7 @@ #include #include #include +#include #include #include "Utils.h" @@ -211,6 +212,24 @@ void CmdPartDesignBody::activated(int iMsg) actPart->getNameInDocument(), bodyName.c_str()); } + // check if a proxy object has been created for the base feature inside the body + if (baseFeature) { + PartDesign::Body* body = dynamic_cast + (baseFeature->getDocument()->getObject(bodyName.c_str())); + if (body) { + std::vector links = body->Group.getValues(); + for (auto it : links) { + if (it->getTypeId().isDerivedFrom(PartDesign::FeatureBase::getClassTypeId())) { + PartDesign::FeatureBase* base = static_cast(it); + if (base && base->BaseFeature.getValue() == baseFeature) { + Gui::Application::Instance->hideViewProvider(baseFeature); + break; + } + } + } + } + } + // The method 'SoCamera::viewBoundingBox' is still declared as protected in Coin3d versions // older than 4.0. #if COIN_MAJOR_VERSION >= 4 diff --git a/src/Mod/PartDesign/Gui/ViewProviderBody.cpp b/src/Mod/PartDesign/Gui/ViewProviderBody.cpp index 1fc096fc6f..cd18a0639a 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderBody.cpp +++ b/src/Mod/PartDesign/Gui/ViewProviderBody.cpp @@ -49,12 +49,14 @@ #include #include #include +#include #include "ViewProviderDatum.h" #include "Utils.h" #include "ViewProviderBody.h" #include "ViewProvider.h" +#include #include using namespace PartDesignGui; @@ -455,4 +457,16 @@ void ViewProviderBody::dropObject(App::DocumentObject* obj) body->BaseFeature.setValue(obj); App::Document* doc = body->getDocument(); doc->recompute(); + + // check if a proxy object has been created for the base feature + std::vector links = body->Group.getValues(); + for (auto it : links) { + if (it->getTypeId().isDerivedFrom(PartDesign::FeatureBase::getClassTypeId())) { + PartDesign::FeatureBase* base = static_cast(it); + if (base && base->BaseFeature.getValue() == obj) { + Gui::Application::Instance->hideViewProvider(obj); + break; + } + } + } }