App: Add methods to get base and direction of datum element

Add the methods DatumElement::getBasePoint() and DatumElement::getDirection() to hide implementation details and guarantee consistent behaviour.

Using the methods fixes several regressions in:
* Constraint::getDirection
* PolarPattern::getTransformations
This commit is contained in:
wmayer
2024-12-23 23:39:16 +01:00
parent e977eb49e3
commit b3a1fd9676
7 changed files with 25 additions and 17 deletions

View File

@@ -161,9 +161,7 @@ const std::list<gp_Trsf> LinearPattern::getTransformations(const std::vector<App
dir = gp_Dir(d.x, d.y, d.z);
} else if (refObject->isDerivedFrom<App::Line>()) {
App::Line* line = static_cast<App::Line*>(refObject);
Base::Rotation rot = line->Placement.getValue().getRotation();
Base::Vector3d d(1,0,0);
rot.multVec(d, d);
Base::Vector3d d = line->getDirection();
dir = gp_Dir(d.x, d.y, d.z);
} else if (refObject->isDerivedFrom<Part::Feature>()) {
if (subStrings[0].empty())