Skip to content

Commit

Permalink
Draft: Fix snap to proxy WP and BuildingParts - fixes #4278
Browse files Browse the repository at this point in the history
  • Loading branch information
marioalexis84 committed Feb 24, 2021
1 parent 3ef181a commit 0efc7a3
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/Mod/Draft/draftguitools/gui_snapper.py
Expand Up @@ -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
Expand Down Expand Up @@ -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":
Expand Down

0 comments on commit 0efc7a3

Please sign in to comment.