import sand3d as s3d
def trolley():
root = s3d.at(trolley_frame(), x=1, y=0, z=87)
b = s3d.at(caster_fork_back(), x=-177, y=252.5, z=26)
c = s3d.at(caster_fork_back(code=class="tok-string">"C"), x=179, y=252.5, z=26)
a = s3d.at(caster_fork_front(), x=-177, y=-338, z=26)
d = s3d.at(caster_fork_front(code=class="tok-string">"D"), x=179, y=-338, z=26)
for part, code, x, y in [(b,class="tok-string">"B",-178,297),(c,class="tok-string">"C",178,297),(a,class="tok-string">"A",-178,-293),(d,class="tok-string">"D",178,-293)]:
s3d.joint(class="tok-string">"joint_wheelBase"+code+class="tok-string">"_01_joint_00", part, s3d.local(root,x=x,y=y,z=13), kind=class="tok-string">"continuous", axis=class="tok-string">"+Z")
return s3d.assembly(class="tok-string">"trolley", root,b,c,a,d)
def trolley_frame(post=40, px=178, py=295, h=745, floor=120, spacing=311, sw=330, sd=532, rimw=382, rimd=574, rise=94, wall=7, panelw=307, panelt=3, panelh=630, panel_y=318, binw=222, bind=148, binh=200, biny=-378, handlew=356, handley=380, handlez=800, grip=36):
solids=[]
for x in [-px,px]:
for y in [-py,py]:
p=s3d.at(s3d.extrude(class="tok-string">"post",s3d.rect(w=post,d=post,r=post/5),h=h),x=x,y=y)
solids.append(p)
for z in [floor, floor+spacing, floor+spacing*2]:
collar=s3d.at(s3d.extrude(class="tok-string">"corner",s3d.polygon(n=6,d=post*1.5),h=post*2),x=x,y=y,z=z-87)
solids.append(collar)
for z in [floor,floor+spacing]:
tray=s3d.loft(class="tok-string">"tray",s3d.station(z=z-87,w=sw,d=sd,n=8),s3d.station(z=z-87+rise,w=rimw,d=rimd,n=8))
tray=s3d.shell(tray,t=wall,open=class="tok-string">"end")
solids.append(tray)
top=s3d.loft(class="tok-string">"upper_tray",s3d.station(z=floor+spacing*2-87+3,w=sw,d=sd,n=8),s3d.station(z=floor+spacing*2-87+78,w=rimw,d=rimd,n=8))
top=s3d.pocket(top,s3d.rect(w=sw,d=sd,r=wall),depth=28,on=top.face(class="tok-string">"end"))
top=s3d.hole(top,d=64,depth=36,on=s3d.grid(nx=1,ny=4,py=132,on=s3d.local(top,x=108,z=733)))
solids.append(top)
slots=s3d.at(s3d.box(class="tok-string">"slot_ribs",w=sw,d=wall,h=15),on=s3d.grid(nx=1,ny=4,py=28),y=196,z=705)
solids.extend(slots if isinstance(slots,list) else [slots])
panel=s3d.at(s3d.box(class="tok-string">"end_panel",w=panelw,d=panelt,h=panelh),y=panel_y,z=103)
solids.append(panel)
for bh,bz,bd in [(binh,248,bind),(binh*0.4,664,bind*0.64)]:
bin=s3d.loft(class="tok-string">"hanging_bin",s3d.station(z=bz,w=binw,d=bd/2,y=biny+bd/4,n=6),s3d.station(z=bz+bh,w=binw,d=bd,y=biny,n=6))
solids.append(s3d.shell(bin,t=panelt,open=class="tok-string">"end"))
for sign in [-1,1]:
path=[(-handlew/2,sign*py,h-10),(-handlew/2,sign*handley,handlez), (handlew/2,sign*handley,handlez),(handlew/2,sign*py,h-10)]
solids.append(s3d.wire(class="tok-string">"push_handle",path=path,d=grip,fillet=grip))
for ob in solids:
s3d.material(ob,class="tok-string">"plastic",color=class="tok-string">"class="tok-comment">#44494b")
return s3d.group(class="tok-string">"trolley_frame",*solids)
def caster_fork_back(w=45,d=141,h=74,t=5,offset=44.5,code=class="tok-string">"B"):
boss=s3d.at(s3d.tube(class="tok-string">"swivel",d=w,d_in=w/3,h=t*2),y=offset,z=h-t*2)
outline=s3d.poly([(-58,10),(-50,28),(-12,35),(-8,65),(52,65),(70,45),(10,5)])
cheek=s3d.at(s3d.extrude(class="tok-string">"cheek",outline,h=t),x=-w/2,rx=90,rz=90)
other=s3d.transform(s3d.copy(cheek),mirror=class="tok-string">"x")
pedal=s3d.at(s3d.box(class="tok-string">"brake",w=w-t,d=d/4,h=t),y=-d/3,z=12)
solid=s3d.group(class="tok-string">"fork_body",boss,cheek,other,pedal)
s3d.material(solid,class="tok-string">"steel",color=class="tok-string">"class="tok-comment">#747b80")
wheel=s3d.at(caster_wheel_back(),y=7.5,z=-26)
s3d.joint(class="tok-string">"joint_wheel"+code+class="tok-string">"_01_joint_00",wheel,s3d.local(solid,x=0,y=7.5,z=12),kind=class="tok-string">"continuous",axis=class="tok-string">"+X")
return s3d.group(class="tok-string">"caster_fork_back",solid,wheel)
def caster_wheel_back(w=24,d=75):
tire=s3d.at(s3d.cylinder(class="tok-string">"wheel",d=d,h=w),x=-w/2,z=d/2,ry=90)
s3d.material(tire,class="tok-string">"rubber",color=class="tok-string">"class="tok-comment">#242729")
return s3d.group(class="tok-string">"caster_wheel_back",tire)
def caster_fork_front(w=45,d=142,h=74,t=5,offset=45,code=class="tok-string">"A"):
boss=s3d.at(s3d.tube(class="tok-string">"swivel",d=w,d_in=w/3,h=t*2),y=offset,z=h-t*2)
outline=s3d.poly([(-58,10),(-50,28),(-12,35),(-8,65),(52,65),(70,45),(10,5)])
cheek=s3d.at(s3d.extrude(class="tok-string">"cheek",outline,h=t),x=-w/2,rx=90,rz=90)
other=s3d.transform(s3d.copy(cheek),mirror=class="tok-string">"x")
pedal=s3d.at(s3d.box(class="tok-string">"brake",w=w-t,d=d/4,h=t),y=-d/3,z=12)
solid=s3d.group(class="tok-string">"fork_body",boss,cheek,other,pedal)
s3d.material(solid,class="tok-string">"steel",color=class="tok-string">"class="tok-comment">#747b80")
wheel=s3d.at(caster_wheel_front(),y=8,z=-26)
s3d.joint(class="tok-string">"joint_wheel"+code+class="tok-string">"_01_joint_00",wheel,s3d.local(solid,x=0,y=8,z=12),kind=class="tok-string">"continuous",axis=class="tok-string">"+X")
return s3d.group(class="tok-string">"caster_fork_front",solid,wheel)
def caster_wheel_front(w=24,d=75):
tire=s3d.at(s3d.cylinder(class="tok-string">"wheel",d=d,h=w),x=-w/2,z=d/2,ry=90)
s3d.material(tire,class="tok-string">"rubber",color=class="tok-string">"class="tok-comment">#242729")
return s3d.group(class="tok-string">"caster_wheel_front",tire)