From 2aea9bbf96ec40e00fa5492193e08961255c202a Mon Sep 17 00:00:00 2001 From: jrheinlaender Date: Mon, 6 May 2013 12:14:12 +0430 Subject: [PATCH] Automatically adjust datum line/plane size to Body bounding box --- src/Mod/PartDesign/App/Body.cpp | 2 ++ src/Mod/PartDesign/Gui/ViewProviderBody.cpp | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/Mod/PartDesign/App/Body.cpp b/src/Mod/PartDesign/App/Body.cpp index d1a06fc4d..4c1682f6c 100644 --- a/src/Mod/PartDesign/App/Body.cpp +++ b/src/Mod/PartDesign/App/Body.cpp @@ -292,6 +292,7 @@ void Body::removeFeature(App::DocumentObject* feature) App::DocumentObjectExecReturn *Body::execute(void) { + /* Base::Console().Error("Body '%s':\n", getNameInDocument()); App::DocumentObject* tip = Tip.getValue(); Base::Console().Error(" Tip: %s\n", (tip == NULL) ? "None" : tip->getNameInDocument()); @@ -307,6 +308,7 @@ App::DocumentObjectExecReturn *Body::execute(void) Base::Console().Error("\n"); } } + */ const Part::TopoShape& TipShape = getTipShape(); diff --git a/src/Mod/PartDesign/Gui/ViewProviderBody.cpp b/src/Mod/PartDesign/Gui/ViewProviderBody.cpp index de5729fd3..a7dcb8fee 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderBody.cpp +++ b/src/Mod/PartDesign/Gui/ViewProviderBody.cpp @@ -34,6 +34,8 @@ #include #include #include +#include +#include #include #include "Base/Console.h" @@ -179,5 +181,22 @@ void ViewProviderBody::updateData(const App::Property* prop) } // Note: The Model property only changes by itself (without the Tip also changing) if a feature is deleted somewhere + // Update the visual size of datum lines and planes + PartDesign::Body* body = static_cast(getObject()); + std::vector features = body->Model.getValues(); + for (std::vector::const_iterator f = features.begin(); f != features.end(); f++) { + App::PropertyVector* baseProp = NULL; + if ((*f)->getTypeId().isDerivedFrom(PartDesign::Line::getClassTypeId())) + baseProp = &(static_cast(*f)->_Base); + else if ((*f)->getTypeId().isDerivedFrom(PartDesign::Plane::getClassTypeId())) + baseProp = &(static_cast(*f)->_Base); + + if (baseProp != NULL) { + Gui::ViewProviderDocumentObject* vp = dynamic_cast(Gui::Application::Instance->getViewProvider(*f)); + if (vp != NULL) + vp->updateData(baseProp); + } + } + PartGui::ViewProviderPart::updateData(prop); }