ThreadedHole(
cap_lid_hole_radius,
cap_height,
cap_outer_thickness,
lid_shoulder,
thread_pitch,
)
Bases: BasePartObject
Creates a subtractable piece, creating a threaded hole.
Source code in src/bd_tube_boxes/threaded_hole.py
| def __init__(
self,
cap_lid_hole_radius: float,
cap_height: float,
cap_outer_thickness: float,
lid_shoulder: float,
thread_pitch: float,
):
"""
Creates a subtractable piece, creating a threaded hole.
"""
screw_hole = Solid.make_cylinder(cap_lid_hole_radius, cap_height)
shoulder_radius = cap_lid_hole_radius + lid_shoulder
shoulder = (
Location((0, 0, -cap_height + cap_outer_thickness)) *
Solid.make_cylinder(shoulder_radius, cap_height)
) # fmt: off
bottom = Location((0, 0, cap_height)) * Solid.make_cylinder(shoulder_radius, cap_height / 2)
solid = screw_hole + shoulder + bottom
edges = list(filter(lambda e: e.radius == cap_lid_hole_radius, solid.edges().filter_by(GeomType.CIRCLE)))
solid = chamfer(edges, lid_shoulder - 0.01)
thread = IsoThread(
major_diameter=cap_lid_hole_radius * 2 + thread_pitch,
pitch=thread_pitch,
length=cap_height,
external=True,
)
solid += thread
return super().__init__(part=solid)
|