import sand3d as s3d
def extension_ladder():
base = s3d.at(main_ladder(), y=0.5, z=-3)
slide = s3d.at(sliding_ladder(), y=-52, z=294)
s3d.joint(&class="tok-comment">#39;joint_sm_sideladder_a01_joint_00class="tok-string">39;, slide, s3d.local(base, x=0, y=-52, z=296), kind=39;prismaticclass="tok-string">39;, axis=39;+Z39;, range=(0,2678))
hook = s3d.at(rope_hook(), x=3, y=3, z=2810)
s3d.joint(&class="tok-comment">#39;joint_sm_hook_a01_joint_00class="tok-string">39;, hook, s3d.local(base, x=3, y=3, z=2835), axis=39;+Y39;, range=(-90,90))
return s3d.assembly(&class="tok-comment">#39;extension_ladder39;, base, slide, hook)
def main_ladder(h=3312, rail_x=235, rail_w=46, rail_d=55, t=3, rung_w=521, rung_d=33, rung_h=27, foot_w=58, foot_d=183, foot_h=8, collar_h=60):
rail = s3d.extrude(&class="tok-comment">#39;channel39;, s3d.poly([(rail_w/2,-rail_d/2),(rail_w/2,rail_d/2),(-rail_w/2,rail_d/2),(-rail_w/2,rail_d/2-t),(rail_w/2-t,rail_d/2-t),(rail_w/2-t,-rail_d/2+t),(-rail_w/2,-rail_d/2+t),(-rail_w/2,-rail_d/2)]), h=h)
rail = s3d.at(rail, x=rail_x, z=foot_h/2)
twin = s3d.transform(s3d.copy(rail), mirror=&class="tok-comment">#39;x39;)
rungs = []
for level in (198,476,737,1001,1262,1525,1788,2062,2321,2554,2854,3132):
rungs.append(s3d.at(s3d.extrude(&class="tok-comment">#39;rung39;, s3d.rect(w=rung_d,d=rung_h,r=t), h=rung_w), x=-rung_w/2, y=3.5, z=level+3, ry=90))
foot = s3d.at(s3d.box(&class="tok-comment">#39;foot_plate39;,w=foot_w,d=foot_d,h=foot_h), x=rail_x)
feet = s3d.transform(s3d.copy(foot), mirror=&class="tok-comment">#39;x39;)
collar = s3d.at(s3d.box(&class="tok-comment">#39;guide_collar39;,w=t*3,d=110,h=collar_h), x=rail_x+rail_w/2, y=-30, z=3200)
collar_image = s3d.transform(s3d.copy(collar),mirror=&class="tok-comment">#39;x39;)
result = s3d.group(&class="tok-comment">#39;main_ladder39;,rail,twin,rungs,foot,feet,collar,collar_image)
s3d.material(result,&class="tok-comment">#39;aluminiumclass="tok-string">39;,color=39;#a0a3a539;)
return result
def sliding_ladder(h=3375, rail_x=227, rail_w=47, rail_d=67, t=3, rung_w=502, rung_d=33, rung_h=27):
rail = s3d.extrude(&class="tok-comment">#39;sliding_channel39;,s3d.poly([(-rail_w/2,-rail_d/2),(rail_w/2,-rail_d/2),(rail_w/2,-rail_d/2+t),(-rail_w/2+t,-rail_d/2+t),(-rail_w/2+t,rail_d/2-t),(rail_w/2,rail_d/2-t),(rail_w/2,rail_d/2),(-rail_w/2,rail_d/2)]),h=h)
rail = s3d.at(rail,x=rail_x)
twin = s3d.transform(s3d.copy(rail),mirror=&class="tok-comment">#39;x39;)
rungs=[]
for level in (476,738,1000,1261,1523,1785,2048,2321,2553,2852,3131,3395):
rungs.append(s3d.at(s3d.extrude(&class="tok-comment">#39;sliding_rung39;,s3d.rect(w=rung_d,d=rung_h,r=t),h=rung_w),x=-rung_w/2,y=-1,z=level-294,ry=90))
parent=s3d.group(&class="tok-comment">#39;sliding_frame39;,rail,twin,rungs)
s3d.material(parent,&class="tok-comment">#39;aluminiumclass="tok-string">39;,color=39;#9a9d9f39;)
catch=s3d.at(rung_catch(),x=188,y=32,z=609)
s3d.joint(&class="tok-comment">#39;joint_sm_carabine2_a01_joint_00class="tok-string">39;,catch,s3d.local(parent,x=186,y=13,z=833),axis=39;+X39;,range=(-1.6,30))
image=s3d.at(rung_catch(lock_name=&class="tok-comment">#39;joint_sm_lock1_a01_joint_0039;),x=-188,y=32,z=609)
s3d.joint(&class="tok-comment">#39;joint_sm_carabine1_a01_joint_00class="tok-string">39;,image,s3d.local(parent,x=-187,y=13,z=833),axis=39;+X39;,range=(-1.6,30))
return s3d.group(&class="tok-comment">#39;sliding_ladder39;,parent,catch,image)
def rung_catch(w=14,d=114,h=234,wire_d=7,lock_name=&class="tok-comment">#39;joint_sm_lock2_a01_joint_0039;):
solid=s3d.wire(&class="tok-comment">#39;catch39;,path=[(0,-d/6,h-wire_d),(0,-d/2+wire_d,h-wire_d),(0,-d/2+wire_d,h/2),(0,d/2-wire_d,wire_d),(0,d/2-wire_d,h/3),(0,-d/6,h-wire_d)],d=wire_d,fillet=wire_d)
s3d.material(solid,&class="tok-comment">#39;steelclass="tok-string">39;,color=39;#777d8039;)
lock=s3d.at(catch_lock(),x=-1.5,y=-32,z=50)
s3d.joint(lock_name,lock,s3d.local(solid,x=-2,y=-15,z=59),axis=&class="tok-comment">#39;+X39;,range=(-15.9,60))
return s3d.group(&class="tok-comment">#39;rung_catch39;,solid,lock)
def catch_lock(w=7,d=52,h=46):
solid=s3d.wire(&class="tok-comment">#39;lock39;,path=[(0,-d/2,h),(0,d/2,0)],d=w)
s3d.material(solid,&class="tok-comment">#39;steelclass="tok-string">39;,color=39;#777d8039;)
return s3d.group(&class="tok-comment">#39;catch_lock39;,solid)
def rope_hook(w=20,d=14,h=29):
solid=s3d.wire(&class="tok-comment">#39;hook39;,path=[(0,0,h),(w/3,0,h/2),(0,0,d/3),(-w/3,0,h/3)],d=d/3,fillet=d/3)
s3d.material(solid,&class="tok-comment">#39;steelclass="tok-string">39;,color=39;#777d8039;)
rope=s3d.at(hanging_rope(),x=3.5,y=-29.5,z=-2355)
s3d.joint(&class="tok-comment">#39;joint_sm_rope_a01_joint_00class="tok-string">39;,rope,s3d.local(solid,x=0,y=-1,z=5),kind=39;continuousclass="tok-string">39;,axis=39;+Z39;)
return s3d.group(&class="tok-comment">#39;rope_hook39;,solid,rope)
def hanging_rope(h=2360,d=125,cord=5):
solid=s3d.wire(&class="tok-comment">#39;rope39;,path=s3d.spline([(0,0,0),(0,-d/3,150),(0,-d/2+cord,500),(0,-d/2+cord,h-300),(0,-d/3,h-100),(0,d/4,h),(0,d/2-cord,h-80),(0,d/2-cord,150),(0,d/3,60)]),d=cord)
s3d.material(solid,&class="tok-comment">#39;fabricclass="tok-string">39;,color=39;#c1b69a39;)
roller=s3d.at(rope_roller(),x=-3,y=29,z=2316)
s3d.joint(&class="tok-comment">#39;joint_sm_rolling_system_a01_joint_00class="tok-string">39;,roller,s3d.local(solid,x=-3,y=29,z=2330),kind=39;continuousclass="tok-string">39;,axis=39;+X39;)
return s3d.group(&class="tok-comment">#39;hanging_rope39;,solid,roller)
def rope_roller(w=15,d=27,h=28):
solid=s3d.at(s3d.cylinder(&class="tok-comment">#39;pulley39;,d=d,h=w),x=-w/2,z=h/2,ry=90)
s3d.material(solid,&class="tok-comment">#39;steelclass="tok-string">39;,color=39;#73787a39;)
return s3d.group(&class="tok-comment">#39;rope_roller39;,solid)