import sand3d as s3d
def trolley():
frame = s3d.at(tray_frame(), x=-49, y=4, z=107)
a = s3d.at(caster_bracket_02(), x=201.5, y=171, z=21)
b = s3d.at(caster_bracket_02(tire_joint=&class="tok-comment">#39;joint_tire_01_joint_0039;), x=201.5, y=171, z=21)
b = s3d.transform(s3d.copy(b), mirror=&class="tok-comment">#39;x39;, x=-96)
c = s3d.at(caster_bracket_04(), x=201.5, y=-255, z=21)
e = s3d.at(caster_bracket_04(tire_joint=&class="tok-comment">#39;joint_tire_03_joint_0039;), x=201.5, y=-255, z=21)
e = s3d.transform(s3d.copy(e), mirror=&class="tok-comment">#39;x39;, x=-96)
s3d.joint(&class="tok-comment">#39;joint_wheel_02_joint_00class="tok-string">39;, a, on=s3d.local(frame, x=251, y=213, 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;, b, on=s3d.local(frame, x=-249, y=213, 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;, c, on=s3d.local(frame, x=251, y=-213, 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;, e, on=s3d.local(frame, x=-249, y=-213, z=3), kind=39;continuousclass="tok-string">39;, axis=39;+Z39;)
return s3d.assembly(&class="tok-comment">#39;trolley39;, frame, a, b, c, e)
def tray_frame(w=480, d=525, rim=25, corner=38, sheet=3, lower=340, upper=786, post=21, span=500, track=426, bend=75, rise=770):
trays=[]
for level in (lower, upper):
edge=s3d.extrude(&class="tok-comment">#39;rim39;, s3d.rect(w=w, d=d, r=corner), h=rim)
edge=s3d.pocket(edge, s3d.rect(w=w-rim*2, d=d-rim*2, r=corner-rim), depth=rim, on=edge.face(&class="tok-comment">#39;top39;))
edge=s3d.fillet(edge, r=rim/2-sheet/4)
edge=s3d.at(edge, z=level-rim/2)
panel=s3d.extrude(&class="tok-comment">#39;sheet39;,s3d.rect(w=w-rim,d=d-rim,r=corner-rim/2),h=sheet)
panel=s3d.at(panel,z=level)
edge=s3d.join(edge,panel)
s3d.material(edge, kind=&class="tok-comment">#39;brushed_steelclass="tok-string">39;, color=39;#a6aaac39;)
trays.append(edge)
posts=[]
for y in (-track/2, track/2):
path=s3d.poly([(-span/2,0),(-span/2,rise-bend),s3d.arc(center=(-span/2+bend,rise-bend),r=bend,start=180,end=90), (span/2-bend,rise),s3d.arc(center=(span/2-bend,rise-bend),r=bend,start=90,end=0),(span/2,0)])
tube=s3d.wire(&class="tok-comment">#39;upright39;, path=path, d=post)
tube=s3d.at(tube, y=y, rx=90)
s3d.material(tube, kind=&class="tok-comment">#39;chromeclass="tok-string">39;, color=39;#a4a9ac39;)
posts.append(tube)
return s3d.group(&class="tok-comment">#39;tray_frame39;, trays, posts)
def caster_bracket_02(w=39, d=136, h=92, t=5, wheel_y=15.5, wheel_z=26, tire_joint=&class="tok-comment">#39;joint_tire_02_joint_0039;):
fork=caster_fork(w=w,d=d,h=h,t=t)
tire=s3d.at(caster_tire_02(), y=wheel_y,z=-21)
s3d.joint(tire_joint,tire,on=s3d.local(fork,x=-3.5,y=15,z=26),kind=&class="tok-comment">#39;continuousclass="tok-string">39;,axis=39;+X39;)
return s3d.group(&class="tok-comment">#39;caster_bracket_0239;,fork,tire)
def caster_fork(w=39,d=136,h=92,t=5):
profile=s3d.poly([(-8,24),(12,0),(26,5),(51,41),(51,82),(26,82),(26,77)],fillet=t/2)
cheek=s3d.extrude(&class="tok-comment">#39;fork_cheek39;,profile,h=t)
opening=s3d.poly([(8,26),(17,18),(42,51),(34,62)],fillet=t)
cheek=s3d.pocket(cheek,opening,depth=t,on=cheek.face(&class="tok-comment">#39;top39;))
cheek=s3d.at(cheek,rx=90,rz=90,x=-w/2)
twin=s3d.transform(s3d.copy(cheek),x=w-t)
cap=s3d.at(s3d.cylinder(&class="tok-comment">#39;swivel39;,d=w,h=t*2),y=d/3,z=h-t*2)
tab=s3d.at(s3d.box(&class="tok-comment">#39;brake39;,w=w-t,d=d*0.7,h=t),y=-d/6,z=h*0.7)
s3d.material(cheek,kind=&class="tok-comment">#39;steelclass="tok-string">39;,color=39;#92999e39;)
s3d.material(twin,kind=&class="tok-comment">#39;steelclass="tok-string">39;,color=39;#92999e39;)
s3d.material(cap,kind=&class="tok-comment">#39;steelclass="tok-string">39;,color=39;#92999e39;)
s3d.material(tab,kind=&class="tok-comment">#39;steelclass="tok-string">39;,color=39;#92999e39;)
return s3d.group(&class="tok-comment">#39;fork39;,cheek,twin,cap,tab)
def caster_tire_02(w=25,d=93):
tire=s3d.cylinder(&class="tok-comment">#39;tire39;,d=d,h=w)
tire=s3d.fillet(tire,r=w/5)
tire=s3d.at(tire,ry=90,x=-w/2,z=d/2)
s3d.material(tire,kind=&class="tok-comment">#39;rubberclass="tok-string">39;,color=39;#34383b39;)
return s3d.group(&class="tok-comment">#39;caster_tire_0239;,tire)
def caster_bracket_04(w=39,d=136,h=92,t=5,wheel_y=15.5,tire_joint=&class="tok-comment">#39;joint_tire_04_joint_0039;):
fork=caster_fork(w=w,d=d,h=h,t=t)
tire=s3d.at(caster_tire_04(),y=wheel_y,z=-21)
s3d.joint(tire_joint,tire,on=s3d.local(fork,x=-0.5,y=17,z=26),kind=&class="tok-comment">#39;continuousclass="tok-string">39;,axis=39;+X39;)
return s3d.group(&class="tok-comment">#39;caster_bracket_0439;,fork,tire)
def caster_tire_04(w=25,d=93):
tire=s3d.cylinder(&class="tok-comment">#39;tire39;,d=d,h=w)
tire=s3d.fillet(tire,r=w/5)
tire=s3d.at(tire,ry=90,x=-w/2,z=d/2)
s3d.material(tire,kind=&class="tok-comment">#39;rubberclass="tok-string">39;,color=39;#34383b39;)
return s3d.group(&class="tok-comment">#39;caster_tire_0439;,tire)