import sand3d as s3d
def folding_ladder():
base = s3d.at(primary_frame(), y=-106)
fork = s3d.at(caster_fork(), x=242.5, y=-298, z=24)
twin = s3d.at(caster_fork(wheel_joint=&class="tok-comment">#39;joint_sm_wheel3_a01_joint_0039;), x=-242.5, y=-298, z=24)
other = s3d.at(folding_frame(), y=184)
links = s3d.at(hinged_links(), z=623)
s3d.joint(&class="tok-comment">#39;joint_sm_wheeljoint4_a01_joint_00class="tok-string">39;, fork, on=s3d.local(base, x=242, y=-192, z=105), axis=39;+Z39;, range=(-3.1,3.1))
s3d.joint(&class="tok-comment">#39;joint_sm_wheeljoint3_a01_joint_00class="tok-string">39;, twin, on=s3d.local(base, x=-243, y=-192, z=105), axis=39;+Z39;, range=(-3.1,3.1))
s3d.joint(&class="tok-comment">#39;joint_sm_rightladder_a01_joint_00class="tok-string">39;, other, on=s3d.local(base, x=0, y=106, z=762), axis=39;+X39;, range=(0,0.00001))
s3d.joint(&class="tok-comment">#39;joint_sm_lholders_a01_joint_00class="tok-string">39;, links, on=s3d.local(base, x=0, y=7, z=636), axis=39;+X39;, range=(-1.9,0))
return s3d.assembly(&class="tok-comment">#39;folding_ladder39;, base, fork, twin, other, links)
def primary_frame(shift=106):
solid = frame_shape(shift=shift, direction=-1)
brace = s3d.at(s3d.box(&class="tok-comment">#39;spreader39;, w=3, d=370, h=25), x=178, y=shift, z=377)
image = s3d.transform(s3d.copy(brace), mirror=&class="tok-comment">#39;x39;)
s3d.material(brace, &class="tok-comment">#39;aluminium39;)
s3d.material(image, &class="tok-comment">#39;aluminium39;)
return s3d.group(&class="tok-comment">#39;primary_frame39;, solid, brace, image)
def frame_shape(shift=106, direction=-1, rail_x=196, rail_w=30, rail_d=96, bottom=15, top=760, foot_y=340, crown_y=55, step_w=426, step_d=94, step_h=35, wall=3, rib_d=34):
levels = [(256,234),(496,143),(719,51)]
rail = s3d.loft(&class="tok-comment">#39;rail39;, s3d.station(z=bottom, w=rail_w, d=rail_d, x=rail_x, y=shift+direction*foot_y, n=8), s3d.station(z=top, w=rail_w, d=rail_d, x=rail_x, y=shift+direction*crown_y, n=8))
for z,y in levels:
s3d.hole(rail,d=rib_d-wall,on=s3d.local(rail,x=rail_x-rail_w,y=shift+direction*(y+bottom),z=z+rib_d/2,ry=90))
twin = s3d.transform(s3d.copy(rail), mirror=&class="tok-comment">#39;x39;)
parts = [rail, twin]
for z,y in levels:
tread = s3d.box(&class="tok-comment">#39;step39;, w=step_w, d=step_d, h=wall*3)
tread = s3d.shell(tread, t=wall, open=&class="tok-comment">#39;bottom39;)
parts.append(s3d.at(tread, y=shift+direction*y, z=z+step_h-wall*3))
rib = s3d.tube(&class="tok-comment">#39;step_rib39;,d=rib_d,d_in=rib_d-wall,h=step_w)
parts.append(s3d.at(rib,ry=90,x=-step_w/2,y=shift+direction*(y+bottom),z=z+rib_d/2))
foot = s3d.at(s3d.extrude(&class="tok-comment">#39;foot39;, s3d.rect(w=42,d=94,r=12), h=28), x=rail_x, y=shift+direction*(foot_y-12))
parts.extend([foot,s3d.transform(s3d.copy(foot), mirror=&class="tok-comment">#39;x39;)])
cap = s3d.at(s3d.box(&class="tok-comment">#39;end_bar39;, w=46,d=104,h=14), x=rail_x, y=shift+direction*crown_y, z=top-2)
parts.extend([cap,s3d.transform(s3d.copy(cap), mirror=&class="tok-comment">#39;x39;)])
for z,y in levels[:-1]:
support = s3d.wire(&class="tok-comment">#39;diagonal39;,path=[(rail_x,shift+direction*(y+rail_d/2),z-step_d),(rail_x-step_d,shift+direction*(y+bottom),z)],d=wall*2)
parts.extend([support,s3d.transform(s3d.copy(support),mirror=&class="tok-comment">#39;x39;)])
result = s3d.group(&class="tok-comment">#39;frame39;, parts)
s3d.material(result,&class="tok-comment">#39;aluminium39;)
return result
def caster_fork(w=47,d=26,h=80,wheel_joint=&class="tok-comment">#39;joint_sm_wheel4_a01_joint_0039;):
solid = fork_shape(w=w,d=d,h=h)
wheel = s3d.at(caster_wheel(), x=0.5, z=-24)
s3d.joint(wheel_joint, wheel, on=s3d.local(solid,x=0,y=0,z=15), axis=&class="tok-comment">#39;+X39;, range=(-62831.9,62831.9))
return s3d.group(&class="tok-comment">#39;caster_fork39;, solid, wheel)
def fork_shape(w=47,d=26,h=80,t=5,stem_d=20,stem_h=25):
cheek = s3d.at(s3d.box(&class="tok-comment">#39;fork_cheek39;, w=t,d=d,h=h-stem_h), x=(w-t)/2)
twin = s3d.transform(s3d.copy(cheek), mirror=&class="tok-comment">#39;x39;)
cap = s3d.at(s3d.box(&class="tok-comment">#39;fork_cap39;,w=w,d=d,h=t), z=h-stem_h-t)
stem = s3d.at(s3d.cylinder(&class="tok-comment">#39;swivel39;,d=stem_d,h=stem_h+t),z=h-stem_h-t)
solid = s3d.join(cheek,twin,cap,stem)
s3d.material(solid,&class="tok-comment">#39;steel39;)
return solid
def caster_wheel(w=34,d=77):
solid = wheel_shape(w=w,d=d)
return s3d.group(&class="tok-comment">#39;caster_wheel39;,solid)
def wheel_shape(w=34,d=77,r=5):
tyre = s3d.cylinder(&class="tok-comment">#39;tyre39;, d=d,h=w)
s3d.fillet(tyre,r=r)
s3d.material(tyre,&class="tok-comment">#39;rubberclass="tok-string">39;,color=39;#363a3c39;)
tyre = s3d.at(tyre, ry=90,x=-w/2,z=d/2)
hub = s3d.at(s3d.cylinder(&class="tok-comment">#39;hub39;,d=d*0.58,h=w+2), ry=90,x=-w/2-1,z=d/2)
s3d.material(hub,&class="tok-comment">#39;aluminium39;)
return s3d.group(&class="tok-comment">#39;wheel39;,tyre,hub)
def folding_frame(shift=-184):
solid = frame_shape(shift=shift,direction=1)
fork = s3d.at(folding_caster_fork(), x=242,y=114,z=23)
twin = s3d.at(folding_caster_fork(wheel_joint=&class="tok-comment">#39;joint_sm_wheel1_a01_joint_0039;), x=-242,y=114,z=23)
s3d.joint(&class="tok-comment">#39;joint_sm_wheeljoint2_a01_joint_00class="tok-string">39;,fork,on=s3d.local(solid,x=243,y=114,z=104),axis=39;+Z39;,range=(-3.1,3.1))
s3d.joint(&class="tok-comment">#39;joint_sm_wheeljoint1_a01_joint_00class="tok-string">39;,twin,on=s3d.local(solid,x=-243,y=114,z=105),axis=39;+Z39;,range=(-3.1,3.1))
return s3d.group(&class="tok-comment">#39;folding_frame39;,solid,fork,twin)
def folding_caster_fork(w=48,d=26,h=81,wheel_joint=&class="tok-comment">#39;joint_sm_wheel2_a01_joint_0039;):
solid = fork_shape(w=w,d=d,h=h)
wheel = s3d.at(folding_caster_wheel(),x=0.5,z=-23)
s3d.joint(wheel_joint,wheel,on=s3d.local(solid,x=0,y=0,z=15),axis=&class="tok-comment">#39;+X39;,range=(-62831.9,62831.9))
return s3d.group(&class="tok-comment">#39;folding_caster_fork39;,solid,wheel)
def folding_caster_wheel(w=33,d=76):
solid = wheel_shape(w=w,d=d)
return s3d.group(&class="tok-comment">#39;folding_caster_wheel39;,solid)
def hinged_links(w=430,d=224,h=26,t=4):
link = s3d.at(s3d.box(&class="tok-comment">#39;link39;,w=t,d=d,h=h),x=(w-t)/2)
twin = s3d.transform(s3d.copy(link),mirror=&class="tok-comment">#39;x39;)
s3d.material(link,&class="tok-comment">#39;steel39;)
s3d.material(twin,&class="tok-comment">#39;steel39;)
return s3d.group(&class="tok-comment">#39;hinged_links39;,link,twin)