Support for groups, compound polygons, natively chamfered pads and true rectangles in footprints
Synopsis
- Added Grouping capabilities (
Group
Node) - Added (optional)
TStamp
toNode
, with central seed coming from the root (Footprint
) to provide stable and reproducible output. Seed is passed to childs on append / extend - Added advanced polygon that can contain
PolygonArc
segments (CompoundPolygon
Node). Editing this polygon in the FPEditor is limited (converted to line approximation), therefore it is exploded to grouped arcs and lines if not filled / closed to preserve maximum editability. If future versions of KiCad support editing polygon arcs, export in native form as fp_poly can be switched on in these cases, too. - Added
NativeCPad
primitive, a more direct match to KiCad's Pad capabilities (e.g. providing natively chamfered and rounded corners, allowing nice D-shaped pads with the correct settings that are easy to modify by hand without using custom primitives) - Added
FPRect
class to generate true rectangles in the footprint usingfp_rect
Possible open issues
-
Some serialization code is included in the new classes derived from Node, since it is very specific. If desired, it can be moved to KicadFileHandler.py -
Please provide feedback on how these changes fit into the project. I created them because I needed them for a footprint converter script from a proprietary format into Kicad. I found the KicadModTree to be a good starting point, but it lacked the above features to allow easy fine-tuning of the output by hand. I wanted to share those additions, but are not sure how valuable they are -
Adherence to pep8 should (now) be ok. Some code style improvements can certainly be made. I'm not a professional python dev, therefore feel free to offer suggestions or provide improvements. -
The test suite has not been run, because I seem to be unable to figure out how to properly start it or set it up in GitLab. Please point me to the docu for this or give me some directions how to do thisTest suite has been run, expected outputs were adapted where required (fill
forfp_circle
) and the serialization adapted to produce unchanged results where possible (no more blank lines forfp_poly
,zone
for emptyTStamp
s)
Thanks
Edited by CKuhlmann