diff --git a/src/Mod/Draft/DraftSnap.py b/src/Mod/Draft/DraftSnap.py index 067091ce8..ac57d430a 100644 --- a/src/Mod/Draft/DraftSnap.py +++ b/src/Mod/Draft/DraftSnap.py @@ -307,11 +307,15 @@ class Snapper: #snaps.extend(self.snapToOrtho(edge,lastpoint,constrain)) # now part of snapToPolar snaps.extend(self.snapToIntersection(edge)) snaps.extend(self.snapToElines(edge,eline)) - - if DraftGeomUtils.geomType(edge) == "Circle": + + et = DraftGeomUtils.geomType(edge) + if et == "Circle": # the edge is an arc, we have extra options snaps.extend(self.snapToAngles(edge)) snaps.extend(self.snapToCenter(edge)) + elif et == "Ellipse": + # extra ellipse options + snaps.extend(self.snapToCenter(edge)) elif "Vertex" in comp: # directly snapped to a vertex @@ -728,12 +732,16 @@ class Snapper: "returns a list of center snap locations" snaps = [] if self.isEnabled("center"): - rad = shape.Curve.Radius pos = shape.Curve.Center - for i in [15,37.5,52.5,75,105,127.5,142.5,165,195,217.5,232.5,255,285,307.5,322.5,345]: - ang = math.radians(i) - cur = Vector(math.sin(ang)*rad+pos.x,math.cos(ang)*rad+pos.y,pos.z) - snaps.append([cur,'center',self.toWP(pos)]) + c = self.toWP(pos) + if hasattr(shape.Curve,"Radius"): + rad = shape.Curve.Radius + for i in [15,37.5,52.5,75,105,127.5,142.5,165,195,217.5,232.5,255,285,307.5,322.5,345]: + ang = math.radians(i) + cur = Vector(math.sin(ang)*rad+pos.x,math.cos(ang)*rad+pos.y,pos.z) + snaps.append([cur,'center',c]) + else: + snaps.append([c,'center',c]) return snaps def snapToIntersection(self,shape):