Draw bottom / top
This commit is contained in:
parent
16e60427d1
commit
1159f28855
|
@ -38,8 +38,8 @@ else:
|
||||||
|
|
||||||
GRID = args.hole+args.padding
|
GRID = args.hole+args.padding
|
||||||
RADIUS = args.hole/2
|
RADIUS = args.hole/2
|
||||||
DIMX = 2*(args.dimension+2)*GRID
|
DIMX = 2*(args.dimension+1)*GRID
|
||||||
DIMY = (args.dimension+2)*GRID
|
DIMY = 2*(args.dimension+1)*GRID
|
||||||
PI3 = math.pi/3
|
PI3 = math.pi/3
|
||||||
|
|
||||||
def draw_grid(cx, cy):
|
def draw_grid(cx, cy):
|
||||||
|
@ -73,13 +73,27 @@ def draw_plane(cx, cy, interior=False):
|
||||||
turtle.forward(leg)
|
turtle.forward(leg)
|
||||||
turtle.right(60)
|
turtle.right(60)
|
||||||
else:
|
else:
|
||||||
|
num_fingers = int(radius/args.horizontal_finger/2)
|
||||||
|
leg = (radius-(2*num_fingers-1)*args.horizontal_finger-args.kerf)/2
|
||||||
for side in range(6):
|
for side in range(6):
|
||||||
turtle.forward(radius)
|
turtle.forward(leg)
|
||||||
|
for finger in range(num_fingers):
|
||||||
|
turtle.right(90)
|
||||||
|
turtle.forward(args.thickness)
|
||||||
|
turtle.left(90)
|
||||||
|
turtle.forward(args.horizontal_finger+args.kerf)
|
||||||
|
turtle.left(90)
|
||||||
|
turtle.forward(args.thickness)
|
||||||
|
turtle.right(90)
|
||||||
|
turtle.forward(leg if finger == num_fingers-1 else args.horizontal_finger-args.kerf)
|
||||||
turtle.right(60)
|
turtle.right(60)
|
||||||
print('<path d="%s" fill="none" stroke="black"/>' % turtle.to_s())
|
print('<path d="%s" fill="none" stroke="black"/>' % turtle.to_s())
|
||||||
|
|
||||||
print('<svg viewBox="0 0 %.2f %.2f" width="%.2fmm" height="%.2fmm" stroke-width="0.1" xmlns="http://www.w3.org/2000/svg">' % (DIMX, DIMY, DIMX, DIMY))
|
print('<svg viewBox="0 0 %.2f %.2f" width="%.2fmm" height="%.2fmm" stroke-width="0.1" xmlns="http://www.w3.org/2000/svg">' % (DIMX, DIMY, DIMX, DIMY))
|
||||||
draw_grid(GRID*(0.5*args.dimension+1), GRID*(0.5*args.dimension+1))
|
draw_grid(GRID*(0.5*args.dimension+0.5), GRID*(0.5*args.dimension+1))
|
||||||
draw_plane(GRID*(0.5*args.dimension+1), GRID*(0.5*args.dimension+1), True)
|
draw_grid(GRID*(1.5*args.dimension+1.5), GRID*(0.5*args.dimension+1))
|
||||||
draw_plane(GRID*(1.5*args.dimension+3), GRID*(0.5*args.dimension+1))
|
draw_plane(GRID*(0.5*args.dimension+0.5), GRID*(0.5*args.dimension+1), True)
|
||||||
|
draw_plane(GRID*(1.5*args.dimension+1.5), GRID*(0.5*args.dimension+1), True)
|
||||||
|
draw_plane(GRID*(0.5*args.dimension+0.5), GRID*(1.5*args.dimension+1))
|
||||||
|
draw_plane(GRID*(1.5*args.dimension+1.5), GRID*(1.5*args.dimension+1))
|
||||||
print('</svg>')
|
print('</svg>')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user