Skip to content

Instantly share code, notes, and snippets.

@iansan5653
Created July 4, 2026 23:37
Show Gist options
  • Select an option

  • Save iansan5653/299a6f1d26b1de36765f6a5304d5204f to your computer and use it in GitHub Desktop.

Select an option

Save iansan5653/299a6f1d26b1de36765f6a5304d5204f to your computer and use it in GitHub Desktop.
build123d: Half-circle cutout router template
# build123d model for a 3D printable router template for cutting a half circle in the end of a board
# %%
from build123d import *
from ocp_vscode import *
# %% parameters
board_width = (5 + (1/16)) * IN
cutout_diameter = 3 * IN
# %% body
thickness = (1/4) * IN
body = Box(length=board_width,
width=(cutout_diameter / 2) + (1 * IN), height=thickness)
top_plane = Plane(body.faces().sort_by(Axis.Z)[-1])
# farthest edge in the y and z directions that runs along the x axis
long_edge = body.edges().filter_by(
Axis.X).sort_by(Axis.Y).sort_by(Axis.Z)[-1]
mast_cutout = Pos(long_edge @ 0.5) * Rot(top_plane) * \
Circle(radius=cutout_diameter / 2)
body -= extrude(mast_cutout, amount=-thickness)
# %% fillet
zeroish = 1e-6
cutout_fillet_edges = body.edges() | Axis.Z | (lambda e: e.distance_to(mast_cutout) <= zeroish)
body = body.fillet(radius = (1/8) * IN, edge_list=cutout_fillet_edges)
# %% alignment guides
body_corner = long_edge @ 0
guide_corner = body_corner + (thickness, thickness, 0)
guide_shape_template = Box((1/2) * IN, 1 * IN, 2 * thickness, align=(Align.MAX, Align.MAX, Align.MAX))
guide_outer_shape = Pos(guide_corner) * guide_shape_template
guide_inner_shape = Pos(body_corner) * guide_shape_template
guide = guide_outer_shape - guide_inner_shape
guides = guide + guide.mirror(Plane.YZ)
body += guides
# %% show
show(body)
# %%
@iansan5653

Copy link
Copy Markdown
Author
preview image of the model; it's a box with a circle cut out of it and a fillet radius at the edges of the cutout; the template has L-shaped guides at the corners for alignment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment