Automatically adjust datum line/plane size to Body bounding box
This commit is contained in:
parent
a6431ee5cf
commit
2aea9bbf96
|
@ -292,6 +292,7 @@ void Body::removeFeature(App::DocumentObject* feature)
|
||||||
|
|
||||||
App::DocumentObjectExecReturn *Body::execute(void)
|
App::DocumentObjectExecReturn *Body::execute(void)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
Base::Console().Error("Body '%s':\n", getNameInDocument());
|
Base::Console().Error("Body '%s':\n", getNameInDocument());
|
||||||
App::DocumentObject* tip = Tip.getValue();
|
App::DocumentObject* tip = Tip.getValue();
|
||||||
Base::Console().Error(" Tip: %s\n", (tip == NULL) ? "None" : tip->getNameInDocument());
|
Base::Console().Error(" Tip: %s\n", (tip == NULL) ? "None" : tip->getNameInDocument());
|
||||||
|
@ -307,6 +308,7 @@ App::DocumentObjectExecReturn *Body::execute(void)
|
||||||
Base::Console().Error("\n");
|
Base::Console().Error("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
const Part::TopoShape& TipShape = getTipShape();
|
const Part::TopoShape& TipShape = getTipShape();
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,8 @@
|
||||||
#include <Gui/Application.h>
|
#include <Gui/Application.h>
|
||||||
#include <Mod/PartDesign/App/Body.h>
|
#include <Mod/PartDesign/App/Body.h>
|
||||||
#include <Mod/PartDesign/App/FeatureSketchBased.h>
|
#include <Mod/PartDesign/App/FeatureSketchBased.h>
|
||||||
|
#include <Mod/PartDesign/App/DatumLine.h>
|
||||||
|
#include <Mod/PartDesign/App/DatumPlane.h>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include "Base/Console.h"
|
#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
|
// 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<PartDesign::Body*>(getObject());
|
||||||
|
std::vector<App::DocumentObject*> features = body->Model.getValues();
|
||||||
|
for (std::vector<App::DocumentObject*>::const_iterator f = features.begin(); f != features.end(); f++) {
|
||||||
|
App::PropertyVector* baseProp = NULL;
|
||||||
|
if ((*f)->getTypeId().isDerivedFrom(PartDesign::Line::getClassTypeId()))
|
||||||
|
baseProp = &(static_cast<PartDesign::Line*>(*f)->_Base);
|
||||||
|
else if ((*f)->getTypeId().isDerivedFrom(PartDesign::Plane::getClassTypeId()))
|
||||||
|
baseProp = &(static_cast<PartDesign::Plane*>(*f)->_Base);
|
||||||
|
|
||||||
|
if (baseProp != NULL) {
|
||||||
|
Gui::ViewProviderDocumentObject* vp = dynamic_cast<Gui::ViewProviderDocumentObject*>(Gui::Application::Instance->getViewProvider(*f));
|
||||||
|
if (vp != NULL)
|
||||||
|
vp->updateData(baseProp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
PartGui::ViewProviderPart::updateData(prop);
|
PartGui::ViewProviderPart::updateData(prop);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user