KiCad / kicad-library-utils

Some scripts for helping with library development
GNU General Public License v3.0
128 stars 92 forks source link

Extract footprint-center from F.Fab outline #260

Closed ghost closed 4 years ago

ghost commented 6 years ago

Some footprints have weird pad shapes, making the F6.2 test fail. To fix this, we can also calculate the center of the F.Fab layer. Of those two possible center-locations, the one closer to (0,0) is selected. If Pads-center and F.Fab-center differ a warning is displayed.


This fixes the travis error for this PR https://github.com/KiCad/kicad-footprints/pull/951

evanshultz commented 6 years ago

This should apply only to SMT footprints, since THT footprints have the origin at pin 1.

I didn't look at the code, but I'm not sure what you described above is the best approach. Consider this footprint: image

The center of the pads and fab lines need to be considered together. Either one separately wouldn't work. This might be a nice incremental improvement and I'm not against merging it, just saying that it's not a comprehensive fix to consider only pads or only fab lines.

Ratfink commented 6 years ago

I'd just like to pop in to point out that barring some miracle (like all manufacturers providing drawings in a standardized machine-readable format), there is no comprehensive fix. This is because a drawing can specify any pick-and-place origin, which need not be the center of any features of the footprint. The best we can hope for is an improved heuristic, resulting in fewer false negatives. So in short, if this is better, of course it should be accepted.

I haven't taken a look at the patch though, so take everything I wrote above as a general statement, not as a recommendation to merge.

ghost commented 6 years ago

Hello,

It does not apply to non SMD-Footprints, see Line24. I have not touched that :)

But you are right, this is not a comprehensive fix. There are still valid footprints which will fail. But less will fail with that changeset.

Example: the mentioned HDMI-Footprint the check will not fail, but display a warning.

$ ../kicad-library-utils/pcb/check_kicad_mod.py Connector_HDMI.pretty/HDMI_A_Contact_Technology_HDMI-19APL2_Horizontal.kicad_mod -vv
Checking footprint 'HDMI_A_Contact_Technology_HDMI-19APL2_Horizontal':
  Violating F6.2
    For surface-mount devices, footprint anchor is placed in the middle of the footprint (IPC-7351).
    Footprint centers of pads and F.Fab do not match
     - Footprint center calculated as Pad: (0.0,0.0)mm F.Fab: (0.0, 6.55)mm
ghost commented 5 years ago

This has been idle quite some time. Does anybody want to review/merge it? I still consider this a small but usefull addition.

ghost commented 4 years ago

A good testcase is LED-L1T2_LUMILEDS in LED_SMD (which should get fixed).

poeschlr commented 4 years ago

Thanks looks good now (ignore my last comment made as i seem to have misclicked and looked on an outdated diff)