From 12cb1baec75e7fef8873288dba5af45f94aebf7f Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Mon, 17 Dec 2018 12:58:21 -0200 Subject: [PATCH] Draft: Fixed tolerance problem in snapping to intersections --- src/Mod/Draft/DraftSnap.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Mod/Draft/DraftSnap.py b/src/Mod/Draft/DraftSnap.py index fd4df05054..80c5e198cf 100644 --- a/src/Mod/Draft/DraftSnap.py +++ b/src/Mod/Draft/DraftSnap.py @@ -854,9 +854,18 @@ class Snapper: if obj: if obj.isDerivedFrom("Part::Feature") or (Draft.getType(obj) == "Axis"): if (not self.maxEdges) or (len(obj.Shape.Edges) <= self.maxEdges): + import Part for e in obj.Shape.Edges: # get the intersection points - pt = DraftGeomUtils.findIntersection(e,shape) + if self.isEnabled("WorkingPlane") and hasattr(e,"Curve") and isinstance(e.Curve,(Part.Line,Part.LineSegment)) and hasattr(shape,"Curve") and isinstance(shape.Curve,(Part.Line,Part.LineSegment)): + # get apparent intersection (lines projected on WP) + p1 = self.toWP(e.Vertexes[0].Point) + p2 = self.toWP(e.Vertexes[-1].Point) + p3 = self.toWP(shape.Vertexes[0].Point) + p4 = self.toWP(shape.Vertexes[-1].Point) + pt = DraftGeomUtils.findIntersection(p1,p2,p3,p4,True,True) + else: + pt = DraftGeomUtils.findIntersection(e,shape) if pt: for p in pt: snaps.append([p,'intersection',self.toWP(p)])