2026-09-04 06:53:32 -04:00
|
|
|
# /// script
|
|
|
|
|
# requires-python = ">=3.14"
|
|
|
|
|
# dependencies = ["ocp_vscode", "build123d"]
|
|
|
|
|
# ///
|
|
|
|
|
|
|
|
|
|
from build123d import *
|
|
|
|
|
from ocp_vscode import *
|
|
|
|
|
|
|
|
|
|
### USER INPUTS ###
|
|
|
|
|
base_thickness = 25.4 * MM
|
|
|
|
|
wall_thickness = 9 * MM
|
2026-09-18 22:40:45 -04:00
|
|
|
slots = [i * MM for i in [22, 20, 20, 20]]
|
2026-09-04 06:53:32 -04:00
|
|
|
slot_height = 60 * MM
|
2026-09-18 22:40:45 -04:00
|
|
|
width = 355.7 / 4 * MM # width of macbook pro
|
2026-09-04 06:53:32 -04:00
|
|
|
###################
|
|
|
|
|
|
|
|
|
|
with BuildPart() as holder: # noqa: SIM117
|
|
|
|
|
with BuildSketch() as sketch:
|
|
|
|
|
length = wall_thickness * (len(slots) + 1) + sum(slots)
|
|
|
|
|
height = slot_height + base_thickness
|
|
|
|
|
Rectangle(length, height)
|
|
|
|
|
|
|
|
|
|
offset = wall_thickness
|
|
|
|
|
for slot in slots:
|
|
|
|
|
with Locations((offset - length / 2, base_thickness - height / 2)):
|
|
|
|
|
Rectangle(
|
|
|
|
|
slot, slot_height, mode=Mode.SUBTRACT, align=(Align.MIN, Align.MIN)
|
|
|
|
|
)
|
|
|
|
|
Circle(slot / 2, mode=Mode.SUBTRACT, align=(Align.MIN, Align.CENTER))
|
|
|
|
|
offset += wall_thickness + slot
|
|
|
|
|
extrude(amount=width)
|
|
|
|
|
fillet(
|
|
|
|
|
holder.edges().group_by(Axis.Y)[-1].filter_by(Axis.Z),
|
|
|
|
|
radius=wall_thickness / 2.5,
|
|
|
|
|
)
|
|
|
|
|
show(holder)
|
|
|
|
|
export_stl(holder.part, "laptop_holder.stl")
|