From 0efc7a3e4fa4c385dc77716c049442708e10daa3 Mon Sep 17 00:00:00 2001 From: marioalexis Date: Tue, 9 Feb 2021 18:00:36 -0300 Subject: [PATCH] Draft: Fix snap to proxy WP and BuildingParts - fixes #0004278 --- src/Mod/Draft/draftguitools/gui_snapper.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/Mod/Draft/draftguitools/gui_snapper.py b/src/Mod/Draft/draftguitools/gui_snapper.py index 7f47e17c8a71..93ac7f3b3c95 100644 --- a/src/Mod/Draft/draftguitools/gui_snapper.py +++ b/src/Mod/Draft/draftguitools/gui_snapper.py @@ -407,6 +407,12 @@ def snapToObject(self, lastpoint, active, constrain, # Special snapping for polygons: add the center snaps.extend(self.snapToPolygon(obj)) + elif (Draft.getType(obj) == "BuildingPart" + and self.isEnabled("Center")): + # snap to the base placement of empty BuildingParts + snaps.append([obj.Placement.Base, 'center', + self.toWP(obj.Placement.Base)]) + if (not self.maxEdges) or (len(shape.Edges) <= self.maxEdges): if "Edge" in comp: # we are snapping to an edge @@ -458,9 +464,11 @@ def snapToObject(self, lastpoint, active, constrain, # for points we only snap to points snaps.extend(self.snapToEndpoints(obj.Points)) - elif Draft.getType(obj) in ("WorkingPlaneProxy", "BuildingPart"): - # snap to the center of WPProxies and BuildingParts - snaps.append([obj.Placement.Base, 'endpoint', + elif (Draft.getType(obj) in ("WorkingPlaneProxy", "BuildingPart") + and self.isEnabled("Center")): + # snap to the center of WPProxies or to the base + # placement of no empty BuildingParts + snaps.append([obj.Placement.Base, 'center', self.toWP(obj.Placement.Base)]) elif Draft.getType(obj) == "SectionPlane":