import sand3d as s3d
def control_wall():
root = s3d.at(panel(), x=-15)
return s3d.assembly(class="tok-string">"control_wall", root)
def panel(w=54, d=1834, h=1537, front=6, cover_w=8, cover_d=54, cover_h=54):
slab = s3d.at(s3d.box(class="tok-string">"panel", w=w, d=d, h=h), x=front-w/2+15)
s3d.material(slab, class="tok-string">"painted_metal", color=class="tok-string">"class="tok-comment">#b9bec2")
bay = s3d.at(s3d.box(class="tok-string">"keyboard_recess", w=40, d=425, h=231), x=front+15, y=600, z=277)
slab = s3d.cut(slab, bay)
children = []
for i in range(1, 6):
y = -722 + (i-1)*130
cover = s3d.at(outlet_cover(w=cover_w, d=cover_d, h=cover_h), x=29, y=y, z=149)
s3d.joint(class="tok-string">"joint_outletCover_%02d_joint_00" % i, cover, s3d.local(slab, x=29, y=y, z=199), kind=class="tok-string">"revolute", axis=class="tok-string">"+Y", range=(-90, 0))
children.append(cover)
for i, y in enumerate((44, 69, 157, 183), start=1):
surround = s3d.at(s3d.box(class="tok-string">"button_mount", w=10, d=30, h=60), x=24, y=y, z=145)
s3d.material(surround, class="tok-string">"plastic", color=class="tok-string">"class="tok-comment">#42494c")
children.append(surround)
button = s3d.at(push_button(), x=31.5, y=y, z=178)
s3d.joint(class="tok-string">"joint_button_%02d_joint_00" % i, button, s3d.local(slab, x=31, y=y, z=189), kind=class="tok-string">"prismatic", axis=class="tok-string">"+X", range=(-1.5, 0))
children.append(button)
tray = s3d.at(keyboard_tray(), x=75.5, y=600.5, z=312)
s3d.joint(class="tok-string">"joint_keyboardPanel_01_joint_00", tray, s3d.local(slab, x=-5, y=586, z=333), kind=class="tok-string">"revolute", axis=class="tok-string">"+Y", range=(-90, 0))
children.append(tray)
for name, x, y, z, length, angle in ((class="tok-string">"seconds", 1, 599, 1221, 143, -12), (class="tok-string">"hours", -2.5, 531, 1250, 79, -75), (class="tok-string">"minutes", -5.5, 519, 1162, 120, -43)):
hand = s3d.at(clock_hand(length=length, angle=angle), x=x+15, y=y, z=z)
s3d.joint(class="tok-string">"joint_%sHand_01_joint_00" % name, hand, s3d.local(slab, x=15, y=599, z=1250), kind=class="tok-string">"continuous", axis=class="tok-string">"+X")
children.append(hand)
return s3d.group(class="tok-string">"panel", slab, children)
def outlet_cover(w=8, d=54, h=54):
solid = s3d.box(class="tok-string">"outlet_cover", w=w, d=d, h=h)
s3d.material(solid, class="tok-string">"plastic", color=class="tok-string">"class="tok-comment">#d2d5d6")
return s3d.group(class="tok-string">"outlet_cover", solid)
def push_button(w=3, d=22, h=23):
solid = s3d.box(class="tok-string">"button", w=w, d=d, h=h)
s3d.material(solid, class="tok-string">"plastic", color=class="tok-string">"class="tok-comment">#667e72")
return s3d.group(class="tok-string">"button", solid)
def clock_hand(w=3, length=100, angle=0):
solid = s3d.at(s3d.box(class="tok-string">"hand", w=w, d=w, h=length), rx=angle)
s3d.material(solid, class="tok-string">"painted_metal", color=class="tok-string">"class="tok-comment">#252c30")
return s3d.group(class="tok-string">"clock_hand", solid)
def keyboard_tray(w=195, d=425, h=31, floor=9, rim=3, bed_h=16):
base = s3d.box(class="tok-string">"tray", w=w, d=d, h=floor)
s3d.material(base, class="tok-string">"painted_metal", color=class="tok-string">"class="tok-comment">#a9afb4")
edges = s3d.at(s3d.box(class="tok-string">"raised_edge", w=w, d=rim, h=h-floor), on=s3d.grid(nx=1, ny=2, py=d-rim), z=floor-rim/2)
s3d.material(edges, class="tok-string">"painted_metal", color=class="tok-string">"class="tok-comment">#a9afb4")
bed = s3d.at(s3d.box(class="tok-string">"keyboard_bed", w=120, d=335, h=bed_h-floor), x=-1, y=-40, z=floor-rim/2)
s3d.material(bed, class="tok-string">"plastic", color=class="tok-string">"class="tok-comment">#454b50")
children = []
for i in range(1, 90):
x, y, kw, kd = key_location(i)
key = s3d.at(keyboard_key(w=kw, d=kd), x=x-60.5, y=y-600.5, z=16)
s3d.joint(class="tok-string">"joint_keyboardButton_%02d_joint_00" % i, key, s3d.local(base, x=x-60.5, y=y-600.5, z=17), kind=class="tok-string">"prismatic", axis=class="tok-string">"+Z", range=(-2.5, 0))
children.append(key)
return s3d.group(class="tok-string">"keyboard_tray", base, edges, bed, children)
def key_location(i):
if i <= 16:
ys = (409, 445, 463, 481, 499, 525, 543, 561, 579, 606, 624, 642, 659, 679, 697, 715)
return 9+(i-1)*0.4, ys[i-1], 10, 14
if i <= 31:
return 30+(i-17)*0.4, 409+(i-17)*17.85, 14, 14
if i <= 44:
return 48+(i-32)*0.4, 413 if i == 32 else 436+(i-33)*17.85, 14, 24 if i == 32 else 14
if i <= 57:
if i == 57:
return 62, 646.5, 32, 37
return 66+(i-45)*0.4, 415 if i == 45 else 439+(i-46)*17.9, 14, 28 if i == 45 else 14
if i <= 69:
if i == 69:
return 88.5, 642, 15, 46
return 84+(i-58)*0.4, 419 if i == 58 else 448+(i-59)*17.9, 14, 37 if i == 58 else 14
if i <= 79:
ys = (410, 432, 455, 475, 521, 567, 587, 610, 633, 655)
return 102+(i-70)*0.55, ys[i-70], 14, 71 if i == 74 else 19
if i <= 82:
return 36, 679+(i-80)*17.5, 14, 14
if i <= 85:
return 54, 678+(i-83)*18, 14, 14
if i == 86:
return 90, 696, 14, 14
return 108, 677+(i-87)*18, 14, 14
def keyboard_key(w=14, d=14, h=2):
solid = s3d.box(class="tok-string">"key", w=w, d=d, h=h)
s3d.material(solid, class="tok-string">"plastic", color=class="tok-string">"class="tok-comment">#d2d4d1")
return s3d.group(class="tok-string">"keyboard_key", solid)