import sand3d as s3d
def wardrobe():
case = s3d.at(cabinet_case(), x=1198, y=259)
return s3d.assembly(class="tok-string">"wardrobe", case)
def cabinet_case(w=2396, d=518, h=2319, t=25, skin=12):
back = s3d.at(s3d.box(class="tok-string">"back", w, skin, h), y=(d-skin)/2)
bottom = s3d.box(class="tok-string">"bottom", w, d, t)
top = s3d.at(s3d.box(class="tok-string">"top", w, d, t), z=h-t)
side = s3d.at(s3d.box(class="tok-string">"end", skin, d, h), x=-(w-skin)/2)
twin = s3d.transform(s3d.copy(side), mirror=class="tok-string">"x")
shell = s3d.join(back, bottom, top, side, twin)
s3d.material(shell, class="tok-string">"wood" if False else class="tok-string">"painted_metal", color=class="tok-string">"class="tok-comment">#b9b4a8")
partition = s3d.at(bay_partition(), x=-395, z=t)
partition_image = s3d.transform(s3d.copy(partition), mirror=class="tok-string">"x")
panels = s3d.at(projecting_panels(), x=-770, y=-450.25, z=26)
panels_image = s3d.transform(s3d.copy(panels), mirror=class="tok-string">"x")
shelves = s3d.at(middle_shelves(), y=8.5)
drawers = s3d.at(drawer_stack(), x=-794.5, y=-2.5, z=34)
drawers_image = s3d.transform(s3d.copy(drawers), mirror=class="tok-string">"x")
shelf = s3d.at(outer_shelf(), x=-794.5, z=1674)
shelf_image = s3d.transform(s3d.copy(shelf), mirror=class="tok-string">"x")
return s3d.group(class="tok-string">"cabinet_case", shell, partition, partition_image, panels, panels_image, shelves, drawers, drawers_image, shelf, shelf_image)
def bay_partition(w=26, d=518, h=2269, skin=12, edge=51):
panel = s3d.box(class="tok-string">"partition", skin, d, h)
rail = s3d.at(s3d.box(class="tok-string">"edge", w, edge, h), y=-(d-edge)/2)
rear = s3d.transform(s3d.copy(rail), mirror=class="tok-string">"y")
panel = s3d.join(panel, rail, rear)
s3d.material(panel, class="tok-string">"painted_metal", color=class="tok-string">"class="tok-comment">#b9b4a8")
return s3d.group(class="tok-string">"bay_partition", panel)
def projecting_panels(w=831, d=383.5, h=2267, t=13, lower=1648, gap=24, lean=28, outer=-396, inner=341, extra=94):
solids = []
for x, shift in [(outer, 0), (inner, lean), (inner+extra, -lean)]:
profile = s3d.poly([(x-t/2, -d/2), (x+t/2, -d/2), (x+t/2+shift, d/2), (x-t/2+shift, d/2)])
low = s3d.extrude(class="tok-string">"projecting_lower", profile, h=lower)
high = s3d.at(s3d.extrude(class="tok-string">"projecting_upper", profile, h=h-lower-gap), z=lower+gap)
s3d.material(low, class="tok-string">"painted_metal", color=class="tok-string">"class="tok-comment">#b9b4a8")
s3d.material(high, class="tok-string">"painted_metal", color=class="tok-string">"class="tok-comment">#b9b4a8")
solids.extend([low, high])
return s3d.group(class="tok-string">"projecting_panels", solids)
def middle_shelves(w=774, d=485, t=9, levels=(153,875,1075,1274,1474,1988), division_z=1674, division_t=25, division_d=518):
shelves = []
for z in levels:
shelf = s3d.at(s3d.box(class="tok-string">"shelf", w, d, t), z=z)
s3d.material(shelf, class="tok-string">"painted_metal", color=class="tok-string">"class="tok-comment">#b9b4a8")
shelves.append(shelf)
division = s3d.at(s3d.box(class="tok-string">"upper_division", w, division_d, division_t), y=-(division_d-d)/2, z=division_z)
s3d.material(division, class="tok-string">"painted_metal", color=class="tok-string">"class="tok-comment">#b9b4a8")
return s3d.group(class="tok-string">"middle_shelves", shelves, division)
def drawer_stack(w=746, d=463, pitch=161.5, front_h=102, t=13, top_z=617, cap=16):
parts = []
for i in range(4):
front = s3d.at(s3d.box(class="tok-string">"drawer_front", w, t, front_h), y=-(d-t)/2, z=i*pitch)
base = s3d.at(s3d.box(class="tok-string">"drawer_base", w, d, t), z=i*pitch)
rear = s3d.at(s3d.box(class="tok-string">"drawer_rear", w, t, front_h+t), y=(d-t)/2, z=i*pitch)
drawer = s3d.join(front, base, rear)
s3d.material(drawer, class="tok-string">"painted_metal", color=class="tok-string">"class="tok-comment">#b9b4a8")
parts.append(drawer)
cover = s3d.at(s3d.box(class="tok-string">"drawer_cover", w, d, cap), z=top_z)
s3d.material(cover, class="tok-string">"painted_metal", color=class="tok-string">"class="tok-comment">#b9b4a8")
parts.append(cover)
return s3d.group(class="tok-string">"drawer_stack", parts)
def outer_shelf(w=746, d=518, h=25):
shelf = s3d.box(class="tok-string">"upper_shelf", w, d, h)
s3d.material(shelf, class="tok-string">"painted_metal", color=class="tok-string">"class="tok-comment">#b9b4a8")
return s3d.group(class="tok-string">"outer_shelf", shelf)