import sand3d as s3d
def refrigerator():
base = s3d.at(cabinet(), x=310, y=-8)
return s3d.assembly(&class="tok-comment">#39;refrigerator39;, base)
def cabinet(w=566, d=750, h=1990, bottom=35, wall=45, shelf_t=6):
outer = s3d.at(s3d.box(&class="tok-comment">#39;cabinet_shell39;, w=w, d=d, h=h), x=-22, y=8, z=bottom)
cavity = s3d.at(s3d.box(&class="tok-comment">#39;interior39;, w=w, d=d-2*wall, h=h-2*wall), x=wall/2, y=8, z=bottom+wall)
outer = s3d.cut(outer, cavity)
s3d.material(outer, &class="tok-comment">#39;painted_metalclass="tok-string">39;, color=39;#d4d7d939;)
shelves=[]
for level in (380, 550, 720, 1135, 1365, 1610, 1790):
shelf=s3d.at(s3d.box(&class="tok-comment">#39;glass_shelf39;, w=w-wall, d=d-2*wall, h=shelf_t), x=wall/2, y=8, z=level)
s3d.material(shelf, &class="tok-comment">#39;glassclass="tok-string">39;, color=39;#d6e5e639;)
shelves.append(shelf)
divider=s3d.at(s3d.box(&class="tok-comment">#39;divider39;, w=w, d=d, h=35), x=-22, y=8, z=850)
s3d.material(divider, &class="tok-comment">#39;plasticclass="tok-string">39;, color=39;#e4e5e539;)
feet=s3d.at(s3d.cylinder(&class="tok-comment">#39;foot39;, d=72, h=bottom+2), on=s3d.grid(nx=2, ny=2, px=438, py=625), x=-22, y=8)
s3d.material(feet, &class="tok-comment">#39;rubberclass="tok-string">39;, color=39;#34363839;)
lower=s3d.at(freezer_door(), x=310, y=9, z=34)
upper=s3d.at(refrigerator_door(), x=310, y=9, z=892)
drawer=s3d.at(storage_drawer(), x=-129.5, y=8, z=100)
s3d.joint(&class="tok-comment">#39;joint_door_02_joint_00class="tok-string">39;, lower, on=s3d.local(outer, x=313, y=-345, z=817), kind=39;revoluteclass="tok-string">39;, axis=39;+Z39;, range=(-150,0))
s3d.joint(&class="tok-comment">#39;joint_door_01_joint_00class="tok-string">39;, upper, on=s3d.local(outer, x=313, y=-345, z=879), kind=39;revoluteclass="tok-string">39;, axis=39;+Z39;, range=(-150,0))
s3d.joint(&class="tok-comment">#39;joint_box_01_joint_00class="tok-string">39;, drawer, on=s3d.local(outer, x=-73, y=0, z=263), kind=39;prismaticclass="tok-string">39;, axis=39;+X39;, range=(0,450))
return s3d.group(&class="tok-comment">#39;cabinet39;, outer, shelves, divider, feet, lower, upper, drawer)
def freezer_door(w=84, d=750, h=845, handle_h=350, handle_y=285, handle_z=445):
panel=door_panel(&class="tok-comment">#39;lower_panel39;, w=w, d=d, h=h)
s3d.material(panel, &class="tok-comment">#39;painted_metalclass="tok-string">39;, color=39;#b9bec139;)
handle=s3d.at(s3d.extrude(&class="tok-comment">#39;handle39;, s3d.rect(w=20, d=27, r=8), h=handle_h), x=w/2+6, y=handle_y, z=handle_z)
s3d.material(handle, &class="tok-comment">#39;aluminiumclass="tok-string">39;, color=39;#a5aaad39;)
return s3d.group(&class="tok-comment">#39;freezer_door39;, panel, handle)
def door_panel(name, w, d, h):
profile=s3d.poly([(-w/2,-d/2),(-w/2,d/2),(-w/4,d/2),s3d.spline([(-w/4,d/2),(w/4,d*0.43),(w/2,0),(w/4,-d*0.43),(-w/4,-d/2)])])
return s3d.extrude(name, profile, h=h)
def refrigerator_door(w=84, d=750, h=1133, handle_h=350, handle_y=285, handle_z=50, bin_depth=110, bin_h=130, t=6):
panel=door_panel(&class="tok-comment">#39;upper_panel39;, w=w, d=d, h=h)
inset=s3d.at(s3d.box(&class="tok-comment">#39;inner_recess39;, w=60, d=d-90, h=h-100), x=-w/2, z=50)
panel=s3d.cut(panel,inset)
s3d.material(panel, &class="tok-comment">#39;painted_metalclass="tok-string">39;, color=39;#b9bec139;)
handle=s3d.at(s3d.extrude(&class="tok-comment">#39;handle39;, s3d.rect(w=20, d=27, r=8), h=handle_h), x=w/2+6, y=handle_y, z=handle_z)
s3d.material(handle, &class="tok-comment">#39;aluminiumclass="tok-string">39;, color=39;#a5aaad39;)
bins=[]
for z in (230, 490, 620, 750, 880):
tray=s3d.shell(s3d.box(&class="tok-comment">#39;door_binclass="tok-string">39;, w=20, d=440, h=bin_h), t=t, open=39;top39;)
tray=s3d.at(tray, x=-w/2-10+t, y=-90, z=z)
s3d.material(tray, &class="tok-comment">#39;plasticclass="tok-string">39;, color=39;#e1e6e739;)
bins.append(tray)
tray=s3d.shell(s3d.box(&class="tok-comment">#39;bottle_binclass="tok-string">39;, w=bin_depth, d=d-90, h=bin_h), t=t, open=39;top39;)
tray=s3d.at(tray, x=-w/2-bin_depth/2+t, z=40)
s3d.material(tray, &class="tok-comment">#39;plasticclass="tok-string">39;, color=39;#e1e6e739;)
liner=s3d.at(s3d.box(&class="tok-comment">#39;liner39;, w=24, d=d-40, h=h-40), x=-w/2, z=20)
recess=s3d.at(s3d.box(&class="tok-comment">#39;liner_recess39;, w=35, d=d-90, h=h-100), x=-w/2-10, z=50)
liner=s3d.cut(liner,recess)
s3d.material(liner, &class="tok-comment">#39;plasticclass="tok-string">39;, color=39;#e4e6e739;)
return s3d.group(&class="tok-comment">#39;refrigerator_door39;, panel, handle, liner, tray, bins)
def storage_drawer(w=271, d=620, h=255, t=5):
drawer=s3d.box(&class="tok-comment">#39;drawer39;, w=w-t, d=d-t, h=h-t)
drawer=s3d.fillet(drawer, r=10)
lid=s3d.at(s3d.extrude(&class="tok-comment">#39;lid39;, s3d.rect(w=w, d=d, r=t), h=t*2), z=h-t*2)
tab=s3d.at(s3d.box(&class="tok-comment">#39;pull39;, w=t*2, d=80, h=95), x=w/2-t, z=h-95)
drawer=s3d.join(drawer,lid,tab)
s3d.material(drawer, &class="tok-comment">#39;plasticclass="tok-string">39;, color=39;#d2dadd39;)
return s3d.group(&class="tok-comment">#39;storage_drawer39;, drawer)