Flex case experiment: Not structurally sound
This commit is contained in:
parent
5dd4fe4117
commit
bf1433afe7
|
@ -47,20 +47,26 @@ args.exterior_leg = (args.exterior_edge-(2*args.n_hor_fingers-1)*args.horizonta
|
|||
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
|
||||
args.slots = [args.vertical_finger*2.5-args.thickness*0.5, args.vertical_finger*4.5-args.thickness*0.5]
|
||||
|
||||
DIMX = 2.9*args.grid*args.dimension
|
||||
DIMY = 3.8*args.grid*args.dimension
|
||||
DIMX = 5.0*args.grid*args.dimension
|
||||
DIMY = 3.0*args.grid*args.dimension
|
||||
PI3 = math.pi/3
|
||||
|
||||
HOLES = ''
|
||||
SHAPES = ''
|
||||
|
||||
def draw_grid(cx, cy):
|
||||
global HOLES
|
||||
for row in range(-int(args.dimension/2), int((args.dimension+1)/2)):
|
||||
cyr = cy+args.grid*row*math.sin(PI3)
|
||||
num_col = args.dimension-abs(row)
|
||||
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*args.grid, cyr, args.radius))
|
||||
HOLES += '<circle cx="%.2f" cy="%.2f" r="%.2f"/>\n' % (cxr+col*args.grid, cyr, args.radius)
|
||||
|
||||
def draw_plane(cx, cy, interior=False):
|
||||
global SHAPES
|
||||
if interior:
|
||||
edge = args.interior_edge
|
||||
else:
|
||||
|
@ -71,7 +77,7 @@ def draw_plane(cx, cy, interior=False):
|
|||
turtle.right(120)
|
||||
turtle.pendown()
|
||||
if interior:
|
||||
for side in range(6):
|
||||
for side in range(5):
|
||||
turtle.forward(args.interior_leg)
|
||||
turtle.left(90)
|
||||
turtle.forward(args.thickness)
|
||||
|
@ -82,8 +88,9 @@ def draw_plane(cx, cy, interior=False):
|
|||
turtle.left(90)
|
||||
turtle.forward(args.interior_leg)
|
||||
turtle.right(60)
|
||||
turtle.forward(args.interior_edge)
|
||||
else:
|
||||
for side in range(6):
|
||||
for side in range(5):
|
||||
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)
|
||||
|
@ -95,9 +102,11 @@ def draw_plane(cx, cy, interior=False):
|
|||
turtle.right(90)
|
||||
turtle.forward(args.exterior_leg)
|
||||
turtle.right(60)
|
||||
print('<path d="%s" fill="none" stroke="black"/>' % turtle.to_s())
|
||||
turtle.forward(args.exterior_edge)
|
||||
SHAPES += '<path d="%s"/>\n' % turtle.to_s()
|
||||
|
||||
def draw_side(x0, y0, h, slots):
|
||||
global HOLES, SHAPES
|
||||
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)
|
||||
|
@ -132,24 +141,94 @@ def draw_side(x0, y0, h, slots):
|
|||
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())
|
||||
SHAPES += '<path d="%s"/>\n' % 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))
|
||||
HOLES += '<rect x="%.2f" y="%.2f" width="%.2f" height="%.2f"/>\n' % (x, y, w, h)
|
||||
|
||||
def draw_case(x0, y0, h, slots):
|
||||
global HOLES, SHAPES
|
||||
turtle = svgturtle.SvgTurtle(x0, y0)
|
||||
turtle.forward(args.exterior_edge*0.5)
|
||||
for side in range(6):
|
||||
turtle.right(90)
|
||||
turtle.forward(args.height-args.thickness)
|
||||
turtle.penup()
|
||||
turtle.back(args.height-args.thickness)
|
||||
turtle.left(90)
|
||||
turtle.forward(2*args.thickness)
|
||||
turtle.right(90)
|
||||
turtle.pendown()
|
||||
turtle.forward(args.height-args.thickness)
|
||||
turtle.penup()
|
||||
turtle.back(args.height-args.thickness)
|
||||
turtle.left(90)
|
||||
turtle.pendown()
|
||||
if side==5:
|
||||
break
|
||||
turtle.forward(args.exterior_edge-args.thickness*2)
|
||||
turtle.forward(args.exterior_edge*0.5-args.thickness*2)
|
||||
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*0.5)
|
||||
for side in range(6):
|
||||
turtle.right(90)
|
||||
turtle.forward(args.height-args.thickness)
|
||||
turtle.penup()
|
||||
turtle.back(args.height-args.thickness)
|
||||
turtle.left(90)
|
||||
turtle.pendown()
|
||||
if side==5:
|
||||
break
|
||||
for finger in range(args.n_hor_fingers):
|
||||
turtle.forward(args.exterior_leg 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)
|
||||
turtle.forward(args.exterior_edge*0.5)
|
||||
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)
|
||||
SHAPES += '<path d="%s"/>\n' % turtle.to_s()
|
||||
for slot in slots:
|
||||
for side in range(5):
|
||||
x = x0+(side+0.5)*args.exterior_edge+args.thickness+args.exterior_slot
|
||||
y = y0+slot
|
||||
w = args.horizontal_finger-args.kerf
|
||||
h = args.thickness-args.kerf
|
||||
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))
|
||||
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_plane(3.15*args.grid*args.dimension, 0.60*args.grid*args.dimension)
|
||||
draw_case(0.05*args.grid*args.dimension, 1.25*args.grid*args.dimension, args.height, args.slots)
|
||||
print('<g fill="none" stroke="red">', HOLES, '</g>', '<g fill="none" stroke="black">', SHAPES, '</g>', sep='\n')
|
||||
print('</svg>')
|
||||
|
|
Loading…
Reference in New Issue
Block a user