main
John Lauer KiCad's library model checked against ams' limits and kept (foot 0.529 mm at the gauge plane, in 0.45..0.75); four LODs… cb10da4 15d ago
#!/usr/bin/env python3
"""JEDEC gauge-plane foot length of any gull-wing STEP: section through the lead centred at y (on the
-x row), then the lead's crossings of z = 0.25; L = first crossing - tip. usage: measure.py part.step y"""
import sys, cadquery as cq
from OCP.BRepAlgoAPI import BRepAlgoAPI_Section
from OCP.gp import gp_Pln, gp_Pnt, gp_Dir
s = cq.importers.importStep(sys.argv[1]).val(); y = float(sys.argv[2])
sec = BRepAlgoAPI_Section(s.wrapped, gp_Pln(gp_Pnt(0, y, 0), gp_Dir(0, 1, 0))); sec.Build(); prof = cq.Shape.cast(sec.Shape())
pb = prof.BoundingBox()
sec2 = BRepAlgoAPI_Section(prof.wrapped, gp_Pln(gp_Pnt(0, 0, 0.25), gp_Dir(0, 0, 1))); sec2.Build()
xs = sorted(v.X for v in cq.Shape.cast(sec2.Shape()).Vertices() if v.X < 0)
print(f"{sys.argv[1].split('/')[-1]} y={y}: tip {pb.xmin:.4f}, crossings {[round(x,4) for x in xs]}, L = {xs[0]-pb.xmin:.4f}")