First prototype of bottom case: sides don't overlap enough, interior guides too widely apart, should align with fingers

This commit is contained in:
Matthias Neeracher 2021-11-15 03:54:48 +01:00
parent 1159f28855
commit 5dd4fe4117

View File

@ -36,33 +36,43 @@ else:
args.hole = float(args.hole)
assert(args.height != None)
GRID = args.hole+args.padding
RADIUS = args.hole/2
DIMX = 2*(args.dimension+1)*GRID
DIMY = 2*(args.dimension+1)*GRID
args.kerf2 = args.kerf/2
args.grid = args.hole+args.padding
args.radius = args.hole/2
args.interior_edge = args.grid*args.dimension*0.5+args.outside_padding
args.exterior_edge = args.interior_edge+args.thickness
args.interior_leg = (args.interior_edge-args.horizontal_finger-args.kerf)/2
args.n_hor_fingers = int(args.exterior_edge/args.horizontal_finger/2)
args.exterior_leg = (args.exterior_edge-(2*args.n_hor_fingers-1)*args.horizontal_finger+args.kerf)/2
args.exterior_slot = (args.exterior_edge-args.horizontal_finger+args.kerf)/2
args.n_ver_fingers = int(args.height/args.vertical_finger/2)
args.vertical_finger = args.height/args.n_ver_fingers/2
DIMX = 2.9*args.grid*args.dimension
DIMY = 3.8*args.grid*args.dimension
PI3 = math.pi/3
def draw_grid(cx, cy):
for row in range(-int(args.dimension/2), int((args.dimension+1)/2)):
cyr = cy+GRID*row*math.sin(PI3)
cyr = cy+args.grid*row*math.sin(PI3)
num_col = args.dimension-abs(row)
cxr = cx-.5*GRID*(num_col-1.0)
cxr = cx-.5*args.grid*(num_col-1.0)
for col in range(num_col):
print('<circle cx="%.2f" cy="%.2f" r="%.2f" stroke="black" fill="none"/>' % (cxr+col*GRID, cyr, RADIUS))
print('<circle cx="%.2f" cy="%.2f" r="%.2f" stroke="black" fill="none"/>' % (cxr+col*args.grid, cyr, args.radius))
def draw_plane(cx, cy, interior=False):
radius = GRID*args.dimension*0.5+args.outside_padding
if not interior:
radius += args.thickness
if interior:
edge = args.interior_edge
else:
edge = args.exterior_edge
turtle = svgturtle.SvgTurtle(cx, cy)
turtle.penup()
turtle.forward(radius)
turtle.forward(edge)
turtle.right(120)
turtle.pendown()
if interior:
leg = (radius-args.horizontal_finger-args.kerf)/2
for side in range(6):
turtle.forward(leg)
turtle.forward(args.interior_leg)
turtle.left(90)
turtle.forward(args.thickness)
turtle.right(90)
@ -70,30 +80,76 @@ def draw_plane(cx, cy, interior=False):
turtle.right(90)
turtle.forward(args.thickness)
turtle.left(90)
turtle.forward(leg)
turtle.forward(args.interior_leg)
turtle.right(60)
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):
turtle.forward(leg)
for finger in range(num_fingers):
for finger in range(args.n_hor_fingers):
turtle.forward(args.exterior_leg if finger == 0 else args.horizontal_finger+args.kerf)
turtle.right(90)
turtle.forward(args.thickness)
turtle.left(90)
turtle.forward(args.horizontal_finger+args.kerf)
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.forward(args.exterior_leg)
turtle.right(60)
print('<path d="%s" fill="none" stroke="black"/>' % turtle.to_s())
def draw_side(x0, y0, h, slots):
turtle = svgturtle.SvgTurtle(x0, y0+args.thickness)
for finger in range(args.n_hor_fingers):
turtle.forward(args.exterior_leg-args.kerf if finger == 0 else args.horizontal_finger-args.kerf)
turtle.left(90)
turtle.forward(args.thickness)
turtle.right(90)
turtle.forward(args.horizontal_finger+args.kerf)
turtle.right(90)
turtle.forward(args.thickness)
turtle.left(90)
turtle.forward(args.exterior_leg-args.kerf-args.thickness)
turtle.right(90)
for finger in range(args.n_ver_fingers):
turtle.forward(args.vertical_finger-(args.kerf/2 if finger==0 else args.kerf))
turtle.left(90)
turtle.forward(args.thickness)
turtle.right(90)
turtle.forward(args.vertical_finger+args.kerf)
turtle.right(90)
if finger < args.n_ver_fingers-1:
turtle.forward(args.thickness)
turtle.left(90)
turtle.forward(args.exterior_edge-args.thickness)
turtle.right(90)
for finger in range(args.n_ver_fingers):
turtle.forward(args.vertical_finger-(args.kerf/2 if finger==0 else args.kerf))
turtle.left(90)
turtle.forward(args.thickness)
turtle.right(90)
turtle.forward(args.vertical_finger+args.kerf)
turtle.right(90)
if finger < args.n_ver_fingers-1:
turtle.forward(args.thickness)
turtle.left(90)
print('<path d="%s" fill="none" stroke="black"/>' % turtle.to_s())
for slot in slots:
x = x0+args.exterior_slot
y = y0+slot
w = args.horizontal_finger-args.kerf
h = args.thickness-args.kerf
print('<rect x="%.2f" y="%.2f" width="%.2f" height="%.2f" fill="none" stroke="black"/>' % (x, y, w, h))
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+0.5), GRID*(0.5*args.dimension+1))
draw_grid(GRID*(1.5*args.dimension+1.5), 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))
draw_grid(0.65*args.grid*args.dimension, 0.60*args.grid*args.dimension)
draw_plane(0.65*args.grid*args.dimension, 0.60*args.grid*args.dimension, True)
draw_grid(1.90*args.grid*args.dimension, 0.60*args.grid*args.dimension)
draw_plane(1.90*args.grid*args.dimension, 0.60*args.grid*args.dimension, True)
draw_plane(0.65*args.grid*args.dimension, 1.90*args.grid*args.dimension)
draw_side(0.05*args.grid*args.dimension, 2.50*args.grid*args.dimension, args.height, [args.height*.3, args.height*.7])
draw_side(0.75*args.grid*args.dimension, 2.50*args.grid*args.dimension, args.height, [args.height*.3, args.height*.7])
draw_side(1.45*args.grid*args.dimension, 2.50*args.grid*args.dimension, args.height, [args.height*.3, args.height*.7])
draw_side(2.15*args.grid*args.dimension, 2.50*args.grid*args.dimension, args.height, [args.height*.3, args.height*.7])
draw_side(1.35*args.grid*args.dimension, 1.25*args.grid*args.dimension, args.height, [args.height*.3, args.height*.7])
draw_side(2.05*args.grid*args.dimension, 1.25*args.grid*args.dimension, args.height, [args.height*.3, args.height*.7])
print('</svg>')