import sand3d as s3d
def trolley():
base = s3d.at(frame(), x=-34.5, y=4, z=95)
a = s3d.at(caster_front(), x=-251, y=-273.5, z=21)
b = s3d.transform(s3d.at(caster_front(tire_name=class="tok-string">"joint_tire_01_joint_00"), x=-251, y=-273.5, z=21), mirror=class="tok-string">"x", x=-71)
c = s3d.at(caster_back(), x=-251, y=372.5, z=21)
e = s3d.transform(s3d.at(caster_back(tire_name=class="tok-string">"joint_tire_03_joint_00"), x=-251, y=372.5, z=21), mirror=class="tok-string">"x", x=-71)
drawer = s3d.at(container(), x=-35, y=3.5, z=653)
s3d.joint(class="tok-string">"joint_wheel_02_joint_00", a, s3d.local(base, x=-216.5, y=-324, z=15), kind=class="tok-string">"continuous", axis=class="tok-string">"+Z")
s3d.joint(class="tok-string">"joint_wheel_01_joint_00", b, s3d.local(base, x=214.5, y=-324, z=15), kind=class="tok-string">"continuous", axis=class="tok-string">"+Z")
s3d.joint(class="tok-string">"joint_wheel_04_joint_00", c, s3d.local(base, x=-216.5, y=323, z=15), kind=class="tok-string">"continuous", axis=class="tok-string">"+Z")
s3d.joint(class="tok-string">"joint_wheel_03_joint_00", e, s3d.local(base, x=214.5, y=323, z=15), kind=class="tok-string">"continuous", axis=class="tok-string">"+Z")
s3d.joint(class="tok-string">"joint_container_01_joint_00", drawer, s3d.local(base, x=-0.5, y=0, z=606), kind=class="tok-string">"prismatic", axis=class="tok-string">"-X", range=(-330.2,329.8))
return s3d.assembly(class="tok-string">"trolley", base, a, b, c, e, drawer)
def frame(w=454, d=671, h=683, tube_d=19, pitch_x=431, pitch_y=646, lower_z=279, lower_t=3, top_w=421, top_d=622, top_t=2, corner=40, bend_z=545, lip_d=22):
lower = s3d.at(s3d.extrude(class="tok-string">"lower_shelf", s3d.rect(w=w-lip_d,d=d-lip_d,r=corner/2), h=lower_t),z=lower_z)
rim = s3d.wire(class="tok-string">"lower_lip",path=s3d.rect(w=w-lip_d,d=d-lip_d,r=corner/2),d=lip_d)
rim = s3d.at(rim,z=lower_z+lower_t)
top = s3d.at(s3d.extrude(class="tok-string">"top_panel",s3d.rect(w=top_w-20,d=top_d-20,r=corner),h=top_t),z=h-10)
top_rim = s3d.wire(class="tok-string">"top_rim",path=s3d.rect(w=top_w-20,d=top_d-20,r=corner-10),d=20)
top_rim = s3d.at(top_rim,z=h-10)
under_rim = s3d.wire(class="tok-string">"top_lower_edge",path=s3d.rect(w=top_w-20,d=top_d-20,r=corner-10),d=16)
under_rim = s3d.at(under_rim,z=h-22)
posts=[]
for sx in (-1,1):
for sy in (-1,1):
post=s3d.wire(class="tok-string">"upright",path=[(sx*pitch_x/2,sy*pitch_y/2,0),(sx*pitch_x/2,sy*pitch_y/2,bend_z),(sx*(top_w/2-19),sy*(top_d/2-19),h-20)],d=tube_d,fillet=tube_d*2)
posts.append(post)
solid=s3d.join(lower,rim,top,top_rim,under_rim,posts)
s3d.material(solid,class="tok-string">"brushed_steel",color=class="tok-string">"class="tok-comment">#b6babc")
return s3d.group(class="tok-string">"frame_group",solid)
def caster_front(w=38, d=135, h=92, tire_name=class="tok-string">"joint_tire_02_joint_00"):
solid = caster_fork(w=w, d=d, h=h)
tire_front_placed = s3d.at(tire_front(), x=0.5, y=-15, z=-21)
part = s3d.group(class="tok-string">"caster_front_group", solid, tire_front_placed)
s3d.joint(tire_name, tire_front_placed, s3d.local(part, x=3, y=-15, z=26), kind=class="tok-string">"continuous", axis=class="tok-string">"-X")
return part
def caster_fork(w, d, h):
profile = s3d.poly([(-d/2,h),(-d/2,h-12),(-d/2+10,h-14),(-d/2+10,35),(-34,3),(-18,0),(0,8),(12,28),(-8,57),(-26,h-8)], fillet=4)
plate = s3d.extrude(class="tok-string">"fork", profile, h=5)
plate = s3d.at(plate, x=-w/2, rx=90, rz=90)
opening = s3d.extrude(class="tok-string">"fork_slot", s3d.slot(l=43, d=12), h=w+2)
opening = s3d.at(opening, x=-w/2-1, y=-22, z=31, rx=90, rz=90)
plate = s3d.cut(plate, opening)
twin = s3d.transform(s3d.copy(plate), x=w-5)
swivel = s3d.at(s3d.cylinder(class="tok-string">"swivel", d=w, h=10), y=-46.5, z=h-10)
tab = s3d.at(s3d.box(class="tok-string">"brake_tab", w=w-5, d=d-35, h=6), y=15, z=h-26)
solid = s3d.join(plate, twin, swivel, tab)
s3d.material(solid, class="tok-string">"steel", color=class="tok-string">"class="tok-comment">#a6abad")
return solid
def tire_front(w=23, d=93):
solid = s3d.cylinder(class="tok-string">"tire", d=d, h=w)
solid = s3d.fillet(solid, r=4)
solid = s3d.at(solid, x=-w/2, z=d/2, ry=90)
s3d.material(solid, class="tok-string">"rubber", color=class="tok-string">"class="tok-comment">#414448")
return s3d.group(class="tok-string">"tire_front_group", solid)
def container(w=394, d=547, h=95, bottom_w=272, bottom_d=431, wall=3, mid_w=318, mid_d=481, top_w=338, top_d=506, rise=21, flange=5):
bottom = s3d.loft(class="tok-string">"drawer_bottom", s3d.station(z=0,w=bottom_w,d=bottom_d,n=16), s3d.station(z=rise,w=mid_w,d=mid_d,n=16))
sides = s3d.loft(class="tok-string">"drawer_sides", s3d.station(z=rise-1,w=mid_w,d=mid_d,n=16), s3d.station(z=h-flange,w=top_w,d=top_d,n=16))
solid = s3d.join(bottom, sides)
solid = s3d.shell(solid,t=wall,open=class="tok-string">"+Z")
lip = s3d.extrude(class="tok-string">"drawer_flange", s3d.rect(w=w,d=d,r=10), h=flange)
lip = s3d.pocket(lip,s3d.rect(w=top_w-wall*2,d=top_d-wall*2,r=10),depth=flange)
lip = s3d.at(lip,z=h-flange-1)
solid = s3d.join(solid,lip)
s3d.material(solid,class="tok-string">"plastic",color=class="tok-string">"class="tok-comment">#d1d4d1")
return s3d.group(class="tok-string">"container_group",solid)
def caster_back(w=38, d=135, h=92, tire_name=class="tok-string">"joint_tire_04_joint_00"):
solid = caster_fork(w=w, d=d, h=h)
tire_back_placed = s3d.at(tire_back(), x=0.5, y=-15, z=-21)
part = s3d.group(class="tok-string">"caster_back_group", solid, tire_back_placed)
s3d.joint(tire_name, tire_back_placed, s3d.local(part, x=3, y=-15, z=26), kind=class="tok-string">"continuous", axis=class="tok-string">"-X")
return part
def tire_back(w=23, d=93):
solid = s3d.cylinder(class="tok-string">"tire", d=d, h=w)
solid = s3d.fillet(solid, r=4)
solid = s3d.at(solid, x=-w/2, z=d/2, ry=90)
s3d.material(solid, class="tok-string">"rubber", color=class="tok-string">"class="tok-comment">#414448")
return s3d.group(class="tok-string">"tire_back_group", solid)