Simplified datum features by making use of the placement property

This commit is contained in:
jrheinlaender
2013-05-09 11:26:32 +04:30
committed by Stefan Tröger
parent 449aee2178
commit c7d4ab22b9
11 changed files with 121 additions and 111 deletions

View File

@@ -77,15 +77,18 @@ void ViewProviderDatumLine::updateData(const App::Property* prop)
// Gets called whenever a property of the attached object changes
PartDesign::Line* pcDatum = static_cast<PartDesign::Line*>(this->getObject());
if (strcmp(prop->getName(),"_Base") == 0) {
Base::Vector3d base = pcDatum->_Base.getValue();
Base::Vector3d dir = pcDatum->_Direction.getValue();
if (strcmp(prop->getName(),"Placement") == 0) {
Base::Placement plm = pcDatum->Placement.getValue();
plm.invert();
Base::Vector3d base(0,0,0);
Base::Vector3d dir(0,0,1);
// Get limits of the line from bounding box of the body
PartDesign::Body* body = static_cast<PartDesign::Body*>(Part::BodyBase::findBodyOf(this->getObject()));
if (body == NULL)
return;
Base::BoundBox3d bbox = body->getBoundBox();
bbox = bbox.Transformed(plm.toMatrix());
bbox.Enlarge(0.1 * bbox.CalcDiagonalLength());
Base::Vector3d p1, p2;
if (bbox.IsInBox(base)) {