import sand3d as s3d
def tower():
root = s3d.at(cabinet(), x=1.5, y=4, z=-1)
a = s3d.at(upper_door(), x=351, y=0, z=1615)
b = s3d.at(middle_door(), x=350.5, y=-0.5, z=1241)
c = s3d.at(lower_door(), x=350.5, y=-0.5, z=867)
p = s3d.at(bottom_slide(), x=14.5, y=-0.5, z=146)
q = s3d.at(second_slide(), x=14.5, y=-0.5, z=438)
r = s3d.at(third_slide(), x=14.5, y=0.5, z=584)
t = s3d.at(fourth_slide(), x=14.5, y=-0.5, z=730)
s3d.joint(&class="tok-comment">#39;joint_hinges_03_joint_00class="tok-string">39;, a, on=s3d.local(root, x=353.5, y=296, z=1803), axis=39;+Z39;, range=(0,90))
s3d.joint(&class="tok-comment">#39;joint_hinges_02_joint_00class="tok-string">39;, b, on=s3d.local(root, x=353.5, y=296, z=1430), axis=39;+Z39;, range=(0,90))
s3d.joint(&class="tok-comment">#39;joint_hinges_01_joint_00class="tok-string">39;, c, on=s3d.local(root, x=353.5, y=296, z=1056), axis=39;+Z39;, range=(0,90))
s3d.joint(&class="tok-comment">#39;joint_slide_01_joint_00class="tok-string">39;, p, on=s3d.local(root, x=326.5, y=-5, z=162), kind=39;prismaticclass="tok-string">39;, axis=39;+X39;, range=(0,580))
s3d.joint(&class="tok-comment">#39;joint_slide_02_joint_00class="tok-string">39;, q, on=s3d.local(root, x=326.5, y=-5, z=454), kind=39;prismaticclass="tok-string">39;, axis=39;+X39;, range=(0,580))
s3d.joint(&class="tok-comment">#39;joint_slide_03_joint_00class="tok-string">39;, r, on=s3d.local(root, x=325.5, y=-5, z=600), kind=39;prismaticclass="tok-string">39;, axis=39;+X39;, range=(0,580))
s3d.joint(&class="tok-comment">#39;joint_slide_04_joint_00class="tok-string">39;, t, on=s3d.local(root, x=326.5, y=-5, z=746), kind=39;prismaticclass="tok-string">39;, axis=39;+X39;, range=(0,580))
return s3d.assembly(&class="tok-comment">#39;tower39;, root,a,b,c,p,q,r,t)
def cabinet(w=717,d=750,h=2103,r=53,t=12,front=606,bottom=82,cap=62,shelf_z=860,pitch=187):
body = s3d.at(s3d.extrude(&class="tok-comment">#39;case39;, s3d.rect(w=w,d=d,r=r), h=h-bottom-cap), x=-1.5,y=-3,z=bottom)
tool = s3d.at(s3d.box(&class="tok-comment">#39;opening39;,w=w,d=front,h=h-bottom-cap-t),x=t,y=-3,z=bottom+t)
body = s3d.cut(body,tool)
lid = s3d.at(s3d.extrude(&class="tok-comment">#39;cap39;,s3d.rect(w=w+2,d=d,r=r),h=cap),x=-1.5,y=-3,z=h-cap)
feet = s3d.at(s3d.cone(&class="tok-comment">#39;foot39;,d=60,d2=25,h=bottom+t),on=s3d.grid(nx=2,ny=2,px=638,py=644))
shelves=[]
for i in range(7):
shelf=s3d.at(s3d.box(&class="tok-comment">#39;shelf39;,w=w-t*2,d=front,h=t),x=-t,y=-3,z=shelf_z+i*pitch)
s3d.material(shelf,&class="tok-comment">#39;painted_metalclass="tok-string">39;,color=39;#999b9939;)
shelves.append(shelf)
s3d.material(body,&class="tok-comment">#39;painted_metalclass="tok-string">39;,color=39;#85878539;)
s3d.material(lid,&class="tok-comment">#39;painted_metalclass="tok-string">39;,color=39;#85878539;)
s3d.material(feet,&class="tok-comment">#39;rubberclass="tok-string">39;,color=39;#38393839;)
return s3d.group(&class="tok-comment">#39;cabinet39;,body,lid,feet,shelves)
def upper_door(w=14,d=606,h=370):
solid=s3d.box(&class="tok-comment">#39;panel39;,w=w,d=d,h=h)
s3d.material(solid,&class="tok-comment">#39;painted_metalclass="tok-string">39;,color=39;#888b8939;)
return s3d.group(&class="tok-comment">#39;upper_door39;,solid)
def middle_door(w=15,d=605,h=370):
solid=s3d.box(&class="tok-comment">#39;panel39;,w=w,d=d,h=h)
s3d.material(solid,&class="tok-comment">#39;painted_metalclass="tok-string">39;,color=39;#888b8939;)
return s3d.group(&class="tok-comment">#39;middle_door39;,solid)
def lower_door(w=15,d=605,h=370):
solid=s3d.box(&class="tok-comment">#39;panel39;,w=w,d=d,h=h)
s3d.material(solid,&class="tok-comment">#39;painted_metalclass="tok-string">39;,color=39;#888b8939;)
return s3d.group(&class="tok-comment">#39;lower_door39;,solid)
def bottom_slide(w=627,d=591,h=30,t=4):
solid=runner(w=w,d=d,h=h,t=t)
child=s3d.at(bottom_drawer(),x=-10,y=1,z=-29)
s3d.joint(&class="tok-comment">#39;joint_drawer_01_joint_00class="tok-string">39;,child,on=s3d.local(solid,x=343.5,y=1.5,z=115),kind=39;prismaticclass="tok-string">39;,axis=39;+X39;,range=(0,600))
return s3d.group(&class="tok-comment">#39;bottom_slide39;,solid,child)
def runner(w,d,h,t):
a=s3d.at(s3d.box(&class="tok-comment">#39;runner39;,w=w,d=t,h=h),y=(d-t)/2)
b=s3d.at(s3d.box(&class="tok-comment">#39;flanges39;,w=w,d=t*2,h=t),y=(d-t*2)/2)
c=s3d.at(s3d.copy(b),z=h-t)
a=s3d.join(a,b,c)
b=s3d.transform(s3d.copy(a),mirror=&class="tok-comment">#39;y39;)
a=s3d.merge(a,b)
s3d.material(a,&class="tok-comment">#39;steelclass="tok-string">39;,color=39;#9c9e9d39;)
return a
def bottom_drawer(w=707,d=605,h=286,t=4):
solid=tray(w=w,d=d,h=h,t=t)
return s3d.group(&class="tok-comment">#39;bottom_drawer39;,solid)
def tray(w,d,h,t):
solid=s3d.box(&class="tok-comment">#39;tray39;,w=w,d=d,h=h)
solid=s3d.shell(solid,t=t,open=&class="tok-comment">#39;top39;)
s3d.material(solid,&class="tok-comment">#39;painted_metalclass="tok-string">39;,color=39;#92959239;)
return solid
def second_slide(w=627,d=591,h=31,t=4):
solid=runner(w=w,d=d,h=h,t=t)
child=s3d.at(second_drawer(),x=-10,y=1,z=-32)
s3d.joint(&class="tok-comment">#39;joint_drawer_02_joint_00class="tok-string">39;,child,on=s3d.local(solid,x=343.5,y=0.5,z=39),kind=39;prismaticclass="tok-string">39;,axis=39;+X39;,range=(0,600))
return s3d.group(&class="tok-comment">#39;second_slide39;,solid,child)
def second_drawer(w=707,d=605,h=141,t=4):
solid=tray(w=w,d=d,h=h,t=t)
return s3d.group(&class="tok-comment">#39;second_drawer39;,solid)
def third_slide(w=627,d=589,h=30,t=4):
solid=runner(w=w,d=d,h=h,t=t)
child=s3d.at(third_drawer(),x=-10,z=-34)
s3d.joint(&class="tok-comment">#39;joint_drawer_03_joint_00class="tok-string">39;,child,on=s3d.local(solid,x=343.5,y=-0.5,z=37),kind=39;prismaticclass="tok-string">39;,axis=39;+X39;,range=(0,600))
return s3d.group(&class="tok-comment">#39;third_slide39;,solid,child)
def third_drawer(w=707,d=605,h=142,t=4):
solid=tray(w=w,d=d,h=h,t=t)
return s3d.group(&class="tok-comment">#39;third_drawer39;,solid)
def fourth_slide(w=627,d=591,h=31,t=4):
solid=runner(w=w,d=d,h=h,t=t)
child=s3d.at(fourth_drawer(),x=-10,y=1,z=-35)
s3d.joint(&class="tok-comment">#39;joint_drawer_04_joint_00class="tok-string">39;,child,on=s3d.local(solid,x=343.5,y=1.5,z=35),kind=39;prismaticclass="tok-string">39;,axis=39;+X39;,range=(0,600))
return s3d.group(&class="tok-comment">#39;fourth_slide39;,solid,child)
def fourth_drawer(w=707,d=605,h=141,t=4):
solid=tray(w=w,d=d,h=h,t=t)
return s3d.group(&class="tok-comment">#39;fourth_drawer39;,solid)