Draft: Allow snapping to the center of ellipses
This commit is contained in:
parent
32f509cba1
commit
24f83252a6
|
@ -308,10 +308,14 @@ class Snapper:
|
||||||
snaps.extend(self.snapToIntersection(edge))
|
snaps.extend(self.snapToIntersection(edge))
|
||||||
snaps.extend(self.snapToElines(edge,eline))
|
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
|
# the edge is an arc, we have extra options
|
||||||
snaps.extend(self.snapToAngles(edge))
|
snaps.extend(self.snapToAngles(edge))
|
||||||
snaps.extend(self.snapToCenter(edge))
|
snaps.extend(self.snapToCenter(edge))
|
||||||
|
elif et == "Ellipse":
|
||||||
|
# extra ellipse options
|
||||||
|
snaps.extend(self.snapToCenter(edge))
|
||||||
|
|
||||||
elif "Vertex" in comp:
|
elif "Vertex" in comp:
|
||||||
# directly snapped to a vertex
|
# directly snapped to a vertex
|
||||||
|
@ -728,12 +732,16 @@ class Snapper:
|
||||||
"returns a list of center snap locations"
|
"returns a list of center snap locations"
|
||||||
snaps = []
|
snaps = []
|
||||||
if self.isEnabled("center"):
|
if self.isEnabled("center"):
|
||||||
rad = shape.Curve.Radius
|
|
||||||
pos = shape.Curve.Center
|
pos = shape.Curve.Center
|
||||||
|
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]:
|
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)
|
ang = math.radians(i)
|
||||||
cur = Vector(math.sin(ang)*rad+pos.x,math.cos(ang)*rad+pos.y,pos.z)
|
cur = Vector(math.sin(ang)*rad+pos.x,math.cos(ang)*rad+pos.y,pos.z)
|
||||||
snaps.append([cur,'center',self.toWP(pos)])
|
snaps.append([cur,'center',c])
|
||||||
|
else:
|
||||||
|
snaps.append([c,'center',c])
|
||||||
return snaps
|
return snaps
|
||||||
|
|
||||||
def snapToIntersection(self,shape):
|
def snapToIntersection(self,shape):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user