import sand3d as s3d
def trolley():
root = s3d.at(tray_frame(), x=22.5, y=-15, z=121)
a = s3d.at(handle_end_caster(), x=-265, y=481.5, z=22)
b = s3d.at(handle_end_caster(tire_joint=&class="tok-comment">#39;joint_tire_03_joint_0039;), x=311, y=481.5, z=22)
c = s3d.at(tray_end_caster(), x=-266, y=-370, z=22)
d = s3d.at(tray_end_caster(tire_joint=&class="tok-comment">#39;joint_tire_01_joint_0039;), x=310, y=-370, z=22)
s3d.joint(&class="tok-comment">#39;joint_wheel_04_joint_00class="tok-string">39;, a, s3d.local(root, x=-287.5, y=458, z=-3), kind=39;continuousclass="tok-string">39;, axis=39;+Z39;)
s3d.joint(&class="tok-comment">#39;joint_wheel_03_joint_00class="tok-string">39;, b, s3d.local(root, x=288.5, y=458, 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;, c, s3d.local(root, x=-288.5, y=-394, 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;, d, s3d.local(root, x=287.5, y=-394, z=-3), kind=39;continuousclass="tok-string">39;, axis=39;+Z39;)
return s3d.assembly(&class="tok-comment">#39;trolley39;, root, a, b, c, d)
def tray_frame(w=553, length=1314, flat=381, shoulder=28, t=4, top=716, tray_y=-91, tube=29, span=327, wheel_span=576, rail_length=1122, rail_y=32, low=151, upper=646, handle_top=960, handle_out=180, foot_y=458, brace_y=330):
fold=tube
ledge=shoulder+t/2
skirt_length=rail_length-span/2
edge=flat/2+shoulder+ledge
path=[(-edge-t*2,top-fold-fold/4),(-edge,top-fold),(-flat/2-shoulder,top-fold),(-flat/2,top),(flat/2,top),(flat/2+shoulder,top-fold),(edge,top-fold),(edge+t*2,top-fold-fold/4)]
tray=s3d.at(s3d.extrude(&class="tok-comment">#39;tray_panel39;,s3d.stroke(path,t=t),h=length),y=tray_y+length/2,rx=90)
solids=[tray]
skirt=s3d.at(s3d.extrude(&class="tok-comment">#39;folded_return39;,s3d.stroke([(edge,top-fold),(w/2,top-fold-20),(w/2-18,top-fold-tube-18)],t=t),h=skirt_length),y=tray_y+length/2,rx=90)
solids.extend([skirt,s3d.transform(s3d.copy(skirt),mirror=&class="tok-comment">#39;x39;)])
for x in (-span/2,span/2):
rail=s3d.wire(&class="tok-comment">#39;lower_rail39;,d=tube,path=[(x,rail_y-rail_length/2,low),(x,rail_y+rail_length/2,low)])
toprail=s3d.wire(&class="tok-comment">#39;tray_rail39;,d=tube,path=[(x,rail_y-rail_length/2,low),(x,rail_y-rail_length/2,upper-65),(x,rail_y-rail_length/2+65,upper),(x,rail_y+rail_length/2,upper)],fillet=45)
solids.extend([rail,toprail])
for end in (-1,1):
ey=rail_y+end*rail_length/2
fy=rail_y+end*(foot_y-rail_y)
foot=s3d.wire(&class="tok-comment">#39;bent_support39;,d=tube,path=[(x,ey,low),(x*wheel_span/span,fy,70),(x*wheel_span/span,fy,0)],fillet=35)
brace=s3d.wire(&class="tok-comment">#39;foot_brace39;,d=tube,path=[(x,rail_y+end*brace_y,low),(x*wheel_span/span,fy,70)])
solids.extend([foot,brace])
ey=rail_y+rail_length/2
grip_y=ey+handle_out
grip_z=handle_top-119
x=span/2
handle=s3d.wire(&class="tok-comment">#39;push_handle39;,d=tube+3,path=[(-x,ey,low),(-x,ey,handle_top),(-x,ey+45,handle_top),(-x*1.75,grip_y,grip_z),(x*1.75,grip_y,grip_z),(x,ey+45,handle_top),(x,ey,handle_top),(x,ey,low)],fillet=20)
solids.append(handle)
for y in (rail_y-rail_length/2,rail_y+rail_length/2):
solids.append(s3d.wire(&class="tok-comment">#39;crossbar39;,d=tube,path=[(-span/2,y,low),(span/2,y,low)]))
for y in (rail_y, rail_y+length/3, rail_y-length/3):
solids.append(s3d.at(s3d.box(&class="tok-comment">#39;tray_crossmember39;,w=flat+80,d=26,h=26),y=y,z=upper+tube/2))
tabs=s3d.at(s3d.cylinder(&class="tok-comment">#39;end_tabs39;,d=tube+t*3,h=t),on=s3d.grid(nx=3,ny=2,px=flat/3,py=length),y=tray_y,z=top-t)
solids.extend(tabs)
for ob in solids:
s3d.material(ob,&class="tok-comment">#39;brushed_steelclass="tok-string">39;,color=39;#a5a9ab39;)
return s3d.group(&class="tok-comment">#39;tray_frame39;,*solids)
def handle_end_caster(w=44, radius=51, t=4, axle_z=31, axle_y=-10.5, stem_y=-38.5, stem_d=40, h=99, tire_joint=&class="tok-comment">#39;joint_tire_04_joint_0039;):
arch=s3d.at(s3d.extrude(&class="tok-comment">#39;fork_arch39;,s3d.stroke(s3d.arc(center=(axle_y,axle_z),r=radius,start=0,end=215),t=t),h=w),x=-w/2,rx=90,rz=90)
crown=s3d.at(s3d.cylinder(&class="tok-comment">#39;swivel39;,d=stem_d,h=25),y=stem_y,z=h-25)
brake=s3d.at(s3d.box(&class="tok-comment">#39;brake39;,w=w,d=18,h=40),y=radius+2,z=axle_z-20)
solid=s3d.group(&class="tok-comment">#39;fork39;,arch,crown,brake)
s3d.material(solid,&class="tok-comment">#39;steelclass="tok-string">39;,color=39;#93999c39;)
tire=s3d.at(handle_end_tire(),y=axle_y,z=-21)
s3d.joint(tire_joint,tire,s3d.local(solid,x=0,y=-10.5,z=31),kind=&class="tok-comment">#39;continuousclass="tok-string">39;,axis=39;+X39;)
return s3d.group(&class="tok-comment">#39;handle_end_caster39;,solid,tire)
def handle_end_tire(w=70,d=105):
tire=s3d.at(s3d.cylinder(&class="tok-comment">#39;wheel39;,d=d,h=w),x=-w/2,z=d/2,ry=90)
s3d.fillet(tire,r=8)
s3d.material(tire,&class="tok-comment">#39;rubberclass="tok-string">39;,color=39;#43484b39;)
return s3d.group(&class="tok-comment">#39;handle_end_tire39;,tire)
def tray_end_caster(w=44, radius=51, t=4, axle_z=31, axle_y=-10, stem_y=-39, stem_d=40, h=99, tire_joint=&class="tok-comment">#39;joint_tire_02_joint_0039;):
arch=s3d.at(s3d.extrude(&class="tok-comment">#39;fork_arch39;,s3d.stroke(s3d.arc(center=(axle_y,axle_z),r=radius,start=0,end=215),t=t),h=w),x=-w/2,rx=90,rz=90)
crown=s3d.at(s3d.cylinder(&class="tok-comment">#39;swivel39;,d=stem_d,h=25),y=stem_y,z=h-25)
brake=s3d.at(s3d.box(&class="tok-comment">#39;brake39;,w=w,d=18,h=40),y=radius+2,z=axle_z-20)
solid=s3d.group(&class="tok-comment">#39;fork39;,arch,crown,brake)
s3d.material(solid,&class="tok-comment">#39;steelclass="tok-string">39;,color=39;#93999c39;)
tire=s3d.at(tray_end_tire(),y=axle_y,z=-21)
s3d.joint(tire_joint,tire,s3d.local(solid,x=0,y=-10,z=31),kind=&class="tok-comment">#39;continuousclass="tok-string">39;,axis=39;+X39;)
return s3d.group(&class="tok-comment">#39;tray_end_caster39;,solid,tire)
def tray_end_tire(w=71,d=105):
tire=s3d.at(s3d.cylinder(&class="tok-comment">#39;wheel39;,d=d,h=w),x=-w/2,z=d/2,ry=90)
s3d.fillet(tire,r=8)
s3d.material(tire,&class="tok-comment">#39;rubberclass="tok-string">39;,color=39;#43484b39;)
return s3d.group(&class="tok-comment">#39;tray_end_tire39;,tire)