import sand3d as s3d
def tray_cart():
root = s3d.at(body_01(), y=5.5, z=121)
a = s3d.at(wheel_03(), x=162, y=314.5, z=22)
b = s3d.at(wheel_04(), x=-161, y=314.5, z=23)
c = s3d.at(wheel_02(), x=-161.5, y=-273, z=22)
d = s3d.at(wheel_01(), x=160, y=-273, z=22)
s3d.joint(&class="tok-comment">#39;joint_wheel_03_joint_00class="tok-string">39;, a, s3d.local(root, x=160, y=270, 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;, b, s3d.local(root, x=-162, y=270, 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=-162, y=-317, 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=160, y=-317, z=-3), kind=39;continuousclass="tok-string">39;, axis=39;+Z39;)
return s3d.assembly(&class="tok-comment">#39;tray_cart39;, root, a, b, c, d)
def body_01(tube=28, spacing=120, length=763, top=1445, base=161, mid=-24, foot=162, foot_y=294, tray_w=350, tray_d=638, tray_h=150, floor=459, pitch=240, wire=4, rail_w=374, rail_d=39, rail_h=45, rail_z=371, handle_x=167, handle_y=405.5, handle_low=694, handle_high=1305, grid_pitch=58.3, long_pitch=45):
obs=[]
for x in (-spacing/2, spacing/2):
frame=s3d.wire(&class="tok-comment">#39;frame39;, path=[(x,mid-length/2,base),(x,mid-length/2,top),(x,mid+length/2,top),(x,mid+length/2,base),(x,mid-length/2,base)], d=tube, fillet=tube*2)
obs.append(frame)
for sign in (-1,1):
obs.append(s3d.wire(&class="tok-comment">#39;foot39;, path=[(x,mid+sign*(length/2),base+tube),(x,mid+sign*(length/2),base-tube),(foot*(x/abs(x)),mid+sign*foot_y,base/3),(foot*(x/abs(x)),mid+sign*foot_y,0)], d=tube, fillet=tube))
obs.append(s3d.wire(&class="tok-comment">#39;brace39;,path=[(x,mid+sign*(foot_y-spacing),base),(foot*(x/abs(x)),mid+sign*foot_y,base/3)],d=tube-wire))
for i in range(5):
for sign in (-1,1):
profile=s3d.poly(pts=[(-rail_d/2,0),(rail_d/2,0),(rail_d/2,rail_h),(rail_d/2-wire,rail_h),(rail_d/2-wire,wire),(-rail_d/2,wire)])
rail=s3d.extrude(&class="tok-comment">#39;channel39;, profile, h=rail_w)
obs.append(s3d.at(rail, x=-rail_w/2, y=mid+sign*(length/2-rail_d), z=rail_z+i*pitch, rx=90, rz=90))
for i in range(3):
z=floor+i*pitch
rim=s3d.wire(&class="tok-comment">#39;basket_rim39;, path=[(-tray_w/2,mid-tray_d/2,z+tray_h),(tray_w/2,mid-tray_d/2,z+tray_h),(tray_w/2,mid+tray_d/2,z+tray_h),(-tray_w/2,mid+tray_d/2,z+tray_h),(-tray_w/2,mid-tray_d/2,z+tray_h)], d=wire, fillet=wire*4)
obs.append(rim)
cross=s3d.wire(&class="tok-comment">#39;cross_wire39;,path=[(-rail_w/2,0,tray_h+tube),(-tray_w/2-tube,0,tray_h+tube/2),(-tray_w/2,0,tray_h),(-tray_w/2,0,0),(tray_w/2,0,0),(tray_w/2,0,tray_h),(tray_w/2+tube,0,tray_h+tube/2),(rail_w/2,0,tray_h+tube)],d=wire,fillet=wire*2)
obs.extend(s3d.at(cross,on=s3d.grid(nx=1,ny=10,py=grid_pitch),y=mid,z=z))
long=s3d.wire(&class="tok-comment">#39;length_wire39;,path=[(0,-tray_d/2-tube,tray_h+tube),(0,-tray_d/2,tray_h),(0,-tray_d/2,0),(0,tray_d/2,0),(0,tray_d/2,tray_h),(0,tray_d/2+tube,tray_h+tube)],d=wire,fillet=wire*2)
obs.extend(s3d.at(long,on=s3d.grid(nx=6,px=long_pitch),y=mid,z=z))
obs.append(s3d.wire(&class="tok-comment">#39;handle39;,path=[(-handle_x+spacing/2,mid+length/2,handle_low),(-handle_x,handle_y,handle_low+spacing/2),(-handle_x,handle_y,handle_high-spacing/2),(-handle_x+spacing/2,mid+length/2,handle_high),(handle_x-spacing/2,mid+length/2,handle_high),(handle_x,handle_y,handle_high-spacing/2),(handle_x,handle_y,handle_low+spacing/2),(handle_x-spacing/2,mid+length/2,handle_low),(-handle_x+spacing/2,mid+length/2,handle_low)],d=tube-wire/2,fillet=tube))
obs.append(s3d.wire(&class="tok-comment">#39;crossbar39;,path=[(-spacing/2,mid-length/2,handle_high-tube),(spacing/2,mid-length/2,handle_high-tube)],d=tube-wire))
for ob in obs:
s3d.material(ob, &class="tok-comment">#39;chromeclass="tok-string">39;, color=39;#b8bcc039;)
return s3d.group(&class="tok-comment">#39;body_0139;, obs)
def wheel_03(w=44,d=127,h=99):
solid=caster(w=w,d=d,h=h)
tire=s3d.at(tire_03(), y=-10, z=-22)
part=s3d.group(&class="tok-comment">#39;wheel_0339;,solid,tire)
s3d.joint(&class="tok-comment">#39;joint_tire_03_joint_00class="tok-string">39;, tire, s3d.local(part,x=0,y=-10,z=31),kind=39;continuousclass="tok-string">39;,axis=39;+X39;)
return part
def caster(w,d,h):
radius=d/2-w/12
thick=w/14
profile=s3d.poly(pts=[s3d.arc(center=(-10,31),r=radius,start=0,end=210),s3d.arc(center=(-10,31),r=radius-thick,start=210,end=0)])
arch=s3d.at(s3d.extrude(&class="tok-comment">#39;fork39;,profile,h=w),x=-w/2,rx=90,rz=90)
stem=s3d.at(s3d.cylinder(&class="tok-comment">#39;swivel39;,d=w,h=h/2),y=-d/3,z=h/2)
brake=s3d.wire(&class="tok-comment">#39;brake39;,path=[(0,d/4,0),(0,d/2,0),(0,d/2-w/4,h/3),(0,d/2-w/4,h*2/3)],d=w/5,fillet=w/4)
s3d.join(arch,stem,brake)
s3d.material(arch,&class="tok-comment">#39;brushed_steelclass="tok-string">39;,color=39;#a5a8ac39;)
return arch
def tire_03(w=70,d=106):
return s3d.group(&class="tok-comment">#39;tire_0339;,twin_tire(w=w,d=d))
def twin_tire(w,d):
disk=s3d.cylinder(&class="tok-comment">#39;tread39;,d=d,h=w/5)
s3d.fillet(disk,r=w/20)
a=s3d.at(disk,x=-w/2,z=d/2,ry=90)
b=s3d.at(s3d.copy(a),x=w/2-w/5)
axle=s3d.at(s3d.cylinder(&class="tok-comment">#39;axle39;,d=d/7,h=w),x=-w/2,z=d/2,ry=90)
s3d.material(a,&class="tok-comment">#39;rubberclass="tok-string">39;,color=39;#66696b39;)
s3d.material(b,&class="tok-comment">#39;rubberclass="tok-string">39;,color=39;#66696b39;)
s3d.material(axle,&class="tok-comment">#39;steelclass="tok-string">39;,color=39;#a5a8ac39;)
return s3d.merge(a,b,axle)
def wheel_04(w=44,d=127,h=98):
solid=caster(w=w,d=d,h=h)
tire=s3d.at(tire_04(),y=-10,z=-23)
part=s3d.group(&class="tok-comment">#39;wheel_0439;,solid,tire)
s3d.joint(&class="tok-comment">#39;joint_tire_04_joint_00class="tok-string">39;,tire,s3d.local(part,x=0,y=-10,z=30),kind=39;continuousclass="tok-string">39;,axis=39;+X39;)
return part
def tire_04(w=70,d=106):
return s3d.group(&class="tok-comment">#39;tire_0439;,twin_tire(w=w,d=d))
def wheel_02(w=43,d=128,h=99):
solid=caster(w=w,d=d,h=h)
tire=s3d.at(tire_02(),y=-10.5,z=-22)
part=s3d.group(&class="tok-comment">#39;wheel_0239;,solid,tire)
s3d.joint(&class="tok-comment">#39;joint_tire_02_joint_00class="tok-string">39;,tire,s3d.local(part,x=0,y=-10,z=31),kind=39;continuousclass="tok-string">39;,axis=39;+X39;)
return part
def tire_02(w=71,d=106):
return s3d.group(&class="tok-comment">#39;tire_0239;,twin_tire(w=w,d=d))
def wheel_01(w=44,d=128,h=99):
solid=caster(w=w,d=d,h=h)
tire=s3d.at(tire_01(),y=-10.5,z=-22)
part=s3d.group(&class="tok-comment">#39;wheel_0139;,solid,tire)
s3d.joint(&class="tok-comment">#39;joint_tire_01_joint_00class="tok-string">39;,tire,s3d.local(part,x=0,y=-10,z=31),kind=39;continuousclass="tok-string">39;,axis=39;+X39;)
return part
def tire_01(w=70,d=106):
return s3d.group(&class="tok-comment">#39;tire_0139;,twin_tire(w=w,d=d))