import sand3d as s3d
def lancet():
class="tok-comment"># Measured world placements of the housing origin, trigger, and rear collar.
root = s3d.at(main_body(), x=-0.81, y=-22.4)
button = s3d.at(trigger_button(), x=-0.5, y=-17.5, z=15)
collar = s3d.at(rear_collar(), x=-0.81, y=44)
s3d.joint(&class="tok-comment">#39;joint_button_01_joint_00class="tok-string">39;, button, on=s3d.local(root, x=0, y=4.4, z=16), kind=39;prismaticclass="tok-string">39;, axis=39;+Z39;, range=(0, 0.000001))
s3d.joint(&class="tok-comment">#39;joint_backPart_01_joint_00class="tok-string">39;, collar, on=s3d.local(root, x=0, y=70.4, z=9), kind=39;revoluteclass="tok-string">39;, axis=39;-Y39;, range=(0, 144))
return s3d.assembly(&class="tok-comment">#39;lancet39;, root, button, collar)
def main_body(center_h=8.78, shift=22.4, tongue_w=4.8, tongue_t=2, pad_d=10.2, pad_y=-76.7, tongue_l=23.5, wall=1, button_d=7, floor_y=-37, neck_d=15.6, neck_l=2.5, seat_z=14):
sections = [s3d.station(z=z, w=d, d=d) for z, d in [(-53, 10.5), (-52, 13.4), (-50, 15.3), (-45, 17.2), (-37, 17.45), (-25, 16.6), (-10, 16), (10, 16), (26, 17), (35, 17.5)]]
body = s3d.shell(s3d.loft(&class="tok-comment">#39;housingclass="tok-string">39;, *sections), t=wall, open=39;end39;)
floor = s3d.at(s3d.cylinder(&class="tok-comment">#39;front_floor39;, d=16, h=wall), z=floor_y)
neck = s3d.at(s3d.tube(&class="tok-comment">#39;rear_neck39;, d=neck_d, d_in=neck_d-2*wall, h=neck_l), z=37-neck_l)
body = s3d.join(body, floor, neck)
s3d.pocket(body, s3d.circle(d=button_d), depth=wall, on=body.face(&class="tok-comment">#39;start39;))
s3d.hole(body, d=button_d, depth=3, on=s3d.local(body, y=-8, z=-17.5, rx=90))
body = s3d.at(body, rx=-90, y=shift, z=center_h)
seat = s3d.at(s3d.cylinder(&class="tok-comment">#39;trigger_seat39;, d=button_d+2*wall, h=wall), y=shift-17.5, z=seat_z)
body = s3d.join(body, seat)
tongue = s3d.at(s3d.box(&class="tok-comment">#39;tongue39;, w=tongue_w, d=tongue_l, h=tongue_t), y=shift-64, z=center_h-tongue_t)
pad = s3d.at(s3d.cylinder(&class="tok-comment">#39;pad39;, d=pad_d, h=tongue_t), y=pad_y+shift, z=center_h-tongue_t)
tongue = s3d.join(tongue, pad)
s3d.pocket(tongue, s3d.circle(d=pad_d-2), depth=tongue_t/4, on=s3d.local(tongue, y=pad_y+64, z=tongue_t))
s3d.pocket(tongue, s3d.circle(d=pad_d-2), depth=tongue_t/4, on=s3d.local(tongue, y=pad_y+64, rx=180))
s3d.pocket(tongue, s3d.rect(w=tongue_w-2, d=tongue_l-5), depth=tongue_t/4, on=s3d.local(tongue, z=tongue_t))
s3d.material(body, &class="tok-comment">#39;plasticclass="tok-string">39;, color=39;#dedee239;)
s3d.material(tongue, &class="tok-comment">#39;steelclass="tok-string">39;, color=39;#b4b6ba39;)
return s3d.group(&class="tok-comment">#39;main_body39;, body, tongue)
def trigger_button(d=7, h=2):
button = s3d.cylinder(&class="tok-comment">#39;trigger39;, d=d, h=h)
s3d.material(button, &class="tok-comment">#39;plasticclass="tok-string">39;, color=39;#8caac039;)
return s3d.group(&class="tok-comment">#39;trigger_button39;, button)
def rear_collar(center_h=8.78, wall=1, bore=10):
sections = [s3d.station(z=z, w=d, d=d) for z, d in [(-9, 17.5), (-3, 17.2), (3, 16.3), (7, 14.8), (9, 13.8)]]
solid = s3d.loft(&class="tok-comment">#39;collar39;, *sections)
solid = s3d.shell(solid, t=wall, open=&class="tok-comment">#39;start39;)
s3d.hole(solid, d=bore, on=solid.face(&class="tok-comment">#39;end39;))
solid = s3d.at(solid, rx=-90, z=center_h)
s3d.material(solid, &class="tok-comment">#39;plasticclass="tok-string">39;, color=39;#c8cbd039;)
plunger = s3d.at(end_plunger(), x=-0.19, y=11.5, z=center_h-bore/2)
parent = s3d.group(&class="tok-comment">#39;rear_collar39;, solid, plunger)
s3d.joint(&class="tok-comment">#39;joint_button_02_joint_00class="tok-string">39;, plunger, on=s3d.local(parent, x=-0.19, y=21, z=9), kind=39;prismaticclass="tok-string">39;, axis=39;-Y39;, range=(0, 9.7))
return parent
def end_plunger(d=10, length=19):
solid = s3d.at(s3d.cylinder(&class="tok-comment">#39;plunger39;, d=d, h=length), rx=-90, y=-length/2, z=d/2)
s3d.material(solid, &class="tok-comment">#39;plasticclass="tok-string">39;, color=39;#aeb4bc39;)
return s3d.group(&class="tok-comment">#39;end_plunger39;, solid)