import sand3d as s3d
def enclosure():
root=s3d.at(shell(),x=4500,y=-4501.5)
return s3d.assembly(&class="tok-comment">#39;enclosure39;,root)
def shell(w=11000,d=11003,h=12300,span=10000,t=100,floor=1300,roof=11295,roof_top=11600,lip=950,post=400,header=9731):
cx=(span-w)/2
cy=-4501.5
a=s3d.at(s3d.box(&class="tok-comment">#39;wall_x39;,w=t,d=span+t,h=roof_top-floor),x=-span/2-t/2-cx,y=-span/2+t/2-cy,z=floor)
b=s3d.at(s3d.box(&class="tok-comment">#39;wall_y39;,w=span+t,d=t,h=roof_top-floor),x=-t/2-cx,y=t/2-cy,z=floor)
bottom=s3d.at(s3d.box(&class="tok-comment">#39;floor39;,w=span,d=span,h=t),x=-cx,y=-span/2-cy,z=floor-t)
top=s3d.at(s3d.box(&class="tok-comment">#39;roof39;,w=span+t,d=span+t,h=roof_top-roof),x=-t/2-cx,y=-span/2+t/2-cy,z=roof)
edging=s3d.at(base_trim(span=span,lip=lip,floor=floor,t=t),x=-cx,y=lip-cy,rx=90)
strip=s3d.at(s3d.box(&class="tok-comment">#39;roof_strip39;,w=lip,d=span+lip,h=t*2),x=-span/2-lip/2-cx,y=-span/2+lip/2-cy,z=h-t*2)
strip2=s3d.at(s3d.box(&class="tok-comment">#39;roof_return39;,w=span+lip,d=lip,h=t*2),x=-lip/2-cx,y=lip/2-cy,z=h-t*2)
riser=s3d.at(s3d.box(&class="tok-comment">#39;raised_edge39;,w=t,d=span+t,h=h-roof_top+t),x=-span/2-t/2-cx,y=-span/2+t/2-cy,z=roof_top-t)
riser2=s3d.at(s3d.box(&class="tok-comment">#39;raised_return39;,w=span+t,d=t,h=h-roof_top+t),x=-t/2-cx,y=t/2-cy,z=roof_top-t)
solids=[a,b,bottom,top,edging,strip,strip2,riser,riser2]
for x,y in ((-span/2+post,-post),(span/2-post/2,-post),(-span/2+post,-span+post/2),(span/2-post/2,-span+post/2)):
upright=s3d.at(s3d.box(&class="tok-comment">#39;upright39;,w=post,d=post/2,h=header-floor),x=x-cx,y=y-cy,z=floor)
channel=s3d.at(s3d.box(&class="tok-comment">#39;recess39;,w=post/3,d=post/3,h=header-floor-post),x=x-cx,y=y-cy-post/5,z=floor+post/2)
solids.append(s3d.cut(upright,channel))
for z in (header,roof-t):
solids.append(s3d.at(s3d.box(&class="tok-comment">#39;header39;,w=span,d=t,h=t),x=-cx,y=-span+t/2-cy,z=z))
solids.append(s3d.at(s3d.box(&class="tok-comment">#39;side_header39;,w=t,d=span,h=t),x=span/2-t/2-cx,y=-span/2-cy,z=z))
for i in range(10):
x=-span/2+i*span/10
path=[(x-cx,-span+t/2-cy,header+t),(x+span/20-cx,-span+t/2-cy,roof-t),(x+span/10-cx,-span+t/2-cy,header+t)]
solids.append(s3d.wire(&class="tok-comment">#39;brace39;,path=path,d=t/4))
y=-span+i*span/10
solids.append(s3d.wire(&class="tok-comment">#39;side_brace39;,path=[(span/2-t/2-cx,y-cy,header+t),(span/2-t/2-cx,y+span/20-cy,roof-t),(span/2-t/2-cx,y+span/10-cy,header+t)],d=t/4))
for i in range(1,5):
solids.append(s3d.at(s3d.box(&class="tok-comment">#39;ceiling_rail39;,w=span,d=t,h=t/2),x=-cx,y=-i*span/5-cy,z=roof-post-t*1.5))
for ob in solids:
s3d.material(ob,&class="tok-comment">#39;painted_metalclass="tok-string">39;,color=39;#85898b39;)
parent=s3d.group(&class="tok-comment">#39;shell39;,*solids)
children=[]
names=[button_one(),button_two(),button_three(),button_four(),button_five(),button_six(),button_seven(),button_eight(),button_nine(),button_ten(),button_eleven(),button_twelve(),button_thirteen(),button_fourteen(),button_fifteen()]
for i,ob in enumerate(names):
col=i%5
row=iclass="tok-comment">//5
child=s3d.at(ob,x=135-4500,y=-1251+col*22.5-cy,z=2864-row*22.5)
s3d.joint(&class="tok-comment">#39;joint_sm_phone_buttonclass="tok-string">39;+str(i+1)+39;_a01_joint_00class="tok-string">39;,child,on=s3d.local(parent,x=-4360,y=3250.5+col*22.5,z=2872-row*22.5),kind=39;prismaticclass="tok-string">39;,axis=39;+X39;,range=(-2,0))
children.append(child)
fan=s3d.at(fan_rotor(),x=970.5-4500,y=-9852-cy,z=4087)
s3d.joint(&class="tok-comment">#39;joint_sm_fan_blades_a01_joint_00class="tok-string">39;,fan,on=s3d.local(parent,x=-3514,y=-5349.5,z=4287),kind=39;continuousclass="tok-string">39;,axis=39;+Y39;)
return s3d.group(&class="tok-comment">#39;shell_body39;,parent,*children,fan)
def base_trim(span,lip,floor,t,slope=0.073):
low=-span/2-lip
high=span/2
profile=s3d.poly([(low,0),(high,(span+lip)*slope),(high,floor-t*5),(low+lip/2,floor),(low,floor-t*2)])
ob=s3d.extrude(&class="tok-comment">#39;angled_plinth39;,profile,h=span+lip)
cutter=s3d.at(s3d.extrude(&class="tok-comment">#39;underside_plane39;,s3d.poly([(-span-lip,-floor),(0,-floor),(0,(span+lip)*slope),(-span-lip,0)]),h=span+lip+t*2),ry=90,x=low-t)
return s3d.cut(ob,cutter)
def button_one(w=12,d=18,h=17):
return s3d.group(&class="tok-comment">#39;button_one39;,key(w=w,d=d,h=h))
def key(w=12,d=18,h=17):
ob=s3d.box(&class="tok-comment">#39;key39;,w=w,d=d,h=h)
s3d.material(ob,&class="tok-comment">#39;plasticclass="tok-string">39;,color=39;#34383a39;)
return ob
def button_two(w=12,d=17,h=17):
return s3d.group(&class="tok-comment">#39;button_two39;,key(w=w,d=d,h=h))
def button_three(w=12,d=18,h=17):
return s3d.group(&class="tok-comment">#39;button_three39;,key(w=w,d=d,h=h))
def button_four(w=12,d=17,h=17):
return s3d.group(&class="tok-comment">#39;button_four39;,key(w=w,d=d,h=h))
def button_five(w=12,d=18,h=17):
return s3d.group(&class="tok-comment">#39;button_five39;,key(w=w,d=d,h=h))
def button_six(w=12,d=18,h=18):
return s3d.group(&class="tok-comment">#39;button_six39;,key(w=w,d=d,h=h))
def button_seven(w=12,d=17,h=18):
return s3d.group(&class="tok-comment">#39;button_seven39;,key(w=w,d=d,h=h))
def button_eight(w=12,d=18,h=18):
return s3d.group(&class="tok-comment">#39;button_eight39;,key(w=w,d=d,h=h))
def button_nine(w=12,d=17,h=18):
return s3d.group(&class="tok-comment">#39;button_nine39;,key(w=w,d=d,h=h))
def button_ten(w=12,d=18,h=18):
return s3d.group(&class="tok-comment">#39;button_ten39;,key(w=w,d=d,h=h))
def button_eleven(w=12,d=18,h=17):
return s3d.group(&class="tok-comment">#39;button_eleven39;,key(w=w,d=d,h=h))
def button_twelve(w=12,d=17,h=17):
return s3d.group(&class="tok-comment">#39;button_twelve39;,key(w=w,d=d,h=h))
def button_thirteen(w=12,d=18,h=17):
return s3d.group(&class="tok-comment">#39;button_thirteen39;,key(w=w,d=d,h=h))
def button_fourteen(w=12,d=17,h=17):
return s3d.group(&class="tok-comment">#39;button_fourteen39;,key(w=w,d=d,h=h))
def button_fifteen(w=12,d=18,h=17):
return s3d.group(&class="tok-comment">#39;button_fifteen39;,key(w=w,d=d,h=h))
def fan_rotor(w=391,d=126,h=418):
ob=s3d.at(s3d.cylinder(&class="tok-comment">#39;rotor39;,d=w,h=d),rx=90,y=d/2,z=h/2)
s3d.material(ob,&class="tok-comment">#39;aluminiumclass="tok-string">39;,color=39;#777c8039;)
return s3d.group(&class="tok-comment">#39;fan_rotor39;,ob)