import sand3d as s3d
import math
def curved_pruning_shears():
left_handle = left_handle_body()
pivot_carriage = carriage(left_handle, class="tok-string">"pivot_carriage", x=-5.67, y=-12.44, z=53.88, rx=90, ry=-55)
right_handle = handle(pivot_carriage, class="tok-string">"right_handle", z=-24.89)
return s3d.assembly(class="tok-string">"curved_pruning_shears", left_handle, pivot_carriage, right_handle)
def carriage(parent, name, x=0, y=0, z=0, rx=0, ry=0, rz=0):
frame = s3d.local(parent, x, y, z, rx, ry, rz)
pivot_carriage = s3d.at(pivot_carriage_body(fclass="tok-string">"{name}"), on=frame)
s3d.joint(fclass="tok-string">"{name}_slide", pivot_carriage, frame, kind=class="tok-string">"prismatic", range=(-2.5, 2.5))
s3d.joint(fclass="tok-string">"{name}_spin", pivot_carriage, frame, kind=class="tok-string">"continuous")
return pivot_carriage
def handle(parent, name, x=0, y=0, z=0, rx=0, ry=0, rz=0):
frame = s3d.local(parent, x, y, z, rx, ry, rz)
right_handle = s3d.at(right_handle_body(fclass="tok-string">"{name}"), on=frame)
s3d.joint(fclass="tok-string">"{name}_slide", right_handle, frame, kind=class="tok-string">"prismatic", range=(0, 12.2))
s3d.joint(fclass="tok-string">"{name}_spin", right_handle, frame, kind=class="tok-string">"continuous")
return right_handle
def left_handle_body():
shear_arm_1 = shear_arm(class="tok-string">"shear_arm_1")
shear_arm_1 = s3d.transform(shear_arm_1, x=-0.03, y=-5.41, z=56.88, rx=180, ry=-14.9, rz=0)
return s3d.group(class="tok-string">"left_handle", shear_arm_1)
def pivot_carriage_body(name):
pivot_carriage_piece = pivot_pin(fclass="tok-string">"{name}_piece")
pivot_carriage_piece = s3d.transform(pivot_carriage_piece, x=0, y=0, z=-12.45, rx=90, ry=0, rz=0)
return s3d.group(name, pivot_carriage_piece)
def right_handle_body(name):
right_handle_piece = shear_arm(fclass="tok-string">"{name}_piece")
right_handle_piece = s3d.transform(right_handle_piece, x=-1.45, y=-6.22, z=6.35, rx=-90, ry=0, rz=-90)
return s3d.group(name, right_handle_piece)
def shear_arm(
name,
length=133.47,
width=12.7,
height=26.6,
blade_d=89.83,
blade_x=-24.9,
blade_z=-31.62,
end_d=9.86,
end_x=61.81,
end_z=-8.37,
hole_d=7.62,
heel_z=-7.49,
edge_z=-2.64,
tooth_pitch=4,
tooth_rise=1.34,
):
top = end_z + end_d / 2
angle = math.degrees(math.asin((top - blade_z) / (blade_d / 2)))
outline = s3d.poly(
[
(-length / 2, heel_z),
s3d.arc(center=(blade_x, blade_z), r=blade_d / 2, start=angle + 100, end=angle),
(end_x, top),
s3d.arc(center=(end_x, end_z), r=end_d / 2, start=90, end=-100),
(10.5, -height / 2),
(3, heel_z),
(-12, heel_z),
(-18.3, 3.2),
(-24, edge_z),
(-47, edge_z),
]
)
arm = s3d.extrude(name, outline, width, both=True)
arm = cutting_teeth(arm, width, edge_z, tooth_pitch, tooth_rise, 4, -35)
arm = arm_bore(arm, hole_d, -6.22, 1.45)
return s3d.at(arm, rx=90)
def cutting_teeth(arm, width, land, pitch, rise, count, center):
profile = s3d.poly([(-pitch / 4, land), (0, land + rise), (pitch / 4, land)])
tooth = s3d.extrude(class="tok-string">"serration", profile, width * 2, both=True)
frames = s3d.grid(count, 1, pitch, on=s3d.Frame((center, 0, 0)))
return s3d.cut(arm, s3d.at(tooth, on=frames))
def arm_bore(arm, diameter, x, z):
return s3d.hole(arm, diameter, on=(x, z))
def pivot_pin(name):
return s3d.at(s3d.extrude(name, s3d.circle(7.62), 24.89, both=True), rx=90)