Merge pull request #18704 from wwmayer/fix_line_dir
App: Add methods to get base and direction of datum element
This commit is contained in:
@@ -69,6 +69,7 @@
|
||||
#include <Base/Placement.h>
|
||||
#include <Base/Rotation.h>
|
||||
#include <Base/Stream.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Mod/Material/App/MaterialManager.h>
|
||||
|
||||
#include "Geometry.h"
|
||||
@@ -76,7 +77,7 @@
|
||||
#include "PartFeaturePy.h"
|
||||
#include "PartPyCXX.h"
|
||||
#include "TopoShapePy.h"
|
||||
#include "Base/Tools.h"
|
||||
#include "Tools.h"
|
||||
|
||||
using namespace Part;
|
||||
namespace sp = std::placeholders;
|
||||
@@ -993,7 +994,9 @@ static TopoShape _getTopoShape(const App::DocumentObject* obj,
|
||||
if (linked->isDerivedFrom(App::Line::getClassTypeId())) {
|
||||
static TopoDS_Shape _shape;
|
||||
if (_shape.IsNull()) {
|
||||
BRepBuilderAPI_MakeEdge builder(gp_Lin(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1)));
|
||||
auto line = static_cast<App::Line*>(linked);
|
||||
Base::Vector3d dir = line->getBaseDirection();
|
||||
BRepBuilderAPI_MakeEdge builder(gp_Lin(gp_Pnt(0, 0, 0), Base::convertTo<gp_Dir>(dir)));
|
||||
_shape = builder.Shape();
|
||||
_shape.Infinite(Standard_True);
|
||||
}
|
||||
@@ -1002,7 +1005,9 @@ static TopoShape _getTopoShape(const App::DocumentObject* obj,
|
||||
else if (linked->isDerivedFrom(App::Plane::getClassTypeId())) {
|
||||
static TopoDS_Shape _shape;
|
||||
if (_shape.IsNull()) {
|
||||
BRepBuilderAPI_MakeFace builder(gp_Pln(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1)));
|
||||
auto plane = static_cast<App::Plane*>(linked);
|
||||
Base::Vector3d dir = plane->getBaseDirection();
|
||||
BRepBuilderAPI_MakeFace builder(gp_Pln(gp_Pnt(0, 0, 0), Base::convertTo<gp_Dir>(dir)));
|
||||
_shape = builder.Shape();
|
||||
_shape.Infinite(Standard_True);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user