Tweak placement

This commit is contained in:
Matthias Neeracher 2021-11-24 05:07:43 +01:00
parent bcf34f8976
commit eeb07bfb44

View File

@ -52,7 +52,7 @@ args.plug_edge = args.interior_edge-args.thickness
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
finger_length = args.interior_edge-2.0*args.corner_inset finger_length = args.interior_edge-2.0*args.corner_inset
args.n_hor_fingers = int(finger_length/args.horizontal_finger/2) args.n_hor_fingers = max(int(finger_length/args.horizontal_finger/2), 1)
args.exterior_leg = (finger_length-(2*args.n_hor_fingers-1)*args.horizontal_finger+args.kerf)/2 args.exterior_leg = (finger_length-(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.exterior_slot = (args.exterior_edge-args.horizontal_finger+args.kerf)/2
args.n_ver_fingers = int(args.height/args.vertical_finger/2) args.n_ver_fingers = int(args.height/args.vertical_finger/2)
@ -62,8 +62,9 @@ args.slots = [args.vertical_finger*2.5-args.thickness*0.5, args.vertical
if args.verbose: if args.verbose:
print(args, file=sys.stderr) print(args, file=sys.stderr)
DIMX = 5.0*args.grid*args.dimension BOX = 2.0*args.exterior_edge+5.0
DIMY = 2.5*args.grid*args.dimension+args.height+3.0*args.thickness DIMX = 3.0*BOX
DIMY = 2.0*BOX+args.height+3.0*args.thickness
PI3 = math.pi/3 PI3 = math.pi/3
HOLES = '' HOLES = ''
@ -289,15 +290,15 @@ def draw_case(x0, y0, h, slots):
HOLES += '<rect x="%.2f" y="%.2f" width="%.2f" height="%.2f"/>\n' % (x, y, w, h) HOLES += '<rect x="%.2f" y="%.2f" width="%.2f" height="%.2f"/>\n' % (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)) 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(0.65*args.grid*args.dimension, 0.60*args.grid*args.dimension) draw_grid(0.5*BOX, 0.5*BOX)
draw_plane(0.65*args.grid*args.dimension, 0.60*args.grid*args.dimension, 'interior') draw_plane(0.5*BOX, 0.5*BOX, 'interior')
draw_grid(1.90*args.grid*args.dimension, 0.60*args.grid*args.dimension) draw_grid(1.5*BOX, 0.5*BOX)
draw_plane(1.90*args.grid*args.dimension, 0.60*args.grid*args.dimension, 'interior') draw_plane(1.5*BOX, 0.5*BOX, 'interior')
draw_plane(3.15*args.grid*args.dimension, 0.60*args.grid*args.dimension, 'bottom') draw_plane(0.5*BOX, 1.5*BOX, 'bottom')
draw_plane(0.65*args.grid*args.dimension, 1.70*args.grid*args.dimension, 'rim') draw_plane(1.5*BOX, 1.5*BOX, 'rim')
draw_plane(0.65*args.grid*args.dimension, 1.70*args.grid*args.dimension, 'plug') draw_plane(1.5*BOX, 1.5*BOX, 'plug')
draw_plane(2.00*args.grid*args.dimension, 1.70*args.grid*args.dimension, 'lid') draw_plane(2.5*BOX, 1.5*BOX, 'lid')
draw_plane(2.00*args.grid*args.dimension, 1.70*args.grid*args.dimension, 'plug_mark') draw_plane(2.5*BOX, 1.5*BOX, 'plug_mark')
draw_case(0.05*args.grid*args.dimension, 2.30*args.grid*args.dimension, args.height, args.slots) draw_case(0.05*args.grid*args.dimension, 2.0*BOX, args.height, args.slots)
print('<g fill="none" stroke="red">', HOLES, '</g>', '<g fill="none" stroke="blue">', MARKS, '</g>', '<g fill="none" stroke="black">', SHAPES, '</g>', sep='\n') print('<g fill="none" stroke="red">', HOLES, '</g>', '<g fill="none" stroke="blue">', MARKS, '</g>', '<g fill="none" stroke="black">', SHAPES, '</g>', sep='\n')
print('</svg>') print('</svg>')