main
John Lauer STM32G431CBT6: datasheet-built LQFP48 model (DS12589 Rev 2 Table 94) with ST's real top marking STM32G431 / CBT6 / Y WW… 751ee87
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])
bb = s.BoundingBox()
# vertical section through one left lead centre (plane y=const), then horizontal line z=0.25 on it
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())
sec2 = BRepAlgoAPI_Section(prof.wrapped, gp_Pln(gp_Pnt(0, 0, 0.25), gp_Dir(0, 0, 1))); sec2.Build()
pts = sorted(v.X for v in cq.Shape.cast(sec2.Shape()).Vertices())
left = [p for p in pts if p < 0]
print("tip", round(bb.xmin, 3), "gauge-plane crossings (left):", [round(p, 3) for p in left], "L =", round(left[0] - bb.xmin, 3) if left else None)