Files
Scanning the repository...
Last update 8 months 2 weeks
by
Matt M
import.pyimport glob import os from kiutils.symbol import SymbolLib for f in glob.iglob('import/**/*', recursive=True): if f.endswith("kicad_sym"): # Is symbol -- append to big symbol list new_lib = SymbolLib.from_file(f) fcb_lib = SymbolLib.from_file("fcb_v2_lib.kicad_sym") existing_symbol_names = [it.entryName for it in fcb_lib.symbols] for it in new_lib.symbols: if it.entryName not in existing_symbol_names: fcb_lib.symbols.append(it) print(f"Added {it.entryName} to big library") else: print("Symbol already in library -- not replacing") # Everything's in Git, we don't care if we blow local changes away. S3ndit fcb_lib.to_file("fcb_v2_lib.kicad_sym") os.remove(f) print("Wrote new changes") if f.lower().endswith("step") or f.lower().endswith("kicad_mod"): # file is footprint/3d model -- copy in new_path = os.path.join("fcb_footprints.pretty", f.split(os.sep)[-1]) if not os.path.exists(new_path): os.rename(f, new_path) print(f"imported {new_path}") else: print(f"file {new_path} exists -- not replacing")