fix dfp generation

This commit is contained in:
King Kévin 2022-05-20 14:04:33 +02:00
parent d67ac812a0
commit 9dc2d6bbe9
1 changed files with 5 additions and 5 deletions

View File

@ -4,12 +4,12 @@
ORIGINAL_PATH = "usb_hub-dfp1.sch"
ORIGINAL_FILE = IO.read(ORIGINAL_PATH)
(2..7).to_a.each do |number|
number = number.to_s
output = ORIGINAL_FILE.dup
output.gsub!(/netname=(.*)1/, "netname=" + '\1' + number)
output.gsub!(/refdes=(.*)10/, "refdes=" + '\1' + number + "0")
output.gsub!(/ - DFP1/, " - DFP" + number)
File.open("#{ORIGINAL_PATH.gsub('1', number)}", "w") do |file|
output.gsub!(/netname=(.*)1/, "netname=" + '\1' + number.to_s)
output.gsub!(/refdes=(.*)10/, "refdes=" + '\1' + number.to_s + "0")
output.gsub!(/ - DFP1/, " - DFP#{number}")
output.gsub!(/USB2517_part-2-8-DFP1/, "USB2517_part-#{number + 1}-8-DFP#{number}")
File.open("#{ORIGINAL_PATH.gsub('1', number.to_s)}", "w") do |file|
file.write output
end
end