Import CAD projects and cad-router v1

This commit is contained in:
Jerry
2026-07-22 19:38:36 +08:00
parent e4e0199bd5
commit af9f630c11
2253 changed files with 1994207 additions and 0 deletions
@@ -0,0 +1,51 @@
"""Parametric eight-hole circular flange generated with build123d."""
from math import cos, radians, sin
from build123d import Align, BuildPart, Cylinder, Location, Locations, Mode
OUTER_DIAMETER_MM = 50.0
INNER_DIAMETER_MM = 20.0
THICKNESS_MM = 4.0
BOLT_HOLE_COUNT = 8
M3_CLEARANCE_DIAMETER_MM = 3.4
BOLT_CIRCLE_DIAMETER_MM = 40.0
def polar_point(radius: float, angle_degrees: float) -> tuple[float, float]:
angle = radians(angle_degrees)
return radius * cos(angle), radius * sin(angle)
def gen_step():
"""Return one STEP-ready flange solid in millimeters."""
with BuildPart() as flange:
Cylinder(
radius=OUTER_DIAMETER_MM / 2.0,
height=THICKNESS_MM,
align=(Align.CENTER, Align.CENTER, Align.MIN),
)
with Locations(Location((0.0, 0.0, -1.0))):
Cylinder(
radius=INNER_DIAMETER_MM / 2.0,
height=THICKNESS_MM + 2.0,
align=(Align.CENTER, Align.CENTER, Align.MIN),
mode=Mode.SUBTRACT,
)
for index in range(BOLT_HOLE_COUNT):
angle_degrees = 360.0 * index / BOLT_HOLE_COUNT
x_pos, y_pos = polar_point(BOLT_CIRCLE_DIAMETER_MM / 2.0, angle_degrees)
with Locations(Location((x_pos, y_pos, -1.0))):
Cylinder(
radius=M3_CLEARANCE_DIAMETER_MM / 2.0,
height=THICKNESS_MM + 2.0,
align=(Align.CENTER, Align.CENTER, Align.MIN),
mode=Mode.SUBTRACT,
)
part = flange.part
part.label = "flange_8x_m3_clearance"
return part