Compare commits
No commits in common. "5dd4fe4117144444299149b79da85fd6ab139e8c" and "16e60427d10866277ced518e42d380a3a3e29f89" have entirely different histories.
5dd4fe4117
...
16e60427d1
|
@ -36,43 +36,33 @@ else:
|
|||
args.hole = float(args.hole)
|
||||
assert(args.height != None)
|
||||
|
||||
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
|
||||
GRID = args.hole+args.padding
|
||||
RADIUS = args.hole/2
|
||||
DIMX = 2*(args.dimension+2)*GRID
|
||||
DIMY = (args.dimension+2)*GRID
|
||||
PI3 = math.pi/3
|
||||
|
||||
def draw_grid(cx, cy):
|
||||
for row in range(-int(args.dimension/2), int((args.dimension+1)/2)):
|
||||
cyr = cy+args.grid*row*math.sin(PI3)
|
||||
cyr = cy+GRID*row*math.sin(PI3)
|
||||
num_col = args.dimension-abs(row)
|
||||
cxr = cx-.5*args.grid*(num_col-1.0)
|
||||
cxr = cx-.5*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*args.grid, cyr, args.radius))
|
||||
print('<circle cx="%.2f" cy="%.2f" r="%.2f" stroke="black" fill="none"/>' % (cxr+col*GRID, cyr, RADIUS))
|
||||
|
||||
def draw_plane(cx, cy, interior=False):
|
||||
if interior:
|
||||
edge = args.interior_edge
|
||||
else:
|
||||
edge = args.exterior_edge
|
||||
radius = GRID*args.dimension*0.5+args.outside_padding
|
||||
if not interior:
|
||||
radius += args.thickness
|
||||
turtle = svgturtle.SvgTurtle(cx, cy)
|
||||
turtle.penup()
|
||||
turtle.forward(edge)
|
||||
turtle.forward(radius)
|
||||
turtle.right(120)
|
||||
turtle.pendown()
|
||||
if interior:
|
||||
leg = (radius-args.horizontal_finger-args.kerf)/2
|
||||
for side in range(6):
|
||||
turtle.forward(args.interior_leg)
|
||||
turtle.forward(leg)
|
||||
turtle.left(90)
|
||||
turtle.forward(args.thickness)
|
||||
turtle.right(90)
|
||||
|
@ -80,76 +70,16 @@ def draw_plane(cx, cy, interior=False):
|
|||
turtle.right(90)
|
||||
turtle.forward(args.thickness)
|
||||
turtle.left(90)
|
||||
turtle.forward(args.interior_leg)
|
||||
turtle.forward(leg)
|
||||
turtle.right(60)
|
||||
else:
|
||||
for side in range(6):
|
||||
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.left(90)
|
||||
turtle.forward(args.thickness)
|
||||
turtle.right(90)
|
||||
turtle.forward(args.exterior_leg)
|
||||
turtle.forward(radius)
|
||||
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(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])
|
||||
draw_grid(GRID*(0.5*args.dimension+1), GRID*(0.5*args.dimension+1))
|
||||
draw_plane(GRID*(0.5*args.dimension+1), GRID*(0.5*args.dimension+1), True)
|
||||
draw_plane(GRID*(1.5*args.dimension+3), GRID*(0.5*args.dimension+1))
|
||||
print('</svg>')
|
||||
|
|
Loading…
Reference in New Issue
Block a user