import sand3d as s3d
def trolley():
frame = s3d.at(cart_frame(), x=4.5, y=41, z=143)
a = s3d.at(caster_three(), x=-275.5, y=305.5, z=44)
b = s3d.at(caster_four(), x=-275.5, y=-223.5, z=44)
c = s3d.at(caster_one(), x=338.5, y=-223.5, z=44)
d = s3d.at(caster_two(), x=338.5, y=305.5, z=44)
tray = s3d.at(sliding_counter(), x=-4.5, y=-76.5, z=940)
s3d.joint(&class="tok-comment">#39;joint_sm_wheel3_a01_joint_00class="tok-string">39;, a, s3d.local(frame, x=-313.5, y=258, z=1), axis=39;+Z39;, range=(-60,60))
s3d.joint(&class="tok-comment">#39;joint_sm_wheel4_a01_joint_00class="tok-string">39;, b, s3d.local(frame, x=-313.5, y=-258, z=1), axis=39;+Z39;, range=(-60,60))
s3d.joint(&class="tok-comment">#39;joint_sm_wheel1_a01_joint_00class="tok-string">39;, c, s3d.local(frame, x=299.5, y=-258, z=1), axis=39;+Z39;, range=(-60,60))
s3d.joint(&class="tok-comment">#39;joint_sm_wheel2_a01_joint_00class="tok-string">39;, d, s3d.local(frame, x=299.5, y=258, z=1), axis=39;+Z39;, range=(-60,60))
s3d.joint(&class="tok-comment">#39;joint_sm_counter_top_a01_joint_00class="tok-string">39;, tray, s3d.local(frame, x=-8.5, y=-313, z=810), kind=39;prismaticclass="tok-string">39;, axis=39;+Y39;, range=(-270,0))
return s3d.assembly(&class="tok-comment">#39;trolley39;, frame,a,b,c,d,tray)
def cart_frame(w=671,d=572,h=914,post=54,t=5,shelf_h=54,levels=(4,480,860),cx=-9.5,cy=2.5,deck_t=9,drop=8):
solids=[]
for z in levels:
band=s3d.extrude(&class="tok-comment">#39;perimeter_band39;,s3d.rect(w,d),h=shelf_h)
band=s3d.pocket(band,s3d.rect(w-2*t,d-2*t),depth=shelf_h,on=band.face(&class="tok-comment">#39;top39;))
deck=s3d.at(s3d.box(&class="tok-comment">#39;shelf_deck39;,w=w-t,d=d-t,h=deck_t),z=shelf_h-drop-deck_t)
shelf=s3d.join(band,deck)
solids.append(s3d.at(shelf,x=cx,y=cy,z=z))
for sx in (-1,1):
for sy in (-1,1):
x=cx+sx*(w-post)/2
y=cy+sy*(d-post)/2
leg=s3d.at(s3d.box(&class="tok-comment">#39;post_angle39;,w=post,d=post,h=h),x=x,y=y)
tool=s3d.at(s3d.box(&class="tok-comment">#39;post_interior39;,w=post,d=post,h=h+2*t),x=x-sx*t,y=y-sy*t,z=-t)
solids.append(s3d.cut(leg,tool))
rail=s3d.wire(&class="tok-comment">#39;bowed_handle39;,s3d.spline([(w/2,-d/2+80,h-15),(w/2+18,-d/4,h+10),(w/2+18,d/4,h+10),(w/2,d/2-80,h-15)]),d=t*2)
solids.append(s3d.at(rail,x=cx,y=cy))
result=s3d.group(&class="tok-comment">#39;cart_frame39;,solids)
s3d.material(result,&class="tok-comment">#39;painted_metalclass="tok-string">39;,color=39;#858b8d39;)
return result
def caster_three(w=113,d=63,h=98):
solid=fork(w=w,d=d,h=h,shift=-7)
tire=s3d.at(tire_three(),x=0.5,y=-7,z=-45)
result=s3d.group(&class="tok-comment">#39;caster_three39;,solid,tire)
s3d.joint(&class="tok-comment">#39;joint_sm_tire3_a01_joint_00class="tok-string">39;,tire,s3d.local(result,x=0.5,y=-7,z=14),kind=39;continuousclass="tok-string">39;,axis=39;+Y39;)
return result
def fork(w=113,d=63,h=98,shift=7,t=5):
top=s3d.at(s3d.cylinder(&class="tok-comment">#39;swivel39;,d=58,h=14),x=-34,y=shift,z=84)
profile=s3d.poly([(-55,82),(-48,88),(0,83),(12,20),(8,8),(-4,0),(-15,8),(-27,65)])
side=s3d.at(s3d.extrude(&class="tok-comment">#39;fork_side39;,profile,h=t),rx=90,y=shift-17,z=14)
other=s3d.transform(s3d.copy(side),y=39)
bridge=s3d.at(s3d.box(&class="tok-comment">#39;fork_bridge39;,w=57,d=44,h=t),x=-27,y=shift,z=79)
axle=s3d.at(s3d.cylinder(&class="tok-comment">#39;axle39;,d=16,h=d),rx=90,x=0.5,y=shift+d/2,z=14)
brake=s3d.at(s3d.box(&class="tok-comment">#39;brake_pedal39;,w=w,d=3*t,h=t),y=shift-(d/2-t)*shift/abs(shift),z=4*t)
result=s3d.join(top,side,other,bridge,axle,brake)
s3d.material(result,&class="tok-comment">#39;steelclass="tok-string">39;,color=39;#969d9f39;)
return result
def tire_three(w=118,d=23,h=117):
return s3d.group(&class="tok-comment">#39;tire_three39;,wheel(w=w,d=d))
def wheel(w=116,d=23):
rubber=s3d.cylinder(&class="tok-comment">#39;rubber39;,d=w,h=d)
rubber=s3d.hole(rubber,d=w*0.58)
hub=s3d.cylinder(&class="tok-comment">#39;hub39;,d=w*0.62,h=d-4)
hub=s3d.at(hub,z=2)
s3d.material(rubber,&class="tok-comment">#39;rubberclass="tok-string">39;,color=39;#34363839;)
s3d.material(hub,&class="tok-comment">#39;steelclass="tok-string">39;,color=39;#9ba0a239;)
return s3d.at(s3d.join(rubber,hub),rx=90,y=d/2,z=w/2)
def caster_four(w=113,d=63,h=132):
solid=fork(w=w,d=d,h=h,shift=7)
tire=s3d.at(tire_four(),x=0.5,y=7,z=-44)
result=s3d.group(&class="tok-comment">#39;caster_four39;,solid,tire)
s3d.joint(&class="tok-comment">#39;joint_sm_tire4_a01_joint_00class="tok-string">39;,tire,s3d.local(result,x=0.5,y=7,z=14),kind=39;continuousclass="tok-string">39;,axis=39;+Y39;)
return result
def tire_four(w=116,d=23,h=116):
return s3d.group(&class="tok-comment">#39;tire_four39;,wheel(w=w,d=d))
def caster_one(w=113,d=63,h=132):
solid=fork(w=w,d=d,h=h,shift=7)
tire=s3d.at(tire_one(),x=0.5,y=7,z=-44)
result=s3d.group(&class="tok-comment">#39;caster_one39;,solid,tire)
s3d.joint(&class="tok-comment">#39;joint_sm_tire1_a01_joint_00class="tok-string">39;,tire,s3d.local(result,x=0.5,y=7,z=14),kind=39;continuousclass="tok-string">39;,axis=39;+Y39;)
return result
def tire_one(w=116,d=23,h=116):
return s3d.group(&class="tok-comment">#39;tire_one39;,wheel(w=w,d=d))
def caster_two(w=113,d=63,h=132):
solid=fork(w=w,d=d,h=h,shift=-7)
tire=s3d.at(tire_two(),x=0.5,y=-7,z=-45)
result=s3d.group(&class="tok-comment">#39;caster_two39;,solid,tire)
s3d.joint(&class="tok-comment">#39;joint_sm_tire2_a01_joint_00class="tok-string">39;,tire,s3d.local(result,x=0.5,y=-7,z=14),kind=39;continuousclass="tok-string">39;,axis=39;+Y39;)
return result
def tire_two(w=118,d=23,h=117):
return s3d.group(&class="tok-comment">#39;tire_two39;,wheel(w=w,d=d))
def sliding_counter(w=559,d=409,h=25,deck=296,t=5):
top=s3d.at(s3d.box(&class="tok-comment">#39;counter39;,w=w,d=deck,h=20),y=-(d-deck)/2,z=2)
sides=s3d.at(s3d.box(&class="tok-comment">#39;slide39;,w=t,d=d,h=h),on=s3d.grid(nx=2,px=w-t))
result=s3d.group(&class="tok-comment">#39;sliding_counter39;,top,sides)
s3d.material(result,&class="tok-comment">#39;painted_metalclass="tok-string">39;,color=39;#858b8d39;)
return result