5AA design works all around

This commit is contained in:
Matthias Neeracher 2022-02-28 00:29:14 +01:00
parent cbc847ea42
commit 5888485b16

View File

@ -20,8 +20,10 @@ parser.add_argument('--extra-height', default=2.0, type=float, help='Extra verti
parser.add_argument('--thickness', default=3.0, type=float, help='Thickness of material') parser.add_argument('--thickness', default=3.0, type=float, help='Thickness of material')
parser.add_argument('--lid', default=0.2, type=float, help='How much extra play to give the lid') parser.add_argument('--lid', default=0.2, type=float, help='How much extra play to give the lid')
parser.add_argument('--tooth', default=0.8, type=float, help='How much to round the edges of the teeth') parser.add_argument('--tooth', default=0.8, type=float, help='How much to round the edges of the teeth')
parser.add_argument('--flex-granularity', default=1.8, type=float, help='How much space to give a pair of flex lines') parser.add_argument('--flex-width', default=.5, type=float, help='Spacing (in material thickness) between flex lines')
parser.add_argument('--plug-play', default=0.3, type=float, help='How much smaller to make the plug than the hole') parser.add_argument('--flex-cut', default=5.0, type=float, help='Length (in material thickness) of flex cuts')
parser.add_argument('--flex-gap', default=1.0, type=float, help='Gap (in material thickness) between flex cuts')
parser.add_argument('--plug-play', default=0.8, type=float, help='How much smaller to make the plug than the hole')
parser.add_argument('--verbose', action='store_true', help='Print computed parameter values') parser.add_argument('--verbose', action='store_true', help='Print computed parameter values')
args = parser.parse_args() args = parser.parse_args()
assert (args.dimension % 2) == 1 assert (args.dimension % 2) == 1
@ -55,7 +57,7 @@ while not SUITABLE:
args.plug_inset = args.plug_radius/math.sqrt(3) args.plug_inset = args.plug_radius/math.sqrt(3)
args.interior_edge = args.grid*args.dimension*0.5+args.outside_padding args.interior_edge = args.grid*args.dimension*0.5+args.outside_padding
args.opening_edge = args.interior_edge-args.thickness args.opening_edge = args.interior_edge-args.thickness
args.plug_edge = args.opening_edge-args.plug_play args.plug_edge = min(args.opening_edge, .5*math.sqrt(3)*args.interior_edge)-args.plug_play
args.disc_radius = 0.45*(math.sqrt(3)-1)*args.plug_edge+args.plug_inset args.disc_radius = 0.45*(math.sqrt(3)-1)*args.plug_edge+args.plug_inset
args.exterior_edge = args.interior_edge+2.0*args.thickness args.exterior_edge = args.interior_edge+2.0*args.thickness
args.interior_leg = (args.interior_edge-args.horizontal_finger-args.kerf)/2-args.corner_inset args.interior_leg = (args.interior_edge-args.horizontal_finger-args.kerf)/2-args.corner_inset
@ -65,8 +67,8 @@ while not SUITABLE:
args.wall_leg = (args.interior_edge-args.corner-(2*args.n_hor_fingers-1)*args.horizontal_finger+args.kerf)/2 args.wall_leg = (args.interior_edge-args.corner-(2*args.n_hor_fingers-1)*args.horizontal_finger+args.kerf)/2
args.exterior_slot = (args.interior_edge-args.horizontal_finger+args.kerf)/2 args.exterior_slot = (args.interior_edge-args.horizontal_finger+args.kerf)/2
args.n_ver_fingers = int((args.height+args.extra_height)/args.vertical_finger) args.n_ver_fingers = int((args.height+args.extra_height)/args.vertical_finger)
top_slot = args.extra_height+args.thickness+0.5*args.height top_slot = args.extra_height+args.thickness+0.45*args.height
args.slots = [top_slot, top_slot+10.0] args.slots = [top_slot, top_slot+15.0]
if args.exterior_leg > 2: if args.exterior_leg > 2:
SUITABLE=True SUITABLE=True
else: else:
@ -210,45 +212,44 @@ def draw_plane(cx, cy, layer):
def draw_flex(t, h): def draw_flex(t, h):
global HOLES global HOLES
turtle = svgturtle.SvgTurtle(t.x, t.y) turtle = svgturtle.SvgTurtle(t.x, t.y)
al = h/3.0-args.thickness gap = args.flex_gap*args.thickness
bl = (h-args.thickness)/3.0-args.thickness ncut = max(int((h-gap) // (args.flex_cut*args.thickness)), 1)
nx = int(args.corner/args.flex_granularity) cut = ((h-gap) / ncut) - gap
dx = args.corner/(2*nx-1) dx = args.flex_width*args.thickness
for stripe in range(nx): nlines = int(args.corner // dx)
x0 = .5*(args.corner - nlines*dx)
turtle.forward(x0)
for line in range(nlines):
turtle.pendown()
if (line % 2) == 0:
turtle.right(90) turtle.right(90)
turtle.forward(0.5*al) turtle.forward(gap+cut)
for section in range(ncut-2):
turtle.penup() turtle.penup()
turtle.forward(args.thickness) turtle.forward(gap)
turtle.pendown() turtle.pendown()
turtle.forward(al) turtle.forward(gap+2*cut)
turtle.penup() turtle.penup()
turtle.forward(args.thickness) turtle.forward(gap)
if (ncut % 2) == 0:
turtle.pendown() turtle.pendown()
turtle.forward(al) turtle.forward(gap+cut)
turtle.penup()
turtle.forward(args.thickness)
turtle.pendown()
turtle.forward(0.5*al)
turtle.penup() turtle.penup()
turtle.left(90) turtle.left(90)
turtle.forward(dx) else:
turtle.left(90) turtle.left(90)
turtle.forward(args.thickness) if (ncut % 2) == 1:
turtle.pendown() turtle.forward(gap+cut)
turtle.forward(bl) for section in range(ncut-1-(ncut % 2)):
turtle.penup() turtle.penup()
turtle.forward(args.thickness) turtle.forward(gap)
turtle.pendown() turtle.pendown()
turtle.forward(bl) turtle.forward(gap+2*cut)
turtle.penup() turtle.penup()
turtle.forward(args.thickness) turtle.forward(gap)
turtle.pendown()
turtle.forward(bl)
turtle.penup()
turtle.forward(args.thickness)
turtle.right(90) turtle.right(90)
turtle.forward(dx) turtle.forward(dx)
turtle.pendown()
HOLES += '<path d="%s"/>\n' % turtle.to_s() HOLES += '<path d="%s"/>\n' % turtle.to_s()
def draw_case_h(turtle, h, top): def draw_case_h(turtle, h, top):