diff --git a/src/Mod/Fem/App/FemConstraint.cpp b/src/Mod/Fem/App/FemConstraint.cpp index 35e7c098a6..4e77962533 100644 --- a/src/Mod/Fem/App/FemConstraint.cpp +++ b/src/Mod/Fem/App/FemConstraint.cpp @@ -58,6 +58,7 @@ #include #include +#include #include #include @@ -431,6 +432,24 @@ Base::Vector3d Constraint::getBasePoint(const Base::Vector3d& base, const Base:: const Base::Vector3d Constraint::getDirection(const App::PropertyLinkSub &direction) { App::DocumentObject* obj = direction.getValue(); + if (obj->getTypeId().isDerivedFrom(App::Line::getClassTypeId())) { + Base::Vector3d vec(1.0, 0.0, 0.0); + static_cast(obj)->Placement.getValue().multVec(vec, vec); + return vec; + } + + if (obj->getTypeId().isDerivedFrom(App::Plane::getClassTypeId())) { + Base::Vector3d vec(0.0, 0.0, 1.0); + static_cast(obj)->Placement.getValue().multVec(vec, vec); + return vec; + } + + if (!obj->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) { + std::stringstream str; + str << "Type is not a line, plane or Part object"; + throw Base::TypeError(str.str()); + } + std::vector names = direction.getSubValues(); if (names.size() == 0) return Base::Vector3d(0,0,0);