import sand3d as s3d
def tool_cart():
root = s3d.at(frame(), y=24.5, z=21)
fork = s3d.at(swivel_bracket(), x=117, y=312, z=18)
twin = s3d.transform(s3d.at(swivel_bracket(wheel_joint=class="tok-string">"joint_wheel_04_joint_00"), x=117, y=312, z=18), mirror=class="tok-string">"x")
s3d.joint(class="tok-string">"joint_wh_03_joint_00", fork, s3d.local(root, x=122, y=280.5, z=47), kind=class="tok-string">"continuous", axis=class="tok-string">"+Z")
s3d.joint(class="tok-string">"joint_wh_04_joint_00", twin, s3d.local(root, x=-123, y=280.5, z=47), kind=class="tok-string">"continuous", axis=class="tok-string">"+Z")
low = s3d.at(lower_drawer(), x=13.5, z=536)
s3d.joint(class="tok-string">"joint_drawer_02_joint_00", low, s3d.local(root, x=0, y=-24.5, z=-21), kind=class="tok-string">"prismatic", axis=class="tok-string">"+X", range=(0, 200))
wheel = s3d.at(fixed_wheel(), x=122, y=-302)
image = s3d.transform(s3d.copy(wheel), mirror=class="tok-string">"x")
s3d.joint(class="tok-string">"joint_wheel_01_joint_00", wheel, s3d.local(root, x=122, y=-326.5, z=10), kind=class="tok-string">"continuous", axis=class="tok-string">"+X")
s3d.joint(class="tok-string">"joint_wheel_02_joint_00", image, s3d.local(root, x=-123, y=-326.5, z=10), kind=class="tok-string">"continuous", axis=class="tok-string">"+X")
high = s3d.at(upper_drawer(), x=13.5, z=628)
s3d.joint(class="tok-string">"joint_drawer_01_joint_00", high, s3d.local(root, x=0, y=-24.5, z=-21), kind=class="tok-string">"prismatic", axis=class="tok-string">"+X", range=(0, 200))
return s3d.assembly(class="tok-string">"tool_cart", root, fork, twin, low, wheel, image, high)
def frame(w=350, d=700, top=780, base=21, shift=24.5, t=3, post=35, shelf_w=342, shelf_d=692, rim=88, bottom=73, middle=314, tray=722, tray_rim=58, panel_bottom=413, panel_top=722, strip_d=77, strip_t=8, grip_d=27, grip_y=460, grip_z=731, back_bottom=535, back_h=163):
solids = []
for y in (-d/2, d/2-post):
a = s3d.at(s3d.box(class="tok-string">"post_flange", w=t, d=post, h=top-bottom), x=w/2-t/2, y=y+post/2-shift, z=bottom-base)
b = s3d.at(s3d.box(class="tok-string">"post_return", w=post, d=t, h=top-bottom), x=w/2-post/2, y=y+t/2-shift if y < 0 else y+post-t/2-shift, z=bottom-base)
angle = s3d.join(a, b)
solids.extend([angle, s3d.transform(s3d.copy(angle), mirror=class="tok-string">"x")])
for z in (bottom, middle):
shelf = s3d.shell(s3d.box(class="tok-string">"shelf", w=shelf_w, d=shelf_d, h=rim), t=t, open=class="tok-string">"top")
solids.append(s3d.at(shelf, y=-shift, z=z-base))
tray_solid = s3d.shell(s3d.box(class="tok-string">"top_tray", w=shelf_w, d=shelf_d, h=tray_rim), t=t, open=class="tok-string">"top")
solids.append(s3d.at(tray_solid, y=-shift, z=tray-base))
solids.append(s3d.at(s3d.box(class="tok-string">"rear_enclosure", w=t, d=shelf_d, h=back_h), x=-shelf_w/2+t/2, y=-shift, z=back_bottom-base))
for y in (-d/2+t/2, d/2-t/2):
solids.append(s3d.at(s3d.box(class="tok-string">"end_panel", w=w-post*2, d=t, h=panel_top-panel_bottom), y=y-shift, z=panel_bottom-base))
strip = s3d.extrude(class="tok-string">"perforated_rim", s3d.rect(w=w, d=strip_d, r=strip_d/5), h=strip_t)
s3d.hole(strip, d=grip_d, on=s3d.grid(nx=6, px=(w-post*2)/5))
solids.append(s3d.at(strip, y=-d/2-strip_d/2-shift, z=top-strip_t-base))
grip = s3d.at(s3d.cylinder(class="tok-string">"push_grip", d=grip_d, h=w-post*2), x=-(w-post*2)/2, y=grip_y-shift, z=grip_z-base, ry=90)
solids.append(grip)
support = s3d.extrude(class="tok-string">"handle_cheek", s3d.poly([(d/2,top),(d/2+post,top-post/2),s3d.tangent_arc(to=(grip_y,grip_z+grip_d/2)),(grip_y,grip_z-grip_d/2),(d/2,grip_z-post/2)]), h=t)
support = s3d.at(support, x=(w-post*2)/2, y=-shift, z=-base, rx=90, rz=90)
solids.extend([support, s3d.transform(s3d.copy(support), mirror=class="tok-string">"x")])
for x in (-122,122):
for y in (-302,305):
mount = s3d.at(s3d.box(class="tok-string">"caster_plate", w=64, d=64, h=t), x=x, y=y-shift, z=bottom-t-base)
solids.append(mount)
for xside in (-1,1):
solids.append(s3d.at(s3d.box(class="tok-string">"fixed_fork", w=t, d=post, h=post), x=x+xside*grip_d/2, y=-302-shift, z=post-base))
result = s3d.group(class="tok-string">"frame", solids)
s3d.material(result, kind=class="tok-string">"painted_metal", color=class="tok-string">"class="tok-comment">#646b70")
return result
def swivel_bracket(w=38, d=59, h=50, t=3, axle=13, wheel_joint=class="tok-string">"joint_wheel_03_joint_00"):
cap = s3d.at(s3d.cylinder(class="tok-string">"swivel", d=w, h=t*2), x=5, y=-7, z=h-t*2)
cheeks = []
for x in (-w/2+t/2,w/2-t/2):
cheeks.append(s3d.at(s3d.box(class="tok-string">"fork_cheek", w=t, d=d, h=h-t), x=x, z=0))
solid = s3d.group(class="tok-string">"fork", cap, cheeks)
s3d.material(solid, kind=class="tok-string">"steel", color=class="tok-string">"class="tok-comment">#93999d")
wheel = s3d.at(swivel_wheel(), x=5, y=5, z=-18)
result = s3d.group(class="tok-string">"swivel_bracket", solid, wheel)
s3d.joint(wheel_joint, wheel, s3d.local(solid, x=5, y=5, z=13), kind=class="tok-string">"continuous", axis=class="tok-string">"+X")
return result
def swivel_wheel(w=22, d=62):
tire = s3d.at(s3d.cylinder(class="tok-string">"tire", d=d, h=w), x=-w/2, z=d/2, ry=90)
s3d.material(tire, kind=class="tok-string">"rubber", color=class="tok-string">"class="tok-comment">#303236")
return s3d.group(class="tok-string">"swivel_wheel", tire)
def lower_drawer(w=334, d=626, h=91, t=2, offset=13.5, pull_d=23, pull_l=602, pull_x=182, pull_z=78):
tray = s3d.shell(s3d.box(class="tok-string">"drawer_pan", w=w, d=d, h=h), t=t, open=class="tok-string">"top")
tray = s3d.at(tray, x=-offset)
pull = s3d.at(s3d.box(class="tok-string">"drawer_pull", w=pull_d, d=pull_l, h=pull_d), x=pull_x-offset, z=pull_z-pull_d/2)
s3d.fillet(pull, r=t, edges=class="tok-string">"all")
result = s3d.group(class="tok-string">"lower_drawer", tray, pull)
s3d.material(result, kind=class="tok-string">"painted_metal", color=class="tok-string">"class="tok-comment">#646b70")
return result
def fixed_wheel(w=22, d=62):
tire = s3d.at(s3d.cylinder(class="tok-string">"tire", d=d, h=w), x=-w/2, z=d/2, ry=90)
s3d.material(tire, kind=class="tok-string">"rubber", color=class="tok-string">"class="tok-comment">#303236")
return s3d.group(class="tok-string">"fixed_wheel", tire)
def upper_drawer(w=334, d=626, h=91, t=2, offset=13.5, pull_d=23, pull_l=602, pull_x=182, pull_z=78):
tray = s3d.shell(s3d.box(class="tok-string">"drawer_pan", w=w, d=d, h=h), t=t, open=class="tok-string">"top")
tray = s3d.at(tray, x=-offset)
pull = s3d.at(s3d.box(class="tok-string">"drawer_pull", w=pull_d, d=pull_l, h=pull_d), x=pull_x-offset, z=pull_z-pull_d/2)
s3d.fillet(pull, r=t, edges=class="tok-string">"all")
result = s3d.group(class="tok-string">"upper_drawer", tray, pull)
s3d.material(result, kind=class="tok-string">"painted_metal", color=class="tok-string">"class="tok-comment">#646b70")
return result