+ support of linear b-spline/bezier curves and planar b-spline/bezier surfaces to get direction

This commit is contained in:
wmayer
2015-11-11 18:27:26 +01:00
parent 8c8b134a15
commit f45d02c912
8 changed files with 391 additions and 47 deletions

View File

@@ -52,6 +52,7 @@
#endif
#include "FemConstraint.h"
#include "FemTools.h"
#include <Mod/Part/App/PartFeature.h>
#include <Base/Console.h>
@@ -322,25 +323,6 @@ const Base::Vector3d Constraint::getDirection(const App::PropertyLinkSub &direct
str << "No such sub-element '" << subName << "'";
throw Base::AttributeError(str.str());
}
gp_Dir dir;
if (sh.ShapeType() == TopAbs_FACE) {
BRepAdaptor_Surface surface(TopoDS::Face(sh));
if (surface.GetType() == GeomAbs_Plane) {
dir = surface.Plane().Axis().Direction();
} else {
return Base::Vector3d(0,0,0); // "Direction must be a planar face or linear edge"
}
} else if (sh.ShapeType() == TopAbs_EDGE) {
BRepAdaptor_Curve line(TopoDS::Edge(sh));
if (line.GetType() == GeomAbs_Line) {
dir = line.Line().Direction();
} else {
return Base::Vector3d(0,0,0); // "Direction must be a planar face or linear edge"
}
}
Base::Vector3d the_direction(dir.X(), dir.Y(), dir.Z());
the_direction.Normalize();
return the_direction;
return Fem::Tools::getDirectionFromShape(sh);
}