import sand3d as s3d
def tensioner():
root = s3d.at(housing(), x=-30.5, y=-32.5)
return s3d.assembly(&class="tok-comment">#39;tensioner39;, root)
def housing(w=28, d=191, h=28, base=5, pitch=34.5, scallop=10, shoulder_w=12, shoulder_d=76, shoulder_h=31, collar_w=16, collar_d=31, collar_h=38, tunnel_w=20, tunnel_h=19, tunnel_d=187):
ob = s3d.at(s3d.box(&class="tok-comment">#39;case39;, w=w, d=d, h=h), x=0.5, z=base)
s3d.chamfer(ob, d=1, edges=&class="tok-comment">#39;all39;)
lobe = s3d.loft(&class="tok-comment">#39;scallop39;, s3d.station(z=base+2, w=scallop, d=20, n=2), s3d.station(z=base+5, w=scallop+2, d=22, n=2), s3d.station(z=base+h-5, w=scallop+2, d=22, n=2), s3d.station(z=base+h-2, w=scallop, d=20, n=2))
lobes = s3d.at(lobe, on=s3d.grid(nx=1, ny=4, py=pitch), x=-13, y=11.5)
s3d.join(ob, lobes)
shoulder = s3d.at(s3d.box(&class="tok-comment">#39;raised_spine39;, w=shoulder_w, d=shoulder_d, h=shoulder_h), x=10.5, y=11.5, z=(collar_h-shoulder_h)/2)
s3d.chamfer(shoulder, d=1, edges=&class="tok-comment">#39;all39;)
collar = s3d.at(s3d.box(&class="tok-comment">#39;end_shoulder39;, w=collar_w, d=collar_d, h=collar_h), x=11.5, y=79.5)
s3d.chamfer(collar, d=3, edges=&class="tok-comment">#39;all39;)
s3d.join(ob, shoulder, collar)
tunnel = s3d.at(s3d.box(&class="tok-comment">#39;slider_cavity39;, w=tunnel_w, d=tunnel_d+1, h=tunnel_h), x=0.5, y=(d-tunnel_d)/2, z=(collar_h-tunnel_h)/2)
s3d.cut(ob, tunnel)
s3d.hole(ob, d=scallop, on=s3d.local(ob, x=-w, y=-80.5, z=collar_h/2, ry=-90))
for along_y in (-22.5,46.5):
s3d.hole(ob, d=8, depth=w/2, on=s3d.local(ob, x=-20, y=along_y, z=19, ry=-90))
s3d.material(ob, kind=&class="tok-comment">#39;painted_metalclass="tok-string">39;, color=39;#51565b39;)
button = s3d.at(locking_button(), x=-13.5, y=12, z=15)
shaft = s3d.at(extender(), x=0.5, y=63.5, z=10)
pin = s3d.at(crossbar(), x=-0.5, y=-80.5, z=14)
root = s3d.group(&class="tok-comment">#39;housing_group39;, ob, button, shaft, pin)
s3d.joint(&class="tok-comment">#39;joint_lock_01_joint_00class="tok-string">39;, button, s3d.local(root, x=-16.5, y=11.5, z=19), kind=39;prismaticclass="tok-string">39;, axis=39;-X39;, range=(-8,0))
s3d.joint(&class="tok-comment">#39;joint_extender_01_joint_00class="tok-string">39;, shaft, s3d.local(root, x=0.5, y=63.5, z=19), kind=39;prismaticclass="tok-string">39;, axis=39;+Y39;, range=(0,68.6))
s3d.joint(&class="tok-comment">#39;joint_pin_01_joint_00class="tok-string">39;, pin, s3d.local(root, x=-0.5, y=-80.5, z=19), kind=39;continuousclass="tok-string">39;, axis=39;-X39;)
return root
def locking_button(w=8, d=9, h=9):
ob = s3d.at(s3d.cylinder(&class="tok-comment">#39;button39;, d=d, h=w), x=-w/2, z=h/2, ry=90)
s3d.chamfer(ob, d=0.7)
s3d.material(ob, kind=&class="tok-comment">#39;painted_metalclass="tok-string">39;, color=39;#922f3239;)
return s3d.group(&class="tok-comment">#39;locking_button_group39;, ob)
def extender(w=20, d=232, h=19, shaft_w=14, shaft_h=14, rear_d=148):
ob = s3d.at(s3d.box(&class="tok-comment">#39;inner_slider39;, w=w, d=rear_d, h=h), y=(rear_d-d)/2)
neck = s3d.at(s3d.box(&class="tok-comment">#39;shaft39;, w=shaft_w, d=d-rear_d+2, h=shaft_h), y=rear_d/2, z=(h-shaft_h)/2)
s3d.chamfer(neck, d=0.6)
s3d.join(ob, neck)
s3d.material(ob, kind=&class="tok-comment">#39;brushed_steelclass="tok-string">39;, color=39;#8b909439;)
jaw = s3d.at(pivot_claw(), x=-6, y=116, z=2)
hook = s3d.at(swinging_claw(), x=-3.5, y=122.5, z=3)
root = s3d.group(&class="tok-comment">#39;extender_group39;, ob, jaw, hook)
s3d.joint(&class="tok-comment">#39;joint_claw_01_joint_00class="tok-string">39;, jaw, s3d.local(root, x=0, y=109, z=9), kind=39;continuousclass="tok-string">39;, axis=39;-X39;)
s3d.joint(&class="tok-comment">#39;joint_claw_02_joint_00class="tok-string">39;, hook, s3d.local(root, x=-21, y=111, z=9), kind=39;revoluteclass="tok-string">39;, axis=39;+Z39;, range=(0,80))
return root
def pivot_claw(w=42, d=24, h=14, outer=17, inner=7, cx=4, cy=-7, lug=6):
profile = s3d.poly([(-1,-12),(-15,-12),s3d.arc(center=(-15,-6), r=lug, start=270, end=90),(-9,2),s3d.arc(center=(cx,cy), r=outer, start=145, end=0),(w/2,-12),(13,-12),(13,cy),s3d.arc(center=(6,cy), r=inner, start=0, end=180)])
ob = s3d.extrude(&class="tok-comment">#39;pivot_jaw39;, profile, h=h-3)
s3d.chamfer(ob, d=0.7)
pin = s3d.at(s3d.cylinder(&class="tok-comment">#39;jaw_pivot39;, d=9, h=h), x=-15, y=-6)
s3d.join(ob, pin)
axle = s3d.at(s3d.cylinder(&class="tok-comment">#39;jaw_axle39;, d=4, h=14), x=-1, y=-8, z=h/2, ry=90)
s3d.join(ob, axle)
s3d.material(ob, kind=&class="tok-comment">#39;steelclass="tok-string">39;, color=39;#777e8439;)
return s3d.group(&class="tok-comment">#39;pivot_claw_group39;, ob)
def swinging_claw(w=43, d=33, h=13, r=21.5, inner=14, tongue_h=4, tongue_w=12):
profile = s3d.poly([s3d.arc(center=(0,-5), r=r, start=0, end=180),(-w/2,-12),s3d.arc(center=(-17,-12), r=4.5, start=180, end=360),(-12.5,-6.5),s3d.arc(center=(1.5,-6.5), r=inner, start=180, end=0),(w/2,-5)])
ob = s3d.extrude(&class="tok-comment">#39;swing_jaw39;, profile, h=h)
s3d.chamfer(ob, d=0.7)
top = s3d.at(s3d.box(&class="tok-comment">#39;tongue_top39;, w=tongue_w, d=d, h=h), x=-w/2+2, y=-d/2, z=(h+tongue_h)/2)
bottom = s3d.at(s3d.box(&class="tok-comment">#39;tongue_bottom39;, w=tongue_w, d=d, h=h), x=-w/2+2, y=-d/2, z=-(h+tongue_h)/2)
s3d.cut(ob, top, bottom)
s3d.hole(ob, d=5, on=(-17.5,-11.5))
s3d.material(ob, kind=&class="tok-comment">#39;steelclass="tok-string">39;, color=39;#777e8439;)
return s3d.group(&class="tok-comment">#39;swinging_claw_group39;, ob)
def crossbar(w=144, d=10, h=10, tip=10):
ob = s3d.at(s3d.cylinder(&class="tok-comment">#39;bar39;, d=d, h=w-2*tip), x=-w/2+tip, z=h/2, ry=90)
end = s3d.at(s3d.box(&class="tok-comment">#39;flat_tip39;, w=tip+1, d=d, h=h/2), x=(w-tip)/2, z=h/4)
image = s3d.transform(s3d.copy(end), mirror=&class="tok-comment">#39;x39;)
s3d.join(ob, end, image)
s3d.material(ob, kind=&class="tok-comment">#39;brushed_steelclass="tok-string">39;, color=39;#8a8e9139;)
return s3d.group(&class="tok-comment">#39;crossbar_group39;, ob)