rake: all multi-sheet export

This commit is contained in:
King Kévin 2022-06-16 16:44:14 +02:00
parent bde94d7b85
commit 51c6af4add
1 changed files with 12 additions and 1 deletions

View File

@ -15,6 +15,8 @@ require 'csv' # to export BOM and costs
# common name used for file names
name = "usb_hub"
# additional schematic sheets
sheets = ["usb_hub-dfp1", "usb_hub-dfp2", "usb_hub-dfp3", "usb_hub-dfp4", "usb_hub-dfp5", "usb_hub-dfp6", "usb_hub-dfp7"]
# project version, read from "version" file
raise "define project version in 'version' file" unless File.exist? "version"
version = IO.read("version").split("\n")[0]
@ -37,8 +39,12 @@ task :default => [:print, :fabrication, :bom, :pnp]
desc "print schematic and layout (as pdf)"
prints = [ "#{name}.sch.pdf", "#{name}.brd.pdf", "#{name}.brd-top.svg", "#{name}.brd-bottom.svg" ]
unless sheets.empty? then
prints += sheets.collect{|sheet| "#{sheet}.sch.pdf"}
prints << "#{name}.sch-all.pdf"
end
task :print => prints
CLEAN.include([ "#{name}.versioned.sch", "#{name}.versioned.lht" ])
CLEAN.include([ "#{name}.versioned.sch", "#{name}.versioned.lht" ] + sheets.collect{|sheet| "#{sheet}.versioned.sch"})
CLOBBER.include(prints)
desc "generate fabrication gerbers (as archive)"
@ -92,6 +98,11 @@ rule ".sch.pdf" => ".versioned.sch" do |t|
sh "lepton-cli export --color --paper=iso_a4 --layout=landscape --output=#{t.name} #{t.source} 2> /dev/null"
end
desc "generate grouped printable version (PDF) of schematic"
rule ".sch-all.pdf" => ["#{name}.sch.pdf"] + sheets.collect{|sheet| "#{sheet}.sch.pdf"} do |t|
sh "pdfcat --output #{t.name} " + t.prerequisites * " "
end
desc "generate printable version (PostScript) of board layout"
rule ".brd.ps" => ".versioned.lht" do |t|
sh "pcb-rnd -x ps --ps-color --media A4 --psfile #{t.name} #{t.source} 2> /dev/null"