when inside the body has been created then hide the linked base feature

This commit is contained in:
wmayer
2017-09-22 17:57:37 +02:00
parent 17ffe48f96
commit 3ea4ee8a67
2 changed files with 33 additions and 0 deletions

View File

@@ -44,6 +44,7 @@
#include <Mod/Sketcher/App/SketchObject.h>
#include <Mod/PartDesign/App/Body.h>
#include <Mod/PartDesign/App/Feature.h>
#include <Mod/PartDesign/App/FeatureBase.h>
#include <Mod/PartDesign/App/FeatureSketchBased.h>
#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<PartDesign::Body*>
(baseFeature->getDocument()->getObject(bodyName.c_str()));
if (body) {
std::vector<App::DocumentObject*> links = body->Group.getValues();
for (auto it : links) {
if (it->getTypeId().isDerivedFrom(PartDesign::FeatureBase::getClassTypeId())) {
PartDesign::FeatureBase* base = static_cast<PartDesign::FeatureBase*>(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

View File

@@ -49,12 +49,14 @@
#include <Mod/PartDesign/App/DatumLine.h>
#include <Mod/PartDesign/App/DatumPlane.h>
#include <Mod/PartDesign/App/DatumCS.h>
#include <Mod/PartDesign/App/FeatureBase.h>
#include "ViewProviderDatum.h"
#include "Utils.h"
#include "ViewProviderBody.h"
#include "ViewProvider.h"
#include <Gui/Application.h>
#include <Gui/MDIView.h>
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<App::DocumentObject*> links = body->Group.getValues();
for (auto it : links) {
if (it->getTypeId().isDerivedFrom(PartDesign::FeatureBase::getClassTypeId())) {
PartDesign::FeatureBase* base = static_cast<PartDesign::FeatureBase*>(it);
if (base && base->BaseFeature.getValue() == obj) {
Gui::Application::Instance->hideViewProvider(obj);
break;
}
}
}
}