Try to be consistent with sketch plane orientation PartDesign module <-> Sketcher module
This commit is contained in:
committed by
Stefan Tröger
parent
2d7813295b
commit
d082f16bbf
@@ -95,7 +95,10 @@ void Part2DObject::positionBySupport(void)
|
||||
|
||||
// Set placement identical to the way it used to be done in the Sketcher::SketchOrientationDialog
|
||||
if (dir == Base::Vector3d(0,0,1)) {
|
||||
Place = Base::Placement(Base::Vector3d(0,0,0),Base::Rotation(Reverse ? -1.0 : 0.0, 0.0,0.0,0.0));
|
||||
if (Reverse)
|
||||
Place = Base::Placement(Base::Vector3d(0,0,0),Base::Rotation(-1.0, 0.0,0.0,0.0));
|
||||
else
|
||||
Place = Base::Placement(Base::Vector3d(0,0,0),Base::Rotation());
|
||||
} else if (dir == Base::Vector3d(0,1,0)) {
|
||||
if (Reverse)
|
||||
Place = Base::Placement(Base::Vector3d(0,0,0),Base::Rotation(Base::Vector3d(0,sqrt(2.0)/2.0,sqrt(2.0)/2.0),M_PI));
|
||||
@@ -113,18 +116,18 @@ void Part2DObject::positionBySupport(void)
|
||||
Place.getRotation().multVec(Base::Vector3d(0,0,1),dir);
|
||||
Base::Vector3d pos = Place.getPosition();
|
||||
plane = gp_Pln(gp_Pnt(pos.x, pos.y, pos.z), gp_Dir(dir.x, dir.y, dir.z));
|
||||
} else if (support->getTypeId() == Part::Datum::getClassTypeId()) {
|
||||
} else if (support->getTypeId().isDerivedFrom(Part::Datum::getClassTypeId())) {
|
||||
const std::vector<std::string> &sub = Support.getSubValues();
|
||||
assert(sub.size()==1);
|
||||
|
||||
Part::Datum* pcDatum = static_cast<Part::Datum*>(support);
|
||||
TopoDS_Shape plane = pcDatum->Shape.getValue();
|
||||
if (plane.ShapeType() != TopAbs_FACE)
|
||||
return;
|
||||
BRepAdaptor_Surface adapt(TopoDS::Face(plane));
|
||||
if (adapt.GetType() != GeomAbs_Plane)
|
||||
return;
|
||||
gp_Pln pl = adapt.Plane();
|
||||
Base::Vector3d pos(pl.Location().X(), pl.Location().Y(), pl.Location().Z());
|
||||
Base::Vector3d normal(pl.Axis().Direction().X(), pl.Axis().Direction().Y(), pl.Axis().Direction().Z());
|
||||
this->Placement.setValue(Base::Placement(pos, Base::Rotation(Base::Vector3d(0,0,1), normal)));
|
||||
Place = pcDatum->Placement.getValue();
|
||||
Base::Vector3d dir;
|
||||
Place.getRotation().multVec(Base::Vector3d(0,0,1),dir);
|
||||
if (!sub.empty() && (sub[0] == "back"))
|
||||
dir *= -1.0;
|
||||
Base::Vector3d pos = Place.getPosition();
|
||||
plane = gp_Pln(gp_Pnt(pos.x, pos.y, pos.z), gp_Dir(dir.x, dir.y, dir.z));
|
||||
} else {
|
||||
Part::Feature *part = static_cast<Part::Feature*>(support);
|
||||
if (!part || !part->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId()))
|
||||
|
||||
Reference in New Issue
Block a user