import sand3d as s3d
def scaffold():
root = s3d.at(platform_frame(), x=-4, z=153)
front = s3d.at(front_caster_fork(), x=-361, y=-938.5, z=49)
rear = s3d.at(rear_caster_fork(), x=-361, y=886, z=49)
front_image = s3d.at(front_caster_fork(tire_joint=&class="tok-comment">#39;joint_sm_front_right_tirel_a01_joint_0039;), x=353, y=-938.5, z=49)
rear_image = s3d.at(rear_caster_fork(tire_joint=&class="tok-comment">#39;joint_sm_back_right_tire_a01_joint_0039;), x=353, y=886, z=49)
s3d.joint(&class="tok-comment">#39;joint_sm_front_left_wheel_a01_joint_00class="tok-string">39;, front, on=s3d.local(root, x=-357, y=-912, z=0), kind=39;revoluteclass="tok-string">39;, axis=39;+Z39;, range=(-3.1, 3.1))
s3d.joint(&class="tok-comment">#39;joint_sm_back_left_wheel_a01_joint_00class="tok-string">39;, rear, on=s3d.local(root, x=-357, y=912, z=0), kind=39;revoluteclass="tok-string">39;, axis=39;+Z39;, range=(-3.1, 3.1))
s3d.joint(&class="tok-comment">#39;joint_sm_front_right_wheel_a01_joint_00class="tok-string">39;, front_image, on=s3d.local(root, x=357, y=-912, z=0), kind=39;revoluteclass="tok-string">39;, axis=39;+Z39;, range=(-3.1, 3.1))
s3d.joint(&class="tok-comment">#39;joint_sm_back_right_wheel_a01_joint_00class="tok-string">39;, rear_image, on=s3d.local(root, x=357, y=912, z=0), kind=39;revoluteclass="tok-string">39;, axis=39;+Z39;, range=(-3.1, 3.1))
return s3d.assembly(&class="tok-comment">#39;scaffold39;, root, front, rear, front_image, rear_image)
def platform_frame(post_w=46, post_d=60, post_h=1650, post_pitch=714, end_pitch=1820, tip_d=26, tip_h=85, deck_w=742, deck_d=1690, deck_z=724, deck_t=9, rail_w=35, rail_h=87, rung_d=30, rung_pitch=328, rung_z=290, brace_d=20, brace_run=320, brace_z=290, hole_pitch=516, hole_l=112, hole_d=57):
posts = s3d.at(s3d.extrude(&class="tok-comment">#39;upright39;, s3d.rect(w=post_w, d=post_d, r=5), h=post_h), on=s3d.grid(nx=2, ny=2, px=post_pitch, py=end_pitch))
tips = s3d.at(s3d.cylinder(&class="tok-comment">#39;projecting_tip39;, d=tip_d, h=tip_h), on=s3d.grid(nx=2, ny=2, px=post_pitch, py=end_pitch), z=post_h-8)
rungs = []
for level in range(5):
rung = s3d.at(s3d.cylinder(&class="tok-comment">#39;rung39;, d=rung_d, h=post_pitch), rx=0, ry=90, x=-post_pitch/2, y=-end_pitch/2, z=rung_z+level*rung_pitch)
rungs.extend([rung, s3d.transform(s3d.copy(rung), y=end_pitch)])
deck = s3d.at(s3d.box(&class="tok-comment">#39;deck39;, w=deck_w, d=deck_d, h=deck_t), z=deck_z)
slots = s3d.at(s3d.extrude(&class="tok-comment">#39;hand_opening39;, s3d.slot(l=hole_l, d=hole_d), h=deck_t*3), on=s3d.grid(nx=2, px=hole_pitch), z=deck_z-deck_t, rz=90)
deck = s3d.cut(deck, slots)
rails = s3d.at(s3d.box(&class="tok-comment">#39;side_rail39;, w=rail_w, d=deck_d, h=rail_h), on=s3d.grid(nx=2, px=deck_w-rail_w), z=deck_z-rail_h)
ends = s3d.at(s3d.box(&class="tok-comment">#39;end_rail39;, w=deck_w, d=rail_w, h=rail_h), on=s3d.grid(nx=1, ny=2, py=deck_d-rail_w), z=deck_z-rail_h)
braces = []
for side in (-1, 1):
for end in (-1, 1):
brace = s3d.wire(&class="tok-comment">#39;diagonal_support39;, path=[(side*post_pitch/2,end*end_pitch/2,brace_z),(side*post_pitch/2,end*(end_pitch/2-brace_run),deck_z-rail_h)], d=brace_d)
braces.append(brace)
part = s3d.group(&class="tok-comment">#39;platform_frame39;, posts, tips, rungs, deck, rails, ends, braces)
s3d.material(part, kind=&class="tok-comment">#39;aluminiumclass="tok-string">39;, color=39;#a4a7a839;)
return part
def front_caster_fork(w=56, d=107, h=140, t=6, boss_d=38, boss_h=40, tire_joint=&class="tok-comment">#39;joint_sm_front_left_tire_a01_joint_0039;):
cheeks = s3d.at(s3d.box(&class="tok-comment">#39;fork_cheek39;, w=t, d=d, h=h-boss_h), on=s3d.grid(nx=2, px=w-t))
crown = s3d.at(s3d.box(&class="tok-comment">#39;fork_crown39;, w=w, d=d, h=t), z=h-boss_h-t)
boss = s3d.at(s3d.cylinder(&class="tok-comment">#39;swivel39;, d=boss_d, h=boss_h), y=d/4, z=h-boss_h)
solid = s3d.group(&class="tok-comment">#39;fork_metal39;, cheeks, crown, boss)
s3d.material(solid, kind=&class="tok-comment">#39;steelclass="tok-string">39;, color=39;#999da039;)
tire = s3d.at(front_caster_tire(), y=-5.5, z=-49)
part = s3d.group(&class="tok-comment">#39;front_caster_fork39;, solid, tire)
s3d.joint(tire_joint, tire, on=s3d.local(solid, x=0, y=-5.5, z=12), kind=&class="tok-comment">#39;revoluteclass="tok-string">39;, axis=39;+X39;, range=(-3.1, 3.1))
return part
def front_caster_tire(w=38, d=121, hub_d=55):
tire = s3d.at(s3d.cylinder(&class="tok-comment">#39;rubber_tire39;, d=d, h=w), ry=90, x=-w/2, z=d/2)
s3d.material(tire, kind=&class="tok-comment">#39;rubberclass="tok-string">39;, color=39;#35383a39;)
hub = s3d.at(s3d.cylinder(&class="tok-comment">#39;wheel_hub39;, d=hub_d, h=w+2), ry=90, x=-w/2-1, z=d/2)
s3d.material(hub, kind=&class="tok-comment">#39;steelclass="tok-string">39;, color=39;#a6a8aa39;)
return s3d.group(&class="tok-comment">#39;front_caster_tire39;, tire, hub)
def rear_caster_fork(w=56, d=108, h=140, t=6, boss_d=38, boss_h=40, tire_joint=&class="tok-comment">#39;joint_sm_back_left_tire_a01_joint_0039;):
cheeks = s3d.at(s3d.box(&class="tok-comment">#39;fork_cheek39;, w=t, d=d, h=h-boss_h), on=s3d.grid(nx=2, px=w-t))
crown = s3d.at(s3d.box(&class="tok-comment">#39;fork_crown39;, w=w, d=d, h=t), z=h-boss_h-t)
boss = s3d.at(s3d.cylinder(&class="tok-comment">#39;swivel39;, d=boss_d, h=boss_h), y=d/4, z=h-boss_h)
solid = s3d.group(&class="tok-comment">#39;fork_metal39;, cheeks, crown, boss)
s3d.material(solid, kind=&class="tok-comment">#39;steelclass="tok-string">39;, color=39;#999da039;)
tire = s3d.at(rear_caster_tire(), y=-5, z=-49)
part = s3d.group(&class="tok-comment">#39;rear_caster_fork39;, solid, tire)
s3d.joint(tire_joint, tire, on=s3d.local(solid, x=0, y=-5, z=12), kind=&class="tok-comment">#39;revoluteclass="tok-string">39;, axis=39;+X39;, range=(-3.1, 3.1))
return part
def rear_caster_tire(w=38, d=121, hub_d=55):
tire = s3d.at(s3d.cylinder(&class="tok-comment">#39;rubber_tire39;, d=d, h=w), ry=90, x=-w/2, z=d/2)
s3d.material(tire, kind=&class="tok-comment">#39;rubberclass="tok-string">39;, color=39;#35383a39;)
hub = s3d.at(s3d.cylinder(&class="tok-comment">#39;wheel_hub39;, d=hub_d, h=w+2), ry=90, x=-w/2-1, z=d/2)
s3d.material(hub, kind=&class="tok-comment">#39;steelclass="tok-string">39;, color=39;#a6a8aa39;)
return s3d.group(&class="tok-comment">#39;rear_caster_tire39;, tire, hub)