import sand3d as s3d
def loop_probe():
root = s3d.at(probe_body(), x=0, y=0, z=0)
return s3d.assembly(class="tok-string">"loop_probe", root)
def probe_body(axis_h=31, head_end=-99, waist_start=-45, stem_start=85, stem_end=195, tip=-194, end=252, wire_d=2.8):
shoulder = turned(class="tok-string">"shoulder", [(tip, 1.4), (-142, 5), (-130, 9), (-116, 24), (head_end, 30)], axis_h)
grip = turned(class="tok-string">"grip", [(waist_start, 20), (-13, 15), (13, 16), (39, 16), (65, 11), (stem_start, 5)], axis_h)
stem = s3d.at(s3d.cylinder(class="tok-string">"stem", d=10, h=stem_end-stem_start), x=stem_start, z=axis_h, ry=90)
end_knob = turned(class="tok-string">"end_knob", [(stem_end-1, 5), (207, 12), (221, 17), (239, 17), (end-3, 14)], axis_h)
lip = s3d.at(s3d.tube(class="tok-string">"lip", d=28, d_in=21, h=5), x=end-5, z=axis_h, ry=90)
path = s3d.spline([(tip, 0, axis_h), (-220, -12, 25), (-250, -80, 12), (-220, -150, 4), (-142, -174, 6), (-57, -139, 9)])
wire = s3d.wire(class="tok-string">"loop_wire", path, d=wire_d)
solids = s3d.join(shoulder, wire)
grip = s3d.join(grip, stem, end_knob, lip)
s3d.material(solids, class="tok-string">"steel", color=class="tok-string">"class="tok-comment">#a6a6a3")
s3d.material(grip, class="tok-string">"steel", color=class="tok-string">"class="tok-comment">#a6a6a3")
middle = s3d.at(middle_collar(), x=-69, z=3)
head = s3d.at(head_collar(), x=-89, z=1)
waist = s3d.at(waist_collar(), x=-51.5, z=9)
root = s3d.group(class="tok-string">"probe_body", solids, grip, middle, head, waist)
s3d.joint(class="tok-string">"joint_knob_02_joint_00", middle, s3d.local(root, x=-68, y=0, z=31), kind=class="tok-string">"revolute", axis=class="tok-string">"+X", range=(-179,179))
s3d.joint(class="tok-string">"joint_knob_03_joint_00", head, s3d.local(root, x=-89, y=0, z=31), kind=class="tok-string">"revolute", axis=class="tok-string">"+X", range=(-179,179))
s3d.joint(class="tok-string">"joint_knob_01_joint_00", waist, s3d.local(root, x=-52, y=0, z=31), kind=class="tok-string">"revolute", axis=class="tok-string">"+X", range=(-179,179))
return root
def turned(name, points, height):
path = [(0, points[0][0]), (points[0][1], points[0][0]), s3d.spline([(r,x) for x,r in points]), (0, points[-1][0])]
solid = s3d.revolve(name, s3d.poly(path))
return s3d.at(solid, ry=90, z=height)
def middle_collar(w=20, d=56, end_d=44, t=2):
solid = s3d.shell(s3d.cone(class="tok-string">"middle", d=d, d2=end_d, h=w), t=t, open=class="tok-string">"top bottom")
solid = s3d.at(solid, x=-w/2, z=d/2, ry=90)
s3d.material(solid, class="tok-string">"steel", color=class="tok-string">"class="tok-comment">#90918e")
return s3d.group(class="tok-string">"middle_collar", solid)
def head_collar(w=20, d=60, end_d=56, t=2):
solid = s3d.shell(s3d.cone(class="tok-string">"head", d=d, d2=end_d, h=w), t=t, open=class="tok-string">"top bottom")
solid = s3d.at(solid, x=-w/2, z=d/2, ry=90)
s3d.material(solid, class="tok-string">"steel", color=class="tok-string">"class="tok-comment">#90918e")
return s3d.group(class="tok-string">"head_collar", solid)
def waist_collar(w=13, d=44, end_d=40, t=2):
solid = s3d.shell(s3d.cone(class="tok-string">"waist", d=d, d2=end_d, h=w), t=t, open=class="tok-string">"top bottom")
solid = s3d.at(solid, x=-w/2, z=d/2, ry=90)
s3d.material(solid, class="tok-string">"steel", color=class="tok-string">"class="tok-comment">#90918e")
return s3d.group(class="tok-string">"waist_collar", solid)