main
John Lauer Add symbol, footprint, Fusion and Altium libraries, viewers, provenance, README ab389b2 4h ago
#!/usr/bin/env python3
"""adom-lbr 2.47.6 does not carry the KiCad footprint's rule area (keepout zone) into the EAGLE/Fusion package.
Add it by hand: rectangles on tRestrict (41), bRestrict (42) and vRestrict (43) over x -4.05 .. 4.05,
y -5.5 .. 5.5 mm (the isolation strip between TI's HV land-pattern pads), plus a label on tDocu (51).
usage: lbr_keepout.py file.lbr"""
import sys
p = sys.argv[1]; s = open(p).read()
if 'layer="41"' in s: sys.exit("already has restrict rectangles")
add = "".join(f'<rectangle x1="-4.05" y1="-5.5" x2="4.05" y2="5.5" layer="{l}"/>\n' for l in (41, 42, 43))
add += '<text x="0" y="0" size="0.6" layer="51" rot="R90" align="center">ISOLATION KEEPOUT 8.1 mm</text>\n'
i = s.find("</package>"); assert i > 0 and s.count("</package>") == 1
s = s[:i] + add + s[i:]
open(p, "w").write(s); print("OK", p)