add options to override/reconstruct footprint reference anchor
Description
Footprints with inappropriate anchor points are still a common occurrence despite ongoing efforts to clean up KiCad libraries. Other sources include libraries maintained by third parties, which see growing popularity for their convenience (I contacted one of them about the convention, but they seem reluctant to make it compliant with KLC).
Some insist on anchoring their parts on pin 1, which is a constant annoyance as it requires manually offsetting the footprint with respect to the center of the part. It's particularly terrible when footprints with symmetric pad pattern are to be rotated by 180° and land in the same spot, which then requires precision movements on top of an otherwise trivial rotation.
KLC:
F6.2 - Footprint anchor should be placed in the middle of the component body
The footprint anchor (also called component origin) is used by automated Pick and Place (PNP) machines for locating and placing SMD components on a PCB.
For most standard components, the anchor should generally be located on the centroid of the component body.
Providing anchoring options editable in the Footprint Properties could address the recurrent struggle with footprint anchoring.
proposed function
As heuristic inference is not guaranteed to be successful, a list of variants can be provided to choose from:
- from library (default)
- specified pad
- pad coordinates centroid
- pad coordinates bounding box
- pad shape bounding box
- courtyard shape centroid
- courtyard bounding box
along with an additive user-defined X,Y offset. The latter covers cases where the required offset is known or can be constructed from one of the constructions listed above. Packages with rotational symmetry have obvious fixes, while asymmetric package (e.g. SOT23-3, TO263, SO packages with omitted pins for HV applications, most DCDC modules, ....) are more likely to have their anchor point coincide with bounding boxes or the courtyard centroid.
discussion
Sometimes it is recommended to tweak the origin in the footprint editor, but this is inviting layout corruption down the line: https://forum.kicad.info/t/changing-origin-of-footprint/14280/5
The proposed extension avoids the need to create custom libraries and the incentive to tweak managed libraries. Implementation of this feature introduces a layer of library abstraction and keeps the source footprint intact and updatable. The 3D model would also be subject to this translation, where in the footprint editor changes to the footprint as well as the 3D properties are required.
(If found to be popular, one could even imagine an option for users to report their footprint modifications and generate consensus for necessary library fixes, but this is outside the scope of this issue).
KiCad Version
Application: Pcbnew
Version: (5.1.6)-1, release build
Libraries:
wxWidgets 3.0.4
libcurl/7.66.0 OpenSSL/1.1.1d (Schannel) zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.1.1) nghttp2/1.39.2
Platform: Windows 7 (build 7601, Service Pack 1), 64-bit edition, 64 bit, Little endian, wxMSW
Build Info:
wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8)
Boost: 1.71.0
OpenCASCADE Community Edition: 6.9.1
Curl: 7.66.0
Compiler: GCC 9.2.0 with C++ ABI 1013
Build settings:
USE_WX_GRAPHICS_CONTEXT=OFF
USE_WX_OVERLAY=OFF
KICAD_SCRIPTING=ON
KICAD_SCRIPTING_MODULES=ON
KICAD_SCRIPTING_PYTHON3=OFF
KICAD_SCRIPTING_WXPYTHON=ON
KICAD_SCRIPTING_WXPYTHON_PHOENIX=OFF
KICAD_SCRIPTING_ACTION_MENU=ON
BUILD_GITHUB_PLUGIN=ON
KICAD_USE_OCE=ON
KICAD_USE_OCC=OFF
KICAD_SPICE=ON