72 lines
2.1 KiB
Python
72 lines
2.1 KiB
Python
|
|
# /// script
|
||
|
|
# requires-python = ">=3.14"
|
||
|
|
# dependencies = ["ocp_vscode", "build123d"]
|
||
|
|
# ///
|
||
|
|
|
||
|
|
from build123d import *
|
||
|
|
from ocp_vscode import *
|
||
|
|
|
||
|
|
height = 1.0 * IN
|
||
|
|
hole_spacing = 1.5 * IN
|
||
|
|
x_padding = 0.25 * IN
|
||
|
|
y_padding = 0.25 * IN
|
||
|
|
thickness = 0.1 * IN
|
||
|
|
headphone_holder_thickness = 1.75 * IN
|
||
|
|
holder_roc = 3.75 * IN
|
||
|
|
bolt_diameter = 3 / 16 * IN
|
||
|
|
lip_length = 0.15 * IN
|
||
|
|
lip_thickness = 0.15 * IN
|
||
|
|
|
||
|
|
|
||
|
|
with BuildPart() as holder:
|
||
|
|
with BuildSketch() as sketch:
|
||
|
|
with BuildLine():
|
||
|
|
l1 = Line((0, 0), (0, height))
|
||
|
|
l2 = Line(l1 @ 1, (hole_spacing + 2 * x_padding, height))
|
||
|
|
l3 = Line(l2 @ 1, (hole_spacing + 2 * x_padding, 0))
|
||
|
|
l4 = RadiusArc(l1 @ 0, l3 @ 1, holder_roc)
|
||
|
|
make_face()
|
||
|
|
|
||
|
|
with Locations(
|
||
|
|
(x_padding, height - y_padding),
|
||
|
|
(x_padding + hole_spacing, height - y_padding),
|
||
|
|
):
|
||
|
|
Circle(
|
||
|
|
radius=bolt_diameter / 2,
|
||
|
|
mode=Mode.SUBTRACT,
|
||
|
|
align=(Align.CENTER, Align.MAX),
|
||
|
|
)
|
||
|
|
extrude(amount=thickness)
|
||
|
|
fillet(
|
||
|
|
holder.edges().filter_by(Axis.Z).sort_by(Axis.Y)[-2:], radius=bolt_diameter / 2
|
||
|
|
)
|
||
|
|
with BuildSketch() as sketch:
|
||
|
|
with BuildLine():
|
||
|
|
l1 = RadiusArc((0, 0), (hole_spacing + 2 * x_padding, 0), holder_roc)
|
||
|
|
offset(amount=lip_thickness, side=Side.LEFT)
|
||
|
|
make_face()
|
||
|
|
extrude(amount=headphone_holder_thickness + thickness)
|
||
|
|
|
||
|
|
with BuildSketch(
|
||
|
|
Plane.XY.offset(headphone_holder_thickness + thickness)
|
||
|
|
) as sketch2:
|
||
|
|
with BuildLine():
|
||
|
|
l1 = RadiusArc((0, 0), (hole_spacing + 2 * x_padding, 0), holder_roc)
|
||
|
|
offset(amount=lip_thickness, side=Side.LEFT)
|
||
|
|
make_face()
|
||
|
|
with BuildSketch(
|
||
|
|
Plane.XY.offset(headphone_holder_thickness + thickness + lip_length)
|
||
|
|
):
|
||
|
|
with BuildLine():
|
||
|
|
l1 = RadiusArc(
|
||
|
|
(0, lip_length),
|
||
|
|
(hole_spacing + 2 * x_padding, lip_length),
|
||
|
|
holder_roc,
|
||
|
|
)
|
||
|
|
offset(amount=lip_thickness, side=Side.LEFT)
|
||
|
|
make_face()
|
||
|
|
|
||
|
|
loft()
|
||
|
|
show(holder)
|
||
|
|
export_stl(holder.part, "headphone_holder.stl")
|