import sand3d as s3d
def uprights():
root = s3d.at(body_01(), x=136.5, y=-0.5, z=-3)
return s3d.assembly(class="tok-string">"uprights", root)
def body_01(w=143, rail_d=67, shaft_h=4835, foot_w=246, foot_d=511, foot_h=500, spacing=4530, shaft_x=143, top_w=300, top_d=208, top_h=215, thin=30):
members = []
for sign in (-1, 1):
y = sign * spacing
back = s3d.at(s3d.box(class="tok-string">"back_rail", w=w, d=rail_d, h=shaft_h), x=shaft_x, y=y+sign*(w-18), z=foot_h/2)
front = s3d.box(class="tok-string">"front_rail", w=w, d=rail_d, h=shaft_h)
front = s3d.hole(front, d=w-thin, depth=shaft_h)
front = s3d.at(front, x=shaft_x, y=y-sign*(w-18), z=foot_h/2)
web = s3d.at(s3d.box(class="tok-string">"upper_web", w=thin, d=w*2, h=shaft_h-foot_h*6), x=shaft_x, y=y, z=foot_h*6)
foot = s3d.at(s3d.box(class="tok-string">"foot", w=foot_w, d=foot_d, h=foot_h), x=shaft_x-thin/2, y=y)
shoulder = s3d.at(s3d.box(class="tok-string">"shoulder", w=foot_w-thin, d=foot_d-thin, h=rail_d), x=shaft_x, y=y, z=foot_h-thin)
rod = s3d.at(s3d.cylinder(class="tok-string">"rod", d=thin, h=foot_h*5), x=shaft_x, y=y-sign*w, z=foot_h)
top = s3d.at(s3d.box(class="tok-string">"head_spine", w=rail_d, d=foot_d, h=top_h), x=shaft_x-rail_d/2, y=y, z=shaft_h)
pieces = [back, front, web, foot, shoulder, rod, top]
for level in (shaft_h, shaft_h+top_h-thin):
for edge in (-1,1):
pieces.append(s3d.at(s3d.box(class="tok-string">"prong", w=top_w, d=top_d, h=thin), x=shaft_x-top_w/2, y=y+edge*(foot_d-top_d)/2, z=level))
for height in (1160,2120,2870):
pieces.append(s3d.at(s3d.box(class="tok-string">"side_block", w=w, d=w, h=top_h), x=shaft_x, y=y-sign*w, z=height-top_h/2))
pieces.append(s3d.at(s3d.box(class="tok-string">"tab", w=thin, d=top_h, h=top_w), x=shaft_x, y=y-sign*top_w, z=2120))
members.extend(pieces)
for item in members:
s3d.material(item, class="tok-string">"aluminium", color=class="tok-string">"class="tok-comment">#888b8d")
root = s3d.group(class="tok-string">"body_01", members)
lid = s3d.at(lid_01(), on=s3d.local(root, x=143.5, y=4186.5, z=1093))
s3d.joint(class="tok-string">"joint_lid_01_joint_00", lid, s3d.local(root, x=143, y=4141, z=1099), kind=class="tok-string">"revolute", axis=class="tok-string">"+X", range=(0,179))
button = s3d.at(button_01(), on=s3d.local(root, x=143, y=-4178.5, z=1125))
s3d.joint(class="tok-string">"joint_button_01_joint_00", button, s3d.local(root, x=143, y=-4178, z=1153, rx=-40.6), kind=class="tok-string">"prismatic", axis=class="tok-string">"normal", range=(-5,0))
button_other = s3d.at(button_02(), on=s3d.local(root, x=142.5, y=4181.5, z=1122))
s3d.joint(class="tok-string">"joint_button_02_joint_00", button_other, s3d.local(root, x=143, y=4182, z=1151, rx=40.7), kind=class="tok-string">"prismatic", axis=class="tok-string">"normal", range=(-5,0))
lid_other = s3d.at(lid_02(), on=s3d.local(root, x=142.5, y=-4185.5, z=1094))
s3d.joint(class="tok-string">"joint_lid_02_joint_00", lid_other, s3d.local(root, x=143, y=-4139, z=1098), kind=class="tok-string">"revolute", axis=class="tok-string">"+X", range=(-179,0))
return s3d.group(class="tok-string">"body_01_group", root, lid, button, button_other, lid_other)
def lid_01(w=114, d=104, h=104):
solid = s3d.box(class="tok-string">"lid", w=w, d=d, h=h)
s3d.material(solid, class="tok-string">"aluminium", color=class="tok-string">"class="tok-comment">#888b8d")
return s3d.group(class="tok-string">"lid_01", solid)
def button_01(w=59, d=52, h=52):
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">#333333")
return s3d.group(class="tok-string">"button_01", solid)
def button_02(w=58, d=52, h=52):
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">#333333")
return s3d.group(class="tok-string">"button_02", solid)
def lid_02(w=110, d=102, h=104):
solid = s3d.box(class="tok-string">"lid", w=w, d=d, h=h)
s3d.material(solid, class="tok-string">"aluminium", color=class="tok-string">"class="tok-comment">#888b8d")
return s3d.group(class="tok-string">"lid_02", solid)