import sand3d as s3d
def tray_trolley():
root = s3d.at(tubular_frame(), x=62.5, y=-58, z=121)
a = s3d.at(handle_end_caster(), x=-85, y=-302, z=22)
b = s3d.at(handle_end_caster(tire_joint=&class="tok-comment">#39;joint_tire_04_joint_0039;), x=210, y=-302, z=22)
c = s3d.at(tray_end_caster(), x=-85, y=221, z=22)
d = s3d.at(tray_end_caster(tire_joint=&class="tok-comment">#39;joint_tire_02_joint_0039;), x=210, y=221, z=22)
s3d.joint(&class="tok-comment">#39;joint_wheel_03_joint_00class="tok-string">39;, a, on=s3d.local(root, x=-147.5, y=-205, z=-3), kind=39;continuousclass="tok-string">39;, axis=39;+Z39;)
s3d.joint(&class="tok-comment">#39;joint_wheel_04_joint_00class="tok-string">39;, b, on=s3d.local(root, x=147.5, y=-205, z=-3), kind=39;continuousclass="tok-string">39;, axis=39;+Z39;)
s3d.joint(&class="tok-comment">#39;joint_wheel_01_joint_00class="tok-string">39;, c, on=s3d.local(root, x=-147.5, y=318, z=-3), kind=39;continuousclass="tok-string">39;, axis=39;+Z39;)
s3d.joint(&class="tok-comment">#39;joint_wheel_02_joint_00class="tok-string">39;, d, on=s3d.local(root, x=147.5, y=318, z=-3), kind=39;continuousclass="tok-string">39;, axis=39;+Z39;)
return s3d.assembly(&class="tok-comment">#39;tray_trolley39;, root, a, b, c, d)
def tubular_frame(tube=25, span=113, front=-306, back=419, low=142, upper=732, tall=916, foot=147.5, foot_front=-205, foot_back=318, tray_w=337, tray_d=752, tray_y=89, tray_z=785, sheet=3, lip=20, handle_w=348, handle_y=-480, handle_z=810, bend=30):
solids = []
for side in (-1, 1):
x = side*span/2
for end, fy, top in ((front, foot_front, tall), (back, foot_back, upper)):
path = [(side*foot, fy, 0), (side*foot, fy, bend), (x, end, low), (x, end, top)]
if end == front:
path += [(side*handle_w/2, handle_y+bend, handle_z+bend), (side*handle_w/2, handle_y, handle_z)]
solids.append(s3d.wire(&class="tok-comment">#39;upright39;, path=path, d=tube, fillet=bend/2))
for z in (low, upper):
solids.append(s3d.wire(&class="tok-comment">#39;long_rail39;, path=[(x, front, z), (x, back, z)], d=tube))
for end, fy in ((front, foot_front), (back, foot_back)):
solids.append(s3d.wire(&class="tok-comment">#39;brace39;, path=[(x, fy, low), (side*foot, fy, bend)], d=tube*0.8))
for y in (front, back):
solids.append(s3d.wire(&class="tok-comment">#39;crossbar39;, path=[(-span/2,y,low),(span/2,y,low)], d=tube))
solids.append(s3d.wire(&class="tok-comment">#39;handle_crossbar39;, path=[(-handle_w/2,handle_y,handle_z),(handle_w/2,handle_y,handle_z)], d=tube))
tray = s3d.at(s3d.box(&class="tok-comment">#39;tray_sheet39;, w=tray_w, d=tray_d, h=sheet), y=tray_y, z=tray_z)
for side in (-1,1):
edge = s3d.at(s3d.box(&class="tok-comment">#39;tray_lip39;, w=sheet, d=tray_d, h=lip), x=side*(tray_w-sheet)/2, y=tray_y, z=tray_z)
s3d.join(tray, edge)
end = s3d.at(s3d.box(&class="tok-comment">#39;end_fold39;, w=tray_w, d=sheet, h=lip), y=tray_y+tray_d/2-sheet/2, z=tray_z)
s3d.join(tray, end)
solids.append(tray)
for solid in solids:
s3d.material(solid, &class="tok-comment">#39;brushed_steelclass="tok-string">39;, color=39;#a4a8aa39;)
return s3d.group(&class="tok-comment">#39;tubular_frame39;, solids)
def handle_end_caster(w=43, d=128, h=99, tire_joint=&class="tok-comment">#39;joint_tire_03_joint_0039;):
cover = caster_cover(w=w, d=d, h=h)
tire = s3d.at(handle_end_tire(), y=11, z=-21)
part = s3d.group(&class="tok-comment">#39;handle_end_caster39;, cover, tire)
s3d.joint(tire_joint, tire, on=s3d.local(part, x=0, y=11, z=31), kind=&class="tok-comment">#39;continuousclass="tok-string">39;, axis=39;-X39;)
return part
def caster_cover(w=43, d=128, h=99, axle_y=11, axle_z=31, outer=58, wall=3, sweep=-35, brake_y=-59, brake_h=68):
outline = s3d.poly([s3d.arc(center=(axle_y,axle_z), r=outer, start=sweep, end=180), (-47,axle_z), s3d.arc(center=(axle_y,axle_z), r=outer-wall, start=180, end=sweep)])
cover = s3d.extrude(&class="tok-comment">#39;curved_cover39;, outline, h=w)
cover = s3d.at(cover, x=-w/2, rx=90, rz=90)
stem = s3d.at(s3d.cylinder(&class="tok-comment">#39;swivel39;, d=w*0.7, h=h/2), y=39, z=h/2)
brake = s3d.extrude(&class="tok-comment">#39;brake39;, s3d.stroke(s3d.spline([(brake_y-5,0),(brake_y+8,18),(brake_y+12,40),(brake_y+8,brake_h)]), t=wall*2), h=w*0.7)
brake = s3d.at(brake, x=-w*0.7/2, rx=90, rz=90)
for solid in (cover,stem,brake):
s3d.material(solid, &class="tok-comment">#39;painted_metalclass="tok-string">39;, color=39;#70767939;)
return s3d.group(&class="tok-comment">#39;caster_cover39;, cover, stem, brake)
def handle_end_tire(w=71, d=105):
tire = rounded_tire(w=w, d=d)
return s3d.group(&class="tok-comment">#39;handle_end_tire39;, tire)
def rounded_tire(w=71, d=105, disc=19, hub=66, rounding=4):
a = s3d.cylinder(&class="tok-comment">#39;wheel_disc39;, d=d, h=disc)
s3d.fillet(a, r=rounding, edges=&class="tok-comment">#39;top bottom39;)
b = s3d.at(s3d.copy(a), z=w-disc)
core = s3d.at(s3d.cylinder(&class="tok-comment">#39;wheel_hub39;, d=hub, h=w-disc), z=disc/2)
wheel = s3d.join(a, b, core)
wheel = s3d.at(wheel, x=-w/2, z=d/2, ry=90)
s3d.material(wheel, &class="tok-comment">#39;rubberclass="tok-string">39;, color=39;#51575a39;)
return wheel
def tray_end_caster(w=44, d=128, h=99, tire_joint=&class="tok-comment">#39;joint_tire_01_joint_0039;):
cover = caster_cover(w=w, d=d, h=h)
tire = s3d.at(tray_end_tire(), y=10, z=-21)
part = s3d.group(&class="tok-comment">#39;tray_end_caster39;, cover, tire)
s3d.joint(tire_joint, tire, on=s3d.local(part, x=0, y=10, z=31), kind=&class="tok-comment">#39;continuousclass="tok-string">39;, axis=39;-X39;)
return part
def tray_end_tire(w=70, d=105):
tire = rounded_tire(w=w, d=d)
return s3d.group(&class="tok-comment">#39;tray_end_tire39;, tire)