Closed bug report

wiki-component: prefer KiCad's 3D model (or KiCad's package generator at datasheet values) over hand-built leads; never square folds over a micron-level miss

John Lauer · ·closed by Colby Knox

What went wrong

On 2026-10-19 a thread following wiki-component ("Datasheet-built 3D models: prove them by overlay") replaced KiCad's library models on adom/stm32g431cbt6 and adom/opa2365aidr with hand-built CadQuery models: square 90 degree lead folds, flat grey leads. The KiCad models had smooth radiused bends; they were dropped over a 6 um (STM32, foot 0.444 against ST's 0.45 min) and a 38 um (OPA2365, 0.362 against TI's 0.40) foot-length miss. John: the legs "just look fake". adom/ap2112k-3-3trg1 went the same way, and adom/tmc2226-sa-t carried a block with straight, unbent leads labelled as KiCad's.

The section's first sentence says "When the maker publishes no 3D model ... build it from the datasheet". It never says to use or regenerate KiCad's model first, so an AI goes straight to hand-building leads.

Proposed rule (replace the section's opening)

Prefer KiCad's 3D model. When the maker publishes no redistributable model:

  1. KiCad's library model, as it is, when every printed dimension is inside the datasheet's min to max, or within 0.05 mm of the typical value where only a typical is printed, and its leads are realistic (radiused gull-wing bends, not square folds). Bend shape counts; a micron-level miss does not.
  2. Otherwise regenerate it with KiCad's own package generator (the CadQuery scripts: kicad-packages3D-generator, now inside gitlab.com/kicad/libraries/kicad-footprint-generator) at the datasheet's values, so the bends stay KiCad's. Tune the generator's flat-foot length until the foot measured to the 0.25 mm gauge plane equals the datasheet's L.
  3. Hand-build only what neither covers, and never trade a realistic model for a square-fold one.

Record the measurement method and both numbers (KiCad library vs regenerated) in provenance/3d-model.json. Method used on the five pages: a section through one lead's centre line, cut at z = 0.25; L = lead tip to where the lead's lower outer surface crosses that plane (JEDEC).

Reference implementation

On all five pages under provenance/tools/kicad-generator/:

  • kgen.py runs KiCad's make_gw on datasheet values and tunes the gauge-plane foot;
  • measure.py measures L;
  • materials.py gives the GLB matte-tin leads and an epoxy body (step2glb leaves metallic and roughness unset, so every part renders as rough metal);
  • lod.mjs / assets.sh build the four LODs (lossless per-part batching for high, meshopt for low and super-low);
  • kicad-generator-A2_b.patch is a one-line generator extension for packages whose datasheet prints the parting line off centre (Diodes SOT25 N = 0.75).

Results:

Page Previous Now
adom/stm32g431cbt6 KiCad L 0.444, then square folds generator, L 0.600
adom/opa2365aidr KiCad L 0.362, then square folds generator, L 0.460
adom/ap2112k-3-3trg1 KiCad SOT-23-5 1.55 tall, then square folds generator, 1.15, N 0.75
adom/tmc2226-sa-t block, straight leads, 7.2 over pins generator, 6.40, EP 6.20 x 2.75
adom/as5047p-atsm KiCad, kept: every printed size inside ams' limits unchanged + LODs

Found by a Claude Opus 5.5 thread for John Lauer, 2026-10-21.

1 Reply

Colby Knox ·

Done in 0.8.50. wiki-component's 3D section now opens with your rule, in your order: KiCad's library model as it is when every printed dimension is in range (or within 0.05 mm of a typical-only value) and the bends are realistic; otherwise KiCad's package generator at the datasheet's values, tuned to L at the 0.25 mm gauge plane; hand-build only what neither covers, never trading a realistic model for square folds. It also asks for the L method and both numbers in provenance/3d-model.json and points at your five pages' provenance/tools/kicad-generator/ as the reference implementation. The overlay-proof rules still apply to anything built or regenerated from the datasheet.

Colby Knox closed this ·

Log in to reply.