Skip to content

Commit

Permalink
Merge pull request #4317 from Roy-043/fix_gui_snapper_center_face
Browse files Browse the repository at this point in the history
[Draft] Fix snap to center of faces of solids
  • Loading branch information
yorikvanhavre committed Jan 28, 2021
2 parents 8396c34 + 74d5c0a commit 0f3cdfe
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/Mod/Draft/draftguitools/gui_snapper.py
Expand Up @@ -410,14 +410,8 @@ def snapToObject(self, lastpoint, active, constrain,
if (not self.maxEdges) or (len(shape.Edges) <= self.maxEdges):
if "Edge" in comp:
# we are snapping to an edge
edge = None
if shape.ShapeType == "Edge":
edge = shape
else:
en = int(comp[4:])-1
if len(shape.Edges) > en:
edge = shape.Edges[en]
if edge:
snaps.extend(self.snapToEndpoints(edge))
snaps.extend(self.snapToMidpoint(edge))
snaps.extend(self.snapToPerpendicular(edge, lastpoint))
Expand All @@ -433,9 +427,9 @@ def snapToObject(self, lastpoint, active, constrain,
# extra ellipse options
snaps.extend(self.snapToCenter(edge))
elif "Face" in comp:
en = int(comp[4:])-1
if len(shape.Faces) > en:
face = shape.Faces[en]
# we are snapping to a face
if shape.ShapeType == "Face":
face = shape
snaps.extend(self.snapToFace(face))
elif "Vertex" in comp:
# directly snapped to a vertex
Expand Down

0 comments on commit 0f3cdfe

Please sign in to comment.