From 9dcfe40a73c1ba62a3960c2742542ebfd36716a3 Mon Sep 17 00:00:00 2001 From: wmayer Date: Tue, 15 Nov 2011 08:44:58 +0000 Subject: [PATCH] + consistent use of sketch base point git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5134 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d --- src/Mod/Part/App/Part2DObject.cpp | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/Mod/Part/App/Part2DObject.cpp b/src/Mod/Part/App/Part2DObject.cpp index 69b4693e4..b758d3256 100644 --- a/src/Mod/Part/App/Part2DObject.cpp +++ b/src/Mod/Part/App/Part2DObject.cpp @@ -94,39 +94,37 @@ Base::Placement Part2DObject::positionBySupport(const TopoDS_Face &face, const B if (Reverse) Normal.Reverse(); + Handle (Geom_Plane) gPlane = new Geom_Plane(plane); + GeomAPI_ProjectPointOnSurf projector(ObjOrg,gPlane); + gp_Pnt SketchBasePoint = projector.NearestPoint(); + gp_Dir dir = Normal.Direction(); - gp_Pnt pos = Normal.Location(); gp_Ax3 SketchPos; // +X if (dir.IsEqual(gp::DX(),0)) { - SketchPos = gp_Ax3(pos, dir, gp_Dir(0,1,0)); + SketchPos = gp_Ax3(SketchBasePoint, dir, gp_Dir(0,1,0)); } // -X else if (dir.IsOpposite(gp::DX(),0)) { - SketchPos = gp_Ax3(pos, dir, gp_Dir(0,-1,0)); + SketchPos = gp_Ax3(SketchBasePoint, dir, gp_Dir(0,-1,0)); } // +Y else if (dir.IsEqual(gp::DY(),0)) { - SketchPos = gp_Ax3(pos, dir, gp_Dir(-1,0,0)); + SketchPos = gp_Ax3(SketchBasePoint, dir, gp_Dir(-1,0,0)); } // -Y else if (dir.IsOpposite(gp::DY(),0)) { - SketchPos = gp_Ax3(pos, dir, gp_Dir(1,0,0)); + SketchPos = gp_Ax3(SketchBasePoint, dir, gp_Dir(1,0,0)); } // +Z else if (dir.IsEqual(gp::DZ(),0)) { - SketchPos = gp_Ax3(pos, dir, gp_Dir(1,0,0)); + SketchPos = gp_Ax3(SketchBasePoint, dir, gp_Dir(1,0,0)); } // -Z else if (dir.IsOpposite(gp::DZ(),0)) { - SketchPos = gp_Ax3(pos, dir, gp_Dir(1,0,0)); + SketchPos = gp_Ax3(SketchBasePoint, dir, gp_Dir(1,0,0)); } else { - Handle (Geom_Plane) gPlane = new Geom_Plane(plane); - GeomAPI_ProjectPointOnSurf projector(ObjOrg,gPlane); - - gp_Pnt SketchBasePoint = projector.NearestPoint(); - // check the angle against the Y Axis Standard_Real a = Normal.Angle(gp_Ax1(gp_Pnt(0,0,0),gp_Dir(0,1,0)));