Rev 303 | Rev 315 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
252 | jelle | 1 | #!/bin/bash |
2 | |||
301 | jelle | 3 | # date: 2008-11-02 / 2008-11-24 |
4 | # version: v0.1.2j |
||
252 | jelle | 5 | # creator: Jelle de Jong <jelledejong@powercraft.nl> |
6 | # project: openarm sbc |
||
7 | # licence: gplv3 |
||
8 | |||
277 | agaran | 9 | # this file wont work with no $DISPLAY and requires psnup |
10 | # so imho it should check for DISPLAY at least |
||
11 | # like that |
||
12 | |||
13 | if [ "x$DISPLAY" == "x" ]; then |
||
301 | jelle | 14 | echo "Its quite possible that you aren't executing this script from X system, or" |
15 | echo "you don't have DISPLAY env variable set. I cannot continue because gschem won't" |
||
16 | echo "work unless you set one, even with xserver with dummy output i hope" |
||
17 | exit |
||
277 | agaran | 18 | fi |
19 | |||
252 | jelle | 20 | echo ';; This file may be used to print gschem schematics from the |
21 | ;; command line. Typical usage is: |
||
22 | ;; |
||
23 | ;; gschem -p -o mysch.ps -s /path/to/this/file/print.scm mysch.sch |
||
24 | ;; |
||
25 | ;; The schematic in "mysch.sch" will be printed to the file "mysch.ps" |
||
26 | ;; |
||
253 | jelle | 27 | ;; documentation: less /etc/gEDA/system-gschemrc |
252 | jelle | 28 | ;; documentation: less /user/share/gEDA/scheme/print.scm |
29 | ;; |
||
30 | |||
31 | (log-window "later") |
||
32 | |||
33 | (output-type "limits") |
||
34 | (paper-size 16.54 11.69) |
||
35 | (output-text "ps") |
||
36 | (output-type "extents") |
||
37 | (output-orientation "landscape") |
||
38 | (output-color "enabled") |
||
39 | |||
40 | ; You need call this after you call any rc file function |
||
41 | (gschem-use-rc-values) |
||
42 | |||
43 | ; filename is specified on the command line |
||
44 | (gschem-postscript "dummyfilename") |
||
45 | |||
46 | (gschem-exit)' > ~/openarm/working/gschem/pdf/print.scm |
||
47 | |||
301 | jelle | 48 | pdf_dir="$HOME/openarm/working/gschem/pdf" |
49 | sch_dir="$HOME/openarm/working/gschem/sch" |
||
50 | project="openarm-sbc" |
||
252 | jelle | 51 | |
301 | jelle | 52 | for file in "$sch_dir"/*.sch |
53 | do |
||
54 | if [ -f "$file" ] |
||
55 | then |
||
56 | filename=${file##*/} |
||
57 | shortname=${filename%.*} |
||
58 | gschem -p -o $pdf_dir/$shortname.ps -s $pdf_dir/print.scm $sch_dir/$shortname.sch |
||
59 | if [ -x /usr/bin/psnup ] |
||
60 | then |
||
303 | jelle | 61 | /usr/bin/psnup -p a3 -l -m -1.20cm $pdf_dir/$shortname.ps $pdf_dir/$shortname-trimmed.ps |
301 | jelle | 62 | fi |
63 | if [ -x /usr/bin/ps2pdf14 ] |
||
64 | then |
||
65 | /usr/bin/ps2pdf14 -sPAPERSIZE=a3 $pdf_dir/$shortname-trimmed.ps $pdf_dir/$shortname.pdf |
||
66 | fi |
||
67 | if [ -e $pdf_dir/$shortname.ps ] |
||
68 | then |
||
69 | rm $pdf_dir/$shortname.ps |
||
70 | fi |
||
71 | if [ -e $pdf_dir/$shortname-trimmed.ps ] |
||
72 | then |
||
73 | rm $pdf_dir/$shortname-trimmed.ps |
||
74 | fi |
||
75 | if [ -e $pdf_dir/$shortname.pdf ] |
||
76 | then |
||
77 | pdf_query+=("$pdf_dir/$shortname.pdf") |
||
252 | jelle | 78 | |
301 | jelle | 79 | fi |
80 | fi |
||
81 | done |
||
252 | jelle | 82 | |
301 | jelle | 83 | if [ -n "$pdf_query" ] |
84 | then |
||
85 | if [ -x /usr/bin/pdftk ] |
||
86 | then |
||
302 | jelle | 87 | /usr/bin/pdftk "${pdf_query[@]}" cat output $pdf_dir/$project-schematics.pdf |
301 | jelle | 88 | fi |
89 | fi |
||
252 | jelle | 90 | |
91 | exit |