Roger Maitland#7070 | A parametric pot lid holder:
from math import sqrt
from build123d import *
from ocp_vscode import *
set_defaults(reset_camera=False)
lid_d = 212 * MM # lid diameter
lid_t = 15 * MM # lid edge thickness
gap = 2 * MM # gap to allow easy insertion
lip = 15 * MM # amount the holder folds back on itself
thickness = 3 * MM # material thickness
with BuildPart() as holder:
# Create the profile from a filleted line
with BuildSketch() as profile:
with BuildLine() as outline:
Polyline(
(0, 0),
(lid_d / 2 + gap, 0),
(lid_d / 2 + gap, lid_t + gap),
(lid_d / 2 - lip, lid_t + gap),
)
fillet(outline.vertices(), radius=gap)
offset(amount=thickness, side=Side.RIGHT)
make_face()
# Revolve 90° as the part is mirrored later
revolve(axis=Axis.Y, revolution_arc=90)
# Create a box to control the part of the revolution to keep
size = holder.part.bounding_box().size
with Locations((0, -thickness, -lid_d / 4)):
Box(
2 * size.X,
size.Y,
size.Y,
mode=Mode.INTERSECT,
align=(Align.CENTER, Align.MIN, Align.CENTER),
) | 19:28:43 |
Roger Maitland#7070 | # Soften the sharp edges
fillet(holder.edges().filter_by(Axis.Y).sort_by(Axis.X)[2:4], lip / 3)
chamfer(holder.edges().filter_by_position(Axis.X, 1, size.X), 1 * MM)
# Create the mounting screw hole
with Locations(holder.faces().group_by(SortBy.AREA)[-1].sort_by(Axis.Y)[-1]):
h = CounterSinkHole(3.8 * MM / 2, 7 * MM / 2)
# Mirror to complete the part
mirror(about=Plane.YZ)
# Create a centered alignment notch to help with mounting
min_z = holder.part.bounding_box().min.Z
with Locations((0, -thickness, min_z)):
Box(
sqrt(2),
thickness,
sqrt(2),
rotation=(0, 45, 0),
align=(Align.CENTER, Align.MIN, Align.CENTER),
mode=Mode.SUBTRACT,
)
holder.part.export_step("holder-212.step")
print(f"Mounting holes spacing: {2*h.center().X:0.1f}mm")
show(holder) | 19:29:29 |