Draw rounded hexagonal base plate
This commit is contained in:
parent
d2a9a0b8e0
commit
144f6d951e
|
@ -18,7 +18,7 @@ parser.add_argument('--padding', default=1.5, type=float, help='Padding around h
|
|||
parser.add_argument('--outside-padding', default=4, type=float, help='Extra padding between holes and wall')
|
||||
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('--verbose', action='store_true', help='Print computed parameter values')
|
||||
args = parser.parse_args()
|
||||
assert (args.dimension % 2) == 1
|
||||
|
||||
|
@ -46,15 +46,17 @@ args.corner_s = args.corner*args.stretch
|
|||
args.corner_radius = 3*args.corner_s/math.pi
|
||||
args.corner_inset = args.corner_s*math.sqrt(3)/math.pi
|
||||
args.interior_edge = args.grid*args.dimension*0.5+args.outside_padding
|
||||
args.exterior_edge = args.interior_edge+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.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
|
||||
finger_length = args.interior_edge-2.0*args.corner_inset
|
||||
args.n_hor_fingers = int(finger_length/args.horizontal_finger/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.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]
|
||||
|
||||
if args.verbose:
|
||||
print(args, file=sys.stderr)
|
||||
|
||||
DIMX = 5.0*args.grid*args.dimension
|
||||
|
@ -74,7 +76,7 @@ def draw_grid(cx, cy):
|
|||
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
|
||||
global HOLES, SHAPES
|
||||
if interior:
|
||||
edge = args.interior_edge
|
||||
else:
|
||||
|
@ -96,25 +98,60 @@ def draw_plane(cx, cy, interior=False):
|
|||
turtle.forward(args.thickness)
|
||||
turtle.left(90)
|
||||
turtle.forward(args.interior_leg)
|
||||
turtle.circle(-args.corner_radius, 60, 5)
|
||||
turtle.circle(-args.corner_radius, 60)
|
||||
turtle.forward(args.interior_edge-2.0*args.corner_inset)
|
||||
turtle.circle(-args.corner_radius, 60, 5)
|
||||
turtle.circle(-args.corner_radius, 60)
|
||||
else:
|
||||
turtle.pendown()
|
||||
for side in range(6):
|
||||
turtle.forward(args.exterior_edge)
|
||||
turtle.right(60)
|
||||
SHAPES += '<path d="%s"/>\n' % turtle.to_s()
|
||||
if not interior:
|
||||
turtle.reset()
|
||||
turtle.penup()
|
||||
turtle.forward(args.interior_edge)
|
||||
turtle.right(120)
|
||||
turtle.forward(args.corner_inset)
|
||||
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)
|
||||
turtle.forward(args.thickness)
|
||||
turtle.pendown()
|
||||
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.right(90)
|
||||
turtle.forward(args.horizontal_finger-args.kerf)
|
||||
turtle.penup()
|
||||
turtle.right(180)
|
||||
turtle.forward(args.horizontal_finger-args.kerf)
|
||||
turtle.forward(args.exterior_leg)
|
||||
turtle.pendown()
|
||||
turtle.left(90)
|
||||
turtle.forward(args.thickness)
|
||||
turtle.right(90)
|
||||
turtle.forward(args.exterior_leg)
|
||||
turtle.right(60)
|
||||
turtle.forward(args.exterior_edge)
|
||||
SHAPES += '<path d="%s"/>\n' % turtle.to_s()
|
||||
turtle.circle(-args.corner_radius-args.thickness, 60)
|
||||
turtle.right(90)
|
||||
turtle.forward(args.thickness)
|
||||
turtle.right(90)
|
||||
turtle.circle(args.corner_radius, 60)
|
||||
turtle.penup()
|
||||
turtle.right(180)
|
||||
turtle.circle(-args.corner_radius, 60)
|
||||
turtle.forward(args.interior_edge-2*args.corner_inset)
|
||||
turtle.pendown()
|
||||
turtle.left(90)
|
||||
turtle.forward(args.thickness)
|
||||
turtle.right(90)
|
||||
turtle.circle(-args.corner_radius-args.thickness, 60)
|
||||
turtle.right(90)
|
||||
turtle.forward(args.thickness)
|
||||
turtle.right(90)
|
||||
turtle.circle(args.corner_radius, 60)
|
||||
HOLES += '<path d="%s"/>\n' % turtle.to_s()
|
||||
|
||||
def draw_side(x0, y0, h, slots):
|
||||
global HOLES, SHAPES
|
||||
|
|
Loading…
Reference in New Issue
Block a user