sparkfun / SparkFun-KiCad-Libraries

SparkFun's KiCad Libraries
553 stars 110 forks source link

Remove soldermask expansion from all footprints #141

Closed sfe-SparkFro closed 1 month ago

sfe-SparkFro commented 1 month ago

Fixes #137

I used this script to automate the process, which simply iterates through every footprint and removes any lines with solder_mask_margin (which is what KiCad does when you set the value to zero):

import os

folders = os.listdir()

def remove_solder_mask_margin(folder, file):
    with open(folder + os.sep + file, "r") as f:
        lines = f.readlines()
    with open(folder + os.sep + file, "w") as f:
        for line in lines:
            if "solder_mask_margin" not in line:
                f.write(line)
    print("\t" + file)

for folder in folders:
    if ".pretty" in folder:
        print(folder)
        files = os.listdir(folder)
        for file in files:
            if ".kicad_mod" in file:
                remove_solder_mask_margin(folder, file)

I poked through some footprints and they all seem fine and correctly have the soldermask expansion removed.

sfe-SparkFro commented 1 month ago

Note that this does not address any footprints with custom mask geometry, such as the DFN-8:

image

Same with WDFN-8_6x5mm-SkinnyCenterPad:

image

nseidle commented 1 month ago

We'll have to manually modify some, as well as run your script against future EAGLE FP imports, but an excellent start! Thank you.