From 0aaab4c8dad56bae1439f9a12e56a42e971357f2 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Thu, 26 Jan 2012 10:03:09 -0200 Subject: [PATCH] Added special behaviour to Draft snap for working with walls --- src/Mod/Draft/DraftSnap.py | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/src/Mod/Draft/DraftSnap.py b/src/Mod/Draft/DraftSnap.py index 74b9eaff6..87b8f45f6 100644 --- a/src/Mod/Draft/DraftSnap.py +++ b/src/Mod/Draft/DraftSnap.py @@ -189,7 +189,17 @@ class Snapper: # active snapping comp = info['Component'] - if obj.isDerivedFrom("Part::Feature"): + + if (Draft.getType(obj) == "Wall") and not oldActive: + if obj.Base: + for edge in obj.Base.Shape.Edges: + snaps.extend(self.snapToEndpoints(edge)) + snaps.extend(self.snapToMidpoint(edge)) + snaps.extend(self.snapToPerpendicular(edge,lastpoint)) + snaps.extend(self.snapToIntersection(edge)) + snaps.extend(self.snapToElines(edge,eline)) + + elif obj.isDerivedFrom("Part::Feature"): if (not self.maxEdges) or (len(obj.Edges) <= self.maxEdges): if "Edge" in comp: # we are snapping to an edge @@ -297,16 +307,17 @@ class Snapper: np = self.getPerpendicular(e,point) if not fcgeo.isPtOnEdge(np,e): if (np.sub(point)).Length < self.radius: - if self.tracker: - self.tracker.setCoords(np) - self.tracker.setMarker(self.mk['extension']) - self.tracker.on() - if self.extLine: - self.extLine.p1(e.Vertexes[0].Point) - self.extLine.p2(np) - self.extLine.on() - self.setCursor('extension') - return np,Part.Line(e.Vertexes[0].Point,np).toShape() + if np != e.Vertexes[0].Point: + if self.tracker: + self.tracker.setCoords(np) + self.tracker.setMarker(self.mk['extension']) + self.tracker.on() + if self.extLine: + self.extLine.p1(e.Vertexes[0].Point) + self.extLine.p2(np) + self.extLine.on() + self.setCursor('extension') + return np,Part.Line(e.Vertexes[0].Point,np).toShape() else: if last: de = Part.Line(last,last.add(fcgeo.vec(e))).toShape()