Skip to content

Commit

Permalink
Sketcher: fix external geometry projection transformation
Browse files Browse the repository at this point in the history
  • Loading branch information
realthunder committed Jan 31, 2023
1 parent 853a80f commit e98d1b3
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/Mod/Sketcher/App/SketchObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7968,13 +7968,11 @@ void SketchObject::rebuildExternalGeometry(bool defining, bool addIntersection)
if (Part::TopoShape(edge).findPlane(pln)
&& pln.Axis().Direction().IsParallel(
sketchPlane.Axis().Direction(), Precision::Confusion())) {
double d = pln.Distance(sketchPlane);
double d = -pln.Distance(sketchPlane);
gp_Trsf trsf;
trsf.SetTranslation(gp_Vec(pln.Axis().Direction()) * d);
projShape.setShape(edge);
// Must copy the edge to make the transformation work
// for some reason.
projShape.transformShape(Part::TopoShape::convert(trsf), /*copy*/true);
projShape.transformShape(Part::TopoShape::convert(trsf), /*copy*/false);
} else {
BRepOffsetAPI_NormalProjection mkProj(aProjFace);
mkProj.Add(edge);
Expand All @@ -7985,11 +7983,11 @@ void SketchObject::rebuildExternalGeometry(bool defining, bool addIntersection)
return;
}
}
for (const auto &e : projShape.getSubShapes(TopAbs_EDGE)) {
TopoDS_Edge projEdge = TopoDS::Edge(e);
TopLoc_Location loc(mov);
projEdge.Location(loc);

for (auto &e : projShape.getSubTopoShapes(TopAbs_EDGE)) {
// Must copy the edge to make the transformation work
// for some reason.
e.transformShape(invMat, /*copy*/true, /*checkScale*/true);
TopoDS_Edge projEdge = TopoDS::Edge(e.getShape());
BRepAdaptor_Curve projCurve(projEdge);

gp_Pnt P1 = BRep_Tool::Pnt(TopExp::FirstVertex(projEdge));
Expand Down

0 comments on commit e98d1b3

Please sign in to comment.