7
mirror of https://github.com/EEVengers/ThunderScope.git synced 2025-01-09 09:54:43 +00:00
ThunderScope/Hardware/KiCad/Thunderscope_Rev5/add_lib_to_footprint.py
Aleksa Bjelogrlic 3b3af1cc50 Schematic WIP
2024-12-14 02:27:03 -05:00

16 lines
736 B
Python

# Define the file's name.
input_filename = "Thunderscope_Rev5.kicad_sym"
output_filename = "Thunderscope_Rev5_New.kicad_sym"
# Open the file and read its content.
with open(output_filename, "w") as output_file:
with open(input_filename) as input_file:
for line in input_file:
match line:
case x if x.startswith(' (property "Footprint"'):
footprint_old = line.split('"')[3]
if footprint_old != "":
footprint_new = "Thunderscope_Rev5:" + footprint_old
line = line.split(footprint_old)[0] + footprint_new + line.split(footprint_old)[1]
print (line)
output_file.write(line)