import sand3d as s3d
import math
def desktop_monitor():
base = base_plate()
f = s3d.local(base, 0, 0, 18)
st = s3d.at(stand(), on=f)
s3d.joint(class="tok-string">"base_swivel", st, f, kind=class="tok-string">"continuous", axis=class="tok-string">"+Z")
f = s3d.local(st, 0, -44, 338)
th = s3d.at(tilt_head(), on=f)
s3d.joint(class="tok-string">"stand_tilt", th, f, kind=class="tok-string">"revolute", axis=class="tok-string">"-X", range=(-18, 18))
f = s3d.local(th, 0, -42, 0)
sh = s3d.at(display_shell(), on=f)
s3d.joint(class="tok-string">"display_pivot", sh, f, kind=class="tok-string">"continuous", axis=class="tok-string">"+Y")
f = s3d.local(sh, 192, -40, -189)
r = s3d.at(rocker(), on=f)
s3d.joint(class="tok-string">"power_switch", r, f, kind=class="tok-string">"revolute", axis=class="tok-string">"+X", range=(-17.19, 17.19))
f = s3d.local(sh, 162, -40, -189)
b0 = s3d.at(button(class="tok-string">"button"), on=f)
s3d.joint(class="tok-string">"menu_button_0_press", b0, f, kind=class="tok-string">"prismatic", axis=class="tok-string">"+Z", range=(0, 0.8))
f = s3d.local(sh, 140, -40, -189)
b1 = s3d.at(button(class="tok-string">"button"), on=f)
s3d.joint(class="tok-string">"menu_button_1_press", b1, f, kind=class="tok-string">"prismatic", axis=class="tok-string">"+Z", range=(0, 0.8))
f = s3d.local(sh, 118, -40, -189)
b2 = s3d.at(button(class="tok-string">"button"), on=f)
s3d.joint(class="tok-string">"menu_button_2_press", b2, f, kind=class="tok-string">"prismatic", axis=class="tok-string">"+Z", range=(0, 0.8))
return s3d.assembly(class="tok-string">"desktop_monitor", base, st, th, sh, r, b0, b1, b2)
def box(name, w, d, h):
return s3d.extrude(name, s3d.rect(w, d), h, both=True)
def base_plate():
a = s3d.at(box(class="tok-string">"base", 290, 220, 12), z=6)
b = s3d.at(box(class="tok-string">"pad", 120, 90, 6), z=9)
o = s3d.join(a, b)
s3d.material(o, class="tok-string">"steel", color=class="tok-string">"class="tok-comment">#1f2124")
return s3d.group(class="tok-string">"base_plate", o)
def stand():
a = s3d.extrude(class="tok-string">"collar", s3d.circle(80), 20)
b = s3d.at(box(class="tok-string">"column", 88, 38, 285), y=14, z=162.5)
c = s3d.at(box(class="tok-string">"neck", 116, 46, 60), y=10, z=285)
d = s3d.at(box(class="tok-string">"head", 160, 60, 106), y=12, z=338)
e = s3d.at(box(class="tok-string">"front_pad", 104, 28, 84), y=-26, z=338)
o = s3d.join(a, b, c, d, e)
s3d.material(o, class="tok-string">"steel", color=class="tok-string">"class="tok-comment">#1f2124")
return s3d.group(class="tok-string">"stand", o)
def tilt_head():
a = s3d.at(box(class="tok-string">"knuckle", 90, 24, 86), y=-8)
b = s3d.at(box(class="tok-string">"arm", 120, 30, 108), y=-22)
c = s3d.at(s3d.extrude(class="tok-string">"pivot_ring", s3d.circle(92), 14, both=True), y=-35, rx=90)
d = s3d.at(box(class="tok-string">"pivot_plate", 90, 14, 90), y=-35)
for x in (a, b, c, d):
s3d.material(x, class="tok-string">"plastic", color=class="tok-string">"class="tok-comment">#141416")
return s3d.group(class="tok-string">"tilt_head", a, b, c, d)
def cad_slab(name, w, d, h):
return s3d.at(s3d.extrude(name, s3d.rect(w, h), d, both=True), rx=90)
def display_shell():
shell = cad_slab(class="tok-string">"shell", 618, 14, 378)
pocket = s3d.at(cad_slab(class="tok-string">"pocket", 592, 6, 330), y=-4, z=7)
shell = s3d.cut(shell, pocket)
rear = s3d.at(cad_slab(class="tok-string">"rear", 250, 32, 188), y=23, z=5)
mount = s3d.at(cad_slab(class="tok-string">"mount", 120, 22, 60), y=14, z=-55)
shell = s3d.join(shell, rear, mount)
shell = s3d.at(shell, y=-39)
a = s3d.at(box(class="tok-string">"screen_panel", 588, 2, 326), y=-41.4, z=7)
b = s3d.at(box(class="tok-string">"screen_glass", 588, 0.8, 326), y=-42.8, z=7)
s3d.material(shell, class="tok-string">"plastic", color=class="tok-string">"class="tok-comment">#17191b")
s3d.material(a, class="tok-string">"plastic", color=class="tok-string">"class="tok-comment">#080a0d")
s3d.material(b, class="tok-string">"glass", color=class="tok-string">"class="tok-comment">#14212e", opacity=0.35)
return s3d.group(class="tok-string">"display_shell", shell, a, b)
def rocker():
o = s3d.at(box(class="tok-string">"rocker", 22, 11, 5), z=-2.5)
s3d.material(o, class="tok-string">"plastic", color=class="tok-string">"class="tok-comment">#19191c")
return s3d.group(class="tok-string">"power_rocker", o)
def button(n):
o = s3d.at(s3d.extrude(n, s3d.circle(8.4), 3.2, both=True), z=-1.6)
s3d.material(o, class="tok-string">"plastic", color=class="tok-string">"class="tok-comment">#19191c")
return s3d.group(n, o)