import sand3d as s3d
def scaffold():
frame = s3d.at(scaffold_frame(), z=153)
parts = [frame]
for side, x in [(&class="tok-comment">#39;rightclass="tok-string">39;, 357), (39;left39;, -357)]:
for end, y in [(&class="tok-comment">#39;backclass="tok-string">39;, 912), (39;front39;, -912)]:
prefix = end + &class="tok-comment">#39;_class="tok-string">39; + side + 39;_center39;
part = deck_end_caster(prefix=prefix) if end == &class="tok-comment">#39;back39; else entry_end_caster(prefix=prefix)
caster = s3d.at(part, x=x, y=y-26, z=48)
s3d.joint(&class="tok-comment">#39;joint_sm_class="tok-string">39; + prefix + 39;_wheel_a03_joint_00class="tok-string">39;, caster, s3d.local(frame, x=x, y=y, z=0), axis=39;+Z39;, range=(-3.1, 3.1))
parts.append(caster)
for side, x in [(&class="tok-comment">#39;rightclass="tok-string">39;, 827), (39;left39;, -827)]:
for end, y in [(&class="tok-comment">#39;backclass="tok-string">39;, 922), (39;front39;, -922)]:
prefix = end + &class="tok-comment">#39;_39; + side
part = detached_caster(prefix=prefix) if end == &class="tok-comment">#39;back39; else detached_entry_caster(prefix=prefix)
caster = s3d.at(part, x=x, y=y-26, z=48)
s3d.joint(&class="tok-comment">#39;joint_sm_class="tok-string">39; + prefix + 39;_wheel_a03_joint_00class="tok-string">39;, caster, s3d.local(frame, x=x, y=y, z=0), axis=39;+Z39;, range=(-3.1, 3.1))
parts.append(caster)
return s3d.assembly(&class="tok-comment">#39;scaffold39;, *parts)
def scaffold_frame(post_w=46, post_d=60, post_h=3371, px=357, py=910, rung_d=28, deck_w=759, deck_d=1697, sheet=9, lower=1637, upper=2128, upper_x=-46, upper_y=65, rail_x=365.5, rail_y=845, rail_d=24, rail_h=3117, rail_mid=2653, border=170, beam=90, sleeve=467, sleeve_w=60, outboard_x=827, outboard_y=922, stem_h=161, rung_levels=(297,613,957,1287,1617,1937,2259,2588,2916,3245)):
solids=[]
for x in [-px, px]:
for y in [-py, py]:
solids.append(s3d.at(s3d.box(&class="tok-comment">#39;upright39;, w=post_w, d=post_d, h=post_h), x=x, y=y))
solids.append(s3d.at(s3d.box(&class="tok-comment">#39;leg_sleeve39;, w=sleeve_w, d=sleeve_w, h=sleeve), x=x, y=y, z=post_d))
for x in [-outboard_x,outboard_x]:
for y in [-outboard_y,outboard_y]:
solids.append(s3d.at(s3d.cylinder(&class="tok-comment">#39;detached_stem39;,d=post_w,h=stem_h),x=x,y=y))
for y in [-py, py]:
for z in rung_levels:
solids.append(s3d.wire(&class="tok-comment">#39;ladder_rung39;, path=[(-px,y,z),(px,y,z)], d=rung_d))
for z, dx, dy in [(lower,0,0),(upper,upper_x,upper_y)]:
solids.append(s3d.at(s3d.box(&class="tok-comment">#39;deck39;, w=deck_w, d=deck_d, h=sheet), x=dx, y=dy, z=z))
for x in [-deck_w/2, deck_w/2]:
solids.append(s3d.at(s3d.box(&class="tok-comment">#39;deck_channel39;, w=sheet/2, d=deck_d, h=beam), x=x+dx, y=dy, z=z-beam))
solids.append(s3d.at(s3d.box(&class="tok-comment">#39;channel_flange39;, w=post_w, d=deck_d, h=sheet/2), x=x+dx-post_w/2*(1 if x>0 else -1), y=dy, z=z-beam))
if z==upper:
solids.append(s3d.at(s3d.box(&class="tok-comment">#39;toe_board39;, w=sheet/2, d=deck_d, h=border), x=x+dx, y=dy, z=z))
for y in [-deck_d/2, deck_d/2]:
solids.append(s3d.at(s3d.box(&class="tok-comment">#39;end_border39;, w=deck_w, d=sheet, h=beam), x=dx, y=y+dy, z=z-beam/2))
for x in [upper_x-rail_x, upper_x+rail_x]:
solids.append(s3d.wire(&class="tok-comment">#39;bent_guard39;, path=[(x,upper_y-rail_y,upper),(x,upper_y-rail_y,rail_h),(x,upper_y+rail_y,rail_h),(x,upper_y+rail_y,upper)], d=rail_d, fillet=post_d))
solids.append(s3d.wire(&class="tok-comment">#39;middle_guard39;, path=[(x,upper_y-rail_y,rail_mid),(x,upper_y+rail_y,rail_mid)], d=rail_d))
for y in [upper_y-rail_y, upper_y+rail_y]:
for z in [rail_mid,rail_h]:
solids.append(s3d.wire(&class="tok-comment">#39;end_guard39;, path=[(upper_x-rail_x,y,z),(upper_x+rail_x,y,z)], d=rail_d))
for x in [-px,px]:
for y in [-py,py]:
solids.append(s3d.wire(&class="tok-comment">#39;deck_brace39;, path=[(x,y,lower-beam*4),(x,y*(1-beam*3/py),lower-beam)], d=sheet))
group=s3d.group(&class="tok-comment">#39;scaffold_frame39;, *solids)
s3d.material(group, kind=&class="tok-comment">#39;aluminiumclass="tok-string">39;, color=39;#a7aaab39;)
return group
def deck_end_caster(w=57, d=108, h=105, t=6, prefix=&class="tok-comment">#39;back_right_center39;):
solid = s3d.group(&class="tok-comment">#39;support39;, caster_fork(w=w,d=d,h=h,t=t))
tire=s3d.at(deck_end_tire(), y=-5, z=-48)
s3d.joint(&class="tok-comment">#39;joint_sm_class="tok-string">39;+prefix+39;_tire_a03_joint_00class="tok-string">39;, tire, s3d.local(solid, x=0, y=-5, z=13), axis=39;+X39;, range=(-3.1,3.1))
return s3d.group(&class="tok-comment">#39;deck_end_caster39;, solid, tire)
def caster_fork(w,d,h,t):
cap=s3d.at(s3d.cylinder(&class="tok-comment">#39;swivel39;, d=w, h=t*2), y=d/4, z=h-t*2)
cheeks=s3d.at(s3d.box(&class="tok-comment">#39;fork39;, w=t, d=d, h=h-t), on=s3d.grid(nx=2, px=w-t))
solid=s3d.join(cap, cheeks)
s3d.material(solid, kind=&class="tok-comment">#39;steelclass="tok-string">39;, color=39;#969b9f39;)
return solid
def deck_end_tire(w=38, d=121):
tire=s3d.at(s3d.cylinder(&class="tok-comment">#39;tire39;, d=d, h=w), x=-w/2, z=d/2, ry=90)
s3d.material(tire, kind=&class="tok-comment">#39;rubberclass="tok-string">39;, color=39;#43474739;)
return s3d.group(&class="tok-comment">#39;deck_end_tire39;, tire)
def entry_end_caster(w=56,d=108,h=105,t=6,prefix=&class="tok-comment">#39;front_right_center39;):
solid=s3d.group(&class="tok-comment">#39;support39;,caster_fork(w=w,d=d,h=h,t=t))
tire=s3d.at(entry_end_tire(),y=-5,z=-48)
s3d.joint(&class="tok-comment">#39;joint_sm_class="tok-string">39;+prefix+39;_tire_a03_joint_00class="tok-string">39;,tire,s3d.local(solid,x=0,y=-5,z=13),axis=39;+X39;,range=(-3.1,3.1))
return s3d.group(&class="tok-comment">#39;entry_end_caster39;,solid,tire)
def entry_end_tire(w=38,d=123):
tire=s3d.at(s3d.cylinder(&class="tok-comment">#39;tire39;,d=d,h=w),x=-w/2,z=d/2,ry=90)
s3d.material(tire,kind=&class="tok-comment">#39;rubberclass="tok-string">39;,color=39;#43474739;)
return s3d.group(&class="tok-comment">#39;entry_end_tire39;,tire)
def detached_caster(w=57,d=108,h=105,t=6,prefix=&class="tok-comment">#39;back_right39;):
solid=s3d.group(&class="tok-comment">#39;support39;,caster_fork(w=w,d=d,h=h,t=t))
tire=s3d.at(detached_tire(),y=-5,z=-48)
s3d.joint(&class="tok-comment">#39;joint_sm_class="tok-string">39;+prefix+39;_tire_a03_joint_00class="tok-string">39;,tire,s3d.local(solid,x=0,y=-5,z=13),axis=39;+X39;,range=(-3.1,3.1))
return s3d.group(&class="tok-comment">#39;detached_caster39;,solid,tire)
def detached_tire(w=38,d=121):
tire=s3d.at(s3d.cylinder(&class="tok-comment">#39;tire39;,d=d,h=w),x=-w/2,z=d/2,ry=90)
s3d.material(tire,kind=&class="tok-comment">#39;rubberclass="tok-string">39;,color=39;#43474739;)
return s3d.group(&class="tok-comment">#39;detached_tire39;,tire)
def detached_entry_caster(w=56,d=109,h=105,t=6,prefix=&class="tok-comment">#39;front_right39;):
solid=s3d.group(&class="tok-comment">#39;support39;,caster_fork(w=w,d=d,h=h,t=t))
tire=s3d.at(detached_entry_tire(),y=-5,z=-48)
s3d.joint(&class="tok-comment">#39;joint_sm_class="tok-string">39;+prefix+39;_tire_a03_joint_00class="tok-string">39;,tire,s3d.local(solid,x=0,y=-5,z=13),axis=39;+X39;,range=(-3.1,3.1))
return s3d.group(&class="tok-comment">#39;detached_entry_caster39;,solid,tire)
def detached_entry_tire(w=38,d=124):
tire=s3d.at(s3d.cylinder(&class="tok-comment">#39;tire39;,d=d,h=w),x=-w/2,z=d/2,ry=90)
s3d.material(tire,kind=&class="tok-comment">#39;rubberclass="tok-string">39;,color=39;#43474739;)
return s3d.group(&class="tok-comment">#39;detached_entry_tire39;,tire)