Add headphone holder model

This commit is contained in:
Alex Selimov 2026-09-09 22:17:09 -04:00
parent 9a65b4d8f4
commit 542e3c531a
3 changed files with 76 additions and 0 deletions

71
headphone_holder.py Normal file
View file

@ -0,0 +1,71 @@
# /// 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")