import sand3d as s3d
def toolbox():
base = s3d.at(tray_body(), x=0, y=0, z=0)
front = s3d.at(front_cover(), x=48, y=0, z=167)
handle = s3d.at(carry_handle(), x=0, y=0, z=205)
back = s3d.at(back_cover(), x=-47, y=0, z=166)
s3d.joint(&class="tok-comment">#39;joint_frontCover_01_joint_00class="tok-string">39;, front, on=s3d.local(base, x=95, y=0, z=176), kind=39;revoluteclass="tok-string">39;, axis=39;+Y39;, range=(0,90))
s3d.joint(&class="tok-comment">#39;joint_handle_01_joint_00class="tok-string">39;, handle, on=s3d.local(base, x=0, y=0, z=219), kind=39;revoluteclass="tok-string">39;, axis=39;+Y39;, range=(-90.5,90.5))
s3d.joint(&class="tok-comment">#39;joint_backCover_01_joint_00class="tok-string">39;, back, on=s3d.local(base, x=-94, y=0, z=176), kind=39;revoluteclass="tok-string">39;, axis=39;+Y39;, range=(-90,0))
return s3d.assembly(&class="tok-comment">#39;toolbox39;, base, front, handle, back)
def tray_body(w=201, d=452, lower=100, band=52, t=1.5, gap=1, floor_z=161, divider_h=42, tab_h=22, tab_w=20):
bottom = s3d.box(&class="tok-comment">#39;lower39;, w=w, d=d, h=lower)
middle = s3d.at(s3d.box(&class="tok-comment">#39;middle_tray39;, w=w, d=d, h=band), z=lower+gap)
top = s3d.at(s3d.shell(s3d.box(&class="tok-comment">#39;top_wallsclass="tok-string">39;, w=w, d=d, h=band), t=t, open=39;top bottom39;), z=lower+band+gap*2)
floor = s3d.at(s3d.box(&class="tok-comment">#39;tray_floor39;, w=w-t, d=d-t, h=t), z=floor_z-t)
divider = s3d.at(s3d.box(&class="tok-comment">#39;divider39;, w=t*2, d=d-t, h=divider_h), z=floor_z-t)
top = s3d.join(top, floor, divider)
tab_profile = s3d.poly([(-tab_w/2,0),(tab_w/2,0),(0,tab_h)])
tab = s3d.at(s3d.extrude(&class="tok-comment">#39;handle_mount39;, tab_profile, h=t), y=d/2+t, z=lower+band*2, rx=90)
other = s3d.transform(s3d.copy(tab), y=-d-t)
for ob in (bottom, middle, top, tab, other):
s3d.material(ob, kind=&class="tok-comment">#39;painted_metalclass="tok-string">39;, color=39;#344b4239;)
return s3d.group(&class="tok-comment">#39;tray_body39;, bottom, middle, top, tab, other)
def front_cover(w=108, d=456, h=54, t=1.5, rise=13, lip=5, end_drop=40):
roof = folded_lid(w=w, d=d, h=h, t=t, rise=rise, lip=lip, end_drop=end_drop)
return s3d.group(&class="tok-comment">#39;front_cover39;, roof)
def folded_lid(w, d, h, t, rise, lip, end_drop):
p = s3d.poly([(-w/2,h),(-w/2+rise,h),(-w/2+rise*1.5,h-rise),(w/2,h-rise),(w/2,h-rise-lip),(w/2-t,h-rise-lip),(w/2-t,h-rise-t),(-w/2+rise*1.5-t,h-rise-t),(-w/2+rise-t,h-t),(-w/2,h-t)])
roof = s3d.at(s3d.extrude(&class="tok-comment">#39;folded_roof39;, p, h=d), y=d/2, rx=90)
end_p = s3d.poly([(-w/2+rise,h-t),(w/2,h-rise-t),(w/2,h-end_drop),(w/2-lip,h-end_drop),(-w/2+rise,h-rise-t)])
end = s3d.at(s3d.extrude(&class="tok-comment">#39;end_skirt39;, end_p, h=t), y=d/2, rx=90)
other = s3d.transform(s3d.copy(end), y=-d+t)
roof = s3d.join(roof, end, other)
s3d.material(roof, kind=&class="tok-comment">#39;painted_metalclass="tok-string">39;, color=39;#344b4239;)
return roof
def carry_handle(d=482.3, h=140, tube=18, bend=25, grip_d=25, grip_l=197, center_h=127):
half = (d-tube)/2
path = [(0,-half,0),(0,-half,center_h-bend),(0,-half+bend,center_h),(0,half-bend,center_h),(0,half,center_h-bend),(0,half,0)]
bar = s3d.wire(&class="tok-comment">#39;handle_tube39;, path=path, d=tube, fillet=bend)
grip = s3d.cylinder(&class="tok-comment">#39;grip39;, d=grip_d, h=grip_l)
grip = s3d.fillet(grip, r=(grip_d-tube)/2, edges=&class="tok-comment">#39;top bottom39;)
grip = s3d.at(grip, y=grip_l/2, z=center_h, rx=90)
s3d.material(bar, kind=&class="tok-comment">#39;steelclass="tok-string">39;, color=39;#7c838539;)
s3d.material(grip, kind=&class="tok-comment">#39;rubberclass="tok-string">39;, color=39;#292b2b39;)
return s3d.group(&class="tok-comment">#39;carry_handle39;, bar, grip)
def back_cover(w=108, d=456, h=56, t=1.5, rise=14, lip=5, end_drop=41):
roof = folded_lid(w=w, d=d, h=h, t=t, rise=rise, lip=lip, end_drop=end_drop)
roof = s3d.transform(roof, mirror=&class="tok-comment">#39;x39;)
return s3d.group(&class="tok-comment">#39;back_cover39;, roof)