Make Parts.ringSegment actually work
This commit is contained in:
parent
6f626d04a7
commit
d6099e5978
|
@ -137,20 +137,21 @@ class Parts:
|
||||||
:param n: (Default value = 1) number of segments
|
:param n: (Default value = 1) number of segments
|
||||||
:param move: (Default value = "")
|
:param move: (Default value = "")
|
||||||
"""
|
"""
|
||||||
space = 360 * r_inside / self.spacing
|
space = 360 * self.spacing / r_inside / 2 / pi
|
||||||
n = min(n, 360 / (angle+space))
|
nc = int(min(n, 360 / (angle+space)))
|
||||||
|
|
||||||
# XXX be smarter about space
|
while n > 0:
|
||||||
if self.move(r_outside, r_outside, move, True):
|
if self.move(2*r_outside, 2*r_outside, move, True):
|
||||||
return
|
return
|
||||||
|
self.moveTo(0, r_outside, -90)
|
||||||
self.moveTo(r_outside)
|
for i in range(nc):
|
||||||
for i in range(n):
|
self.polyline(
|
||||||
self.polyline(
|
0, (angle, r_outside), 0, 90, (r_outside-r_inside, 2),
|
||||||
0, (angle, r_outside), 0, 90, (r_outside-r_inside, 2),
|
90, 0, (-angle, r_inside), 0, 90, (r_outside-r_inside, 2),
|
||||||
90, (angle, r_inside), 0, 90, (r_outside-r_inside, 2),
|
90)
|
||||||
90)
|
x, y = vectors.circlepoint(r_outside, radians(angle+space))
|
||||||
x, y = vectors.circlepoint(r_outside, math.radians(angle+space))
|
self.moveTo(y, r_outside-x, angle+space)
|
||||||
self.moveTo(y, r_outside-x, angle+space)
|
n -=1
|
||||||
self.move(r_outside, r_outside)
|
if n == 0:
|
||||||
return n
|
break
|
||||||
|
self.move(2*r_outside, 2*r_outside, move)
|
||||||
|
|
Loading…
Reference in New Issue