This commit is contained in:
Till Schmidt 2026-06-26 23:06:46 +02:00
parent 55a1df1d9b
commit aae3add1a6

View file

@ -16,23 +16,13 @@ pin_diameter = model_size * (3.1 / model_size)
pin_length = model_size * (10.8 / model_size)
pin_spacing = model_size * (14.0 / model_size)
pin_height_offset = model_size * (1.55 / model_size)
fillet_radius = model_size * (0.5 / model_size)
fillet_radius = model_size * (0.15 / model_size)
# --- Lightning Bolt Proportions ---
# W is now the radius of the ring PLUS your desired flat overhang
W = (outer_diameter / 2) + overhang
# --- Lightning Bolt Proportions (The Vintage "Z" Fix) ---
# We use a massive bounding box to draw the Z, then use your Circle(W) to cleanly trim it.
bound = model_size
# Vertical (Y) coordinates for the horizontal bars
# H_outer defines the overall height. H_inner defines where the cutouts stop.
H_outer = model_size * (3.1 / model_size)
H_inner = model_size * (0.5 / model_size)
# Horizontal (X) coordinates for the zigzag points
# X_point is the sharp outer tip. X_inner is how deeply the diagonal cuts past center.
X_point = model_size * (5.8 / model_size)
X_inner = model_size * (2.7 / model_size)
@ -48,19 +38,34 @@ with BuildPart() as opel_pin:
pts = [
(-bound, H_outer), # 1. Top-left outer edge
(-bound, -H_inner), # 2. Bottom-left outer edge of upper bar
(-X_inner, -H_inner), # 3. Inner bottom corner (cuts right, past center)
(-X_inner, -H_inner), # 3. Inner bottom corner (cuts right, past center)
(-X_point, -H_outer), # 4. Sharp bottom-left point (diagonals back left)
(bound, -H_outer), # 5. Bottom-right outer edge
(bound, H_inner), # 6. Top-right outer edge of lower bar
(X_inner, H_inner), # 7. Inner top corner (cuts left, past center)
(X_inner, H_inner), # 7. Inner top corner (cuts left, past center)
(X_point, H_outer) # 8. Sharp top-right point (diagonals back right)
]
Polygon(*pts)
z_shape = Polygon(*pts)
# Fillet the 2D corners of the Z shape so the inner zig-zag isn't infinitely sharp
fillet(z_shape.vertices(), radius=fillet_radius)
# Cleanly slice off the overhangs using your dynamic W radius
# Cleanly slice off the overhangs
Circle(W, mode=Mode.INTERSECT)
extrude(amount=thickness)
# ==========================================
# ---> THE FIX: Fillet ALL top edges <---
# 1. Grab the highest face on the Z-axis (the newly merged face of both ring + bolt)
top_face = opel_pin.faces().sort_by(Axis.Z)[-1]
# 2. Grab ALL edges of that top face (no filtering)
all_top_edges = top_face.edges()
# 3. Apply the 3D fillet to the entire border
fillet(all_top_edges, radius=fillet_radius)
# ==========================================
# 3. Mounting Pins (on the back face)
bottom_face = opel_pin.faces().sort_by(Axis.Z)[0]
@ -70,5 +75,9 @@ with BuildPart() as opel_pin:
extrude(amount=pin_length)
# --- Export for 3D Printing ---
# This saves a STEP file in the same folder as your python script
export_step(opel_pin.part, "vintage_opel_pin.step")
# --- Send to OCP CAD Viewer ---
show(opel_pin)