import sand3d as s3d
def tray_rack():
root = s3d.at(rack_frame(), x=-4, y=-19.5, z=11)
back = s3d.at(caster_fork_back(), x=286, y=216, z=46)
back_image = s3d.transform(s3d.copy(s3d.at(caster_fork_back(rim_name=class="tok-string">"joint_rim_04_joint_00"), x=286, y=216, z=46)), mirror=class="tok-string">"x", x=-8)
front = s3d.at(caster_fork_front(), x=286, y=-184, z=46)
front_image = s3d.transform(s3d.copy(s3d.at(caster_fork_front(rim_name=class="tok-string">"joint_rim_03_joint_00"), x=286, y=-184, z=46)), mirror=class="tok-string">"x", x=-8)
s3d.joint(class="tok-string">"joint_wheel_02_joint_00", back, on=s3d.local(root, x=290, y=220.5, z=131), kind=class="tok-string">"continuous", axis=class="tok-string">"+Z")
s3d.joint(class="tok-string">"joint_wheel_04_joint_00", back_image, on=s3d.local(root, x=-290, y=220.5, z=131), kind=class="tok-string">"continuous", axis=class="tok-string">"+Z")
s3d.joint(class="tok-string">"joint_wheel_01_joint_00", front, on=s3d.local(root, x=290, y=-179.5, z=131), kind=class="tok-string">"continuous", axis=class="tok-string">"+Z")
s3d.joint(class="tok-string">"joint_wheel_03_joint_00", front_image, on=s3d.local(root, x=-290, y=-179.5, z=131), kind=class="tok-string">"continuous", axis=class="tok-string">"+Z")
return s3d.assembly(class="tok-string">"tray_rack", root, back, back_image, front, front_image)
def rack_frame(post=40, post_d=80, h=1194, span=660, foot_x=290, foot_d=510, foot_z=138, cross_z=98, tray_w=620, tray_d=420, tray_z=261, pitch=184.3, floor_t=22, wall_h=63, wall_t=5, lip=15, rail_h=7, handle_d=28, handle_y=-242.5, handle_z=1152, center_y=19.5):
solids = []
p = s3d.at(s3d.box(class="tok-string">"post", w=post, d=post_d, h=h), x=span/2, y=center_y)
solids.extend([p, s3d.transform(s3d.copy(p), mirror=class="tok-string">"x")])
f = s3d.at(s3d.box(class="tok-string">"foot", w=post, d=foot_d, h=post), x=foot_x, y=center_y, z=foot_z)
solids.extend([f, s3d.transform(s3d.copy(f), mirror=class="tok-string">"x")])
solids.append(s3d.at(s3d.box(class="tok-string">"crossbar", w=span, d=post, h=post), y=center_y, z=cross_z))
arm = s3d.at(s3d.box(class="tok-string">"handle_arm", w=post, d=foot_d/2+post_d/2, h=post), x=span/2, y=center_y-(foot_d/2-post_d/2)/2, z=handle_z-post/2)
solids.extend([arm, s3d.transform(s3d.copy(arm), mirror=class="tok-string">"x")])
solids.append(s3d.at(s3d.cylinder(class="tok-string">"handle", d=handle_d, h=span), x=-span/2, y=handle_y, z=handle_z, ry=90))
for level in range(5):
z = tray_z + level*pitch
solids.append(s3d.at(s3d.box(class="tok-string">"tray_floor", w=tray_w, d=tray_d, h=floor_t), y=center_y, z=z))
wall = s3d.shell(s3d.box(class="tok-string">"tray_wall", w=tray_w-post/2, d=tray_d-post/2, h=wall_h), t=wall_t, open=class="tok-string">"top bottom")
solids.append(s3d.at(wall, y=center_y, z=z+floor_t-wall_t))
for dz in (floor_t+lip, floor_t+wall_h-wall_t):
rim = s3d.shell(s3d.box(class="tok-string">"tray_lip", w=tray_w-post/2, d=tray_d-post/2, h=wall_t), t=lip, open=class="tok-string">"top bottom")
solids.append(s3d.at(rim, y=center_y, z=z+dz))
rail = s3d.shell(s3d.box(class="tok-string">"support_rail", w=tray_w, d=tray_d, h=rail_h), t=wall_t, open=class="tok-string">"top bottom")
solids.append(s3d.at(rail, y=center_y, z=z+floor_t))
for ob in solids:
s3d.material(ob, kind=class="tok-string">"brushed_steel", color=class="tok-string">"class="tok-comment">#999da0")
return s3d.group(class="tok-string">"rack_frame", solids)
def caster_fork_back(w=55, d=84, h=96, t=6, stem_d=42, stem_h=22, offset=15, axle_z=18, rim_name=class="tok-string">"joint_rim_02_joint_00"):
stem = s3d.at(s3d.cylinder(class="tok-string">"swivel", d=stem_d, h=stem_h), y=-offset, z=h-stem_h)
bridge = s3d.at(s3d.box(class="tok-string">"fork_bridge", w=w, d=stem_d, h=t), y=-offset, z=h-stem_h-t/2)
cheek = s3d.extrude(class="tok-string">"fork_cheek", s3d.poly([(-d/2, h-stem_h), (-d/2+stem_d, h-stem_h), (d/2, axle_z), (d/2-t*2, 0), (offset, 0), (-d/2, h-stem_h-t*3)]), h=t)
cheek = s3d.at(cheek, x=-w/2, rx=90, rz=90)
twin = s3d.transform(s3d.copy(cheek), mirror=class="tok-string">"x")
solid = s3d.group(class="tok-string">"fork_metal", stem, bridge, cheek, twin)
s3d.material(solid, kind=class="tok-string">"steel", color=class="tok-string">"class="tok-comment">#a0a2a4")
caster_disc_back_placed = s3d.at(caster_disc_back(), y=25, z=-46)
parent = s3d.group(class="tok-string">"caster_fork_back", solid, caster_disc_back_placed)
s3d.joint(rim_name, caster_disc_back_placed, on=s3d.local(parent, x=0, y=25, z=18), kind=class="tok-string">"continuous", axis=class="tok-string">"-X")
return parent
def caster_disc_back(w=37, d=128, hub=78, bore=12):
wheel = s3d.at(s3d.cylinder(class="tok-string">"tire", d=d, h=w), x=-w/2, z=d/2, ry=90)
s3d.material(wheel, kind=class="tok-string">"rubber", color=class="tok-string">"class="tok-comment">#44474a")
metal = s3d.cylinder(class="tok-string">"wheel_hub", d=hub, h=w+2)
s3d.hole(metal, d=bore)
metal = s3d.at(metal, x=-w/2-1, z=d/2, ry=90)
s3d.material(metal, kind=class="tok-string">"steel", color=class="tok-string">"class="tok-comment">#a4a7aa")
return s3d.group(class="tok-string">"caster_disc_back", wheel, metal)
def caster_fork_front(w=55, d=84, h=96, t=6, stem_d=42, stem_h=22, offset=15, axle_z=18, rim_name=class="tok-string">"joint_rim_01_joint_00"):
stem = s3d.at(s3d.cylinder(class="tok-string">"swivel", d=stem_d, h=stem_h), y=-offset, z=h-stem_h)
bridge = s3d.at(s3d.box(class="tok-string">"fork_bridge", w=w, d=stem_d, h=t), y=-offset, z=h-stem_h-t/2)
cheek = s3d.extrude(class="tok-string">"fork_cheek", s3d.poly([(-d/2, h-stem_h), (-d/2+stem_d, h-stem_h), (d/2, axle_z), (d/2-t*2, 0), (offset, 0), (-d/2, h-stem_h-t*3)]), h=t)
cheek = s3d.at(cheek, x=-w/2, rx=90, rz=90)
twin = s3d.transform(s3d.copy(cheek), mirror=class="tok-string">"x")
solid = s3d.group(class="tok-string">"fork_metal", stem, bridge, cheek, twin)
s3d.material(solid, kind=class="tok-string">"steel", color=class="tok-string">"class="tok-comment">#a0a2a4")
caster_disc_front_placed = s3d.at(caster_disc_front(), y=25, z=-46)
parent = s3d.group(class="tok-string">"caster_fork_front", solid, caster_disc_front_placed)
s3d.joint(rim_name, caster_disc_front_placed, on=s3d.local(parent, x=0, y=25, z=18), kind=class="tok-string">"continuous", axis=class="tok-string">"-X")
return parent
def caster_disc_front(w=37, d=128, hub=78, bore=12):
wheel = s3d.at(s3d.cylinder(class="tok-string">"tire", d=d, h=w), x=-w/2, z=d/2, ry=90)
s3d.material(wheel, kind=class="tok-string">"rubber", color=class="tok-string">"class="tok-comment">#44474a")
metal = s3d.cylinder(class="tok-string">"wheel_hub", d=hub, h=w+2)
s3d.hole(metal, d=bore)
metal = s3d.at(metal, x=-w/2-1, z=d/2, ry=90)
s3d.material(metal, kind=class="tok-string">"steel", color=class="tok-string">"class="tok-comment">#a4a7aa")
return s3d.group(class="tok-string">"caster_disc_front", wheel, metal)