import sand3d as s3d
def tray_tower():
root = s3d.at(tower_frame(), z=23)
a = s3d.at(wheel_06(), x=286, y=724, z=1)
b = s3d.at(wheel_02(), x=-287, y=-724, z=1)
c = s3d.at(wheel_07(), x=-287, y=724, z=1)
d = s3d.at(wheel_04(), x=516, y=-724, z=1)
e = s3d.at(wheel_03(), x=286, y=-724, z=1)
f = s3d.at(wheel_08(), x=-517, y=724, z=1)
g = s3d.at(wheel_05(), x=516, y=724, z=1)
h = s3d.at(wheel_01(), x=-517, y=-724, z=1)
s3d.joint(&class="tok-comment">#39;joint_wheel_06_joint_00class="tok-string">39;, a, s3d.local(root, x=286, y=734, z=78), kind=39;continuousclass="tok-string">39;, axis=39;+Y39;)
s3d.joint(&class="tok-comment">#39;joint_wheel_02_joint_00class="tok-string">39;, b, s3d.local(root, x=-287, y=-734, z=78), kind=39;continuousclass="tok-string">39;, axis=39;+Y39;)
s3d.joint(&class="tok-comment">#39;joint_wheel_07_joint_00class="tok-string">39;, c, s3d.local(root, x=-287, y=734, z=78), kind=39;continuousclass="tok-string">39;, axis=39;+Y39;)
s3d.joint(&class="tok-comment">#39;joint_wheel_04_joint_00class="tok-string">39;, d, s3d.local(root, x=516, y=-734, z=78), kind=39;continuousclass="tok-string">39;, axis=39;+Y39;)
s3d.joint(&class="tok-comment">#39;joint_wheel_03_joint_00class="tok-string">39;, e, s3d.local(root, x=286, y=-734, z=78), kind=39;continuousclass="tok-string">39;, axis=39;+Y39;)
s3d.joint(&class="tok-comment">#39;joint_wheel_08_joint_00class="tok-string">39;, f, s3d.local(root, x=-517, y=734, z=78), kind=39;continuousclass="tok-string">39;, axis=39;+Y39;)
s3d.joint(&class="tok-comment">#39;joint_wheel_05_joint_00class="tok-string">39;, g, s3d.local(root, x=516, y=734, z=78), kind=39;continuousclass="tok-string">39;, axis=39;+Y39;)
s3d.joint(&class="tok-comment">#39;joint_wheel_01_joint_00class="tok-string">39;, h, s3d.local(root, x=-517, y=-734, z=78), kind=39;continuousclass="tok-string">39;, axis=39;+Y39;)
return s3d.assembly(&class="tok-comment">#39;tray_tower39;, root, a, b, c, d, e, f, g, h)
def tower_frame(w=1380, d=1406, t=15, pitch=195.5, first=368, count=8, rim_h=90, rim_w=400, rim_x=484, channel_w=300, channel_y=690, channel_d=74, channel_h=1540, channel_z=319, base_w=1500, base_d=350, base_y=575, base_h=210, base_z=23, chamfer=24, spine_w=600, spine_t=20, bin_w=540, bin_x=-415, bin_y=345, upper_z=1115):
solids = []
for i in range(count):
tray = make_tray(w=w, d=d, t=t, rim_h=rim_h, rim_w=rim_w, rim_x=rim_x, chamfer=chamfer, spine_t=spine_t)
solids.append(s3d.at(tray, z=first + i * pitch - t / 2))
for sign in (-1, 1):
back = s3d.at(s3d.box(&class="tok-comment">#39;channel_back39;, w=channel_w, d=t, h=channel_h), y=sign * (channel_y + channel_d / 2 - t / 2), z=channel_z)
legs = s3d.at(s3d.box(&class="tok-comment">#39;channel_flange39;, w=t, d=channel_d, h=channel_h), on=s3d.grid(nx=2, px=channel_w / 3), y=sign * channel_y, z=channel_z)
solids.extend([back, legs])
beam = s3d.extrude(&class="tok-comment">#39;base_end39;, s3d.rect(w=base_w, d=base_d, chamfer=chamfer), h=base_h)
clearance = s3d.at(s3d.box(&class="tok-comment">#39;wheel_clearance39;, w=base_w-chamfer*2, d=channel_d, h=base_h-channel_d), y=sign*(base_d/2-channel_d), z=-t)
beam = s3d.cut(beam, clearance)
solids.append(s3d.at(beam, y=sign * base_y, z=base_z))
cap = s3d.at(s3d.extrude(&class="tok-comment">#39;base_cap39;, s3d.rect(w=base_w, d=base_d, chamfer=chamfer), h=t * 2), y=sign * base_y, z=channel_z)
solids.append(cap)
risers = s3d.at(s3d.box(&class="tok-comment">#39;base_riser39;, w=t*2, d=base_d, h=channel_z-base_h), on=s3d.grid(nx=2, px=base_w-t*4), y=sign*base_y, z=base_h)
solids.append(risers)
large = s3d.shell(s3d.extrude(&class="tok-comment">#39;large_binclass="tok-string">39;, s3d.rect(w=bin_w, d=spine_w, r=chamfer), h=pitch, taper=-t/3), t=t/2, open=39;top39;)
solids.append(s3d.at(large, x=bin_x, y=sign * bin_y, z=first+pitch-t/2))
brace = s3d.wire(&class="tok-comment">#39;tray_brace39;, path=[(sign*rim_x, 0, first),(sign*rim_x, 0, first+pitch/2),(sign*rim_x, pitch/2, first+pitch)], d=spine_t)
solids.append(brace)
small = s3d.shell(s3d.extrude(&class="tok-comment">#39;small_binclass="tok-string">39;, s3d.rect(w=bin_w, d=spine_w/2-t, r=chamfer), h=pitch, taper=-t/3), t=t/2, open=39;top39;)
solids.append(s3d.at(small, on=s3d.grid(nx=1, ny=2, py=spine_w/2), x=bin_x, y=-bin_y, z=upper_z))
solids.append(s3d.at(s3d.box(&class="tok-comment">#39;central_base39;, w=spine_w, d=base_y * 2, h=base_h+t*2), z=base_z+chamfer))
solids.append(s3d.at(s3d.box(&class="tok-comment">#39;spine39;, w=spine_w, d=spine_t, h=channel_h - rim_h), z=channel_z))
for solid in solids:
s3d.material(solid, &class="tok-comment">#39;aluminiumclass="tok-string">39;, color=39;#92989b39;)
return s3d.group(&class="tok-comment">#39;tower_frame39;, solids)
def make_tray(w, d, t, rim_h, rim_w, rim_x, chamfer, spine_t):
plate = s3d.extrude(&class="tok-comment">#39;tray_plate39;, s3d.rect(w=w, d=d, chamfer=chamfer), h=t)
notch = s3d.box(&class="tok-comment">#39;centre_opening39;, w=204, d=392, h=t * 3)
tools = s3d.at(notch, on=s3d.grid(nx=1, ny=2, py=412), z=-t)
plate = s3d.cut(plate, tools)
narrow = s3d.box(&class="tok-comment">#39;narrow_opening39;, w=108, d=d/6, h=t*3)
plate = s3d.cut(plate, s3d.at(narrow, on=s3d.grid(nx=1, ny=2, py=d*3/4), z=-t))
lip = s3d.box(&class="tok-comment">#39;tray_lip39;, w=rim_w, d=t, h=rim_h)
lips = s3d.at(lip, on=s3d.grid(nx=2, ny=2, px=rim_x * 2, py=d - t), z=(t-rim_h)/2)
divider = s3d.at(s3d.box(&class="tok-comment">#39;divider39;, w=w, d=spine_t, h=rim_h*2/3), z=-rim_h/2)
return s3d.join(plate, lips, divider)
def wheel_06(diameter=200, width=90):
return s3d.group(&class="tok-comment">#39;wheel_0639;, make_wheel(diameter=diameter, width=width))
def make_wheel(diameter, width):
tire = s3d.cylinder(&class="tok-comment">#39;wheel39;, d=diameter, h=width)
tire = s3d.pocket(tire, s3d.circle(d=diameter * 0.65), depth=width / 5)
s3d.material(tire, &class="tok-comment">#39;rubberclass="tok-string">39;, color=39;#32363939;)
hub = s3d.at(s3d.cylinder(&class="tok-comment">#39;hub39;, d=diameter / 3, h=width), z=0)
s3d.material(hub, &class="tok-comment">#39;steelclass="tok-string">39;, color=39;#777e8239;)
wheel = s3d.join(tire, hub)
return s3d.at(wheel, rx=90, y=width / 2, z=diameter / 2)
def wheel_02(diameter=200, width=90):
return s3d.group(&class="tok-comment">#39;wheel_0239;, make_wheel(diameter=diameter, width=width))
def wheel_07(diameter=210, width=90):
return s3d.group(&class="tok-comment">#39;wheel_0739;, make_wheel(diameter=diameter, width=width))
def wheel_04(diameter=200, width=90):
return s3d.group(&class="tok-comment">#39;wheel_0439;, make_wheel(diameter=diameter, width=width))
def wheel_03(diameter=200, width=90):
return s3d.group(&class="tok-comment">#39;wheel_0339;, make_wheel(diameter=diameter, width=width))
def wheel_08(diameter=210, width=90):
return s3d.group(&class="tok-comment">#39;wheel_0839;, make_wheel(diameter=diameter, width=width))
def wheel_05(diameter=210, width=90):
return s3d.group(&class="tok-comment">#39;wheel_0539;, make_wheel(diameter=diameter, width=width))
def wheel_01(diameter=200, width=90):
return s3d.group(&class="tok-comment">#39;wheel_0139;, make_wheel(diameter=diameter, width=width))