X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f X-Recipient: geda-user AT delorie DOT com Date: Thu, 6 Jun 2013 00:11:02 +0200 From: Kai-Martin Knaak To: geda-user AT delorie DOT com Subject: Re: [geda-user] far side rendering Message-ID: <20130606001102.388f0e56@akka> In-Reply-To: References: X-Mailer: Claws Mail 3.9.1 (GTK+ 2.24.18; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_/+5Fx6mQvxgyDJRMoFBRaqKD"; protocol="application/pgp-signature" X-Provags-ID: V02:K0:Mfju7WWMTdeaqQDtqTeWh80fTeXQZLlq76HgK29M0+P Myiy1WAbRCJXzGi0VvKlyDqHlhb/tkNrxKnFi35FKd2/MeKqWE BDJGd72yl5+f2YcEVwjbdWFruqiQeTDgpHExOkRKwgnbiBPQp2 N99PZDEME4/7dDN3Y7AqimSqWkAvJDHo4m21ngOkmzj9CgHRSl kToZGCQkFafGEG8CuFf53Yj55yJbOQNkqcrFd0x+jS9QUzJOUp TBKBjgGK7fuPiIBsKoqXE/Mvk/dmhUHuloy13uVovxpGLgG4gs Kps0LU6yO7P4igTcxKBuXzPMLJcHCQuuxrE8MuAYSdCG8fy3Q= = Reply-To: geda-user AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: geda-user AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk --Sig_/+5Fx6mQvxgyDJRMoFBRaqKD Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Nathan Stewart schrieb am 26. May 2013: > Is there any control over rendering options of the far side of the > board? I didn't see it in the color/layers options. I use action scripts to achieve the prints I find most useful for my work flow. That is four pages: 1) top silk with refdes in black and top layer in light grey 2) top silk with values in black and top layer in light grey 3) bottom silk with refdes in black and bottom layer in light grey 4) bottom silk with values in black and bottom layer in light grey Unfortunately, default pcb exits on the action 'DISPLAY(...)' which switches between "refdes" and "value". There is a code path that considers this action to be only sensible if a GUI is present. In case of no GUI, the code exits right away. This is meant to prevent non sensible actions go unnoticed when nobody is watching. The ability to produce the above prints in a scripted environment is important to my work flow. So I wrote a patch that replaces the exit command with a warning on stdout. ---<)kaimartin(>--- PS: This is the current version of my print script. It optionally adds a mirrored copy of top silk to the bottom prints. For eye candy, it produces a photo realistic PNG with fake drop shadows: /------------------------- #!/bin/bash # layout-print for PCB -<(kmk)>- 2010-2012 # needs poster, ps2pdf, convert, psmerge and optionally # viewers for PNG and PDF (gthumb and okular) ######################################################## if [ $# -eq 0 ] # Script invoked with no command line args then echo "A script to provide PDF and PNG prints of a PCB layout. The PDF out= put" echo "contains pages with the refdes of components and additionaly pages = that" echo "show the values of components. Optionally, an additional bottom vie= w" echo "is produced that shows mirrored top silk. This is useful for debugg= ing"=20 echo "thru hole designs." echo "Photorealistic PNG output is rendered with a drop shadow for a slig= htly"=20 echo "three dimensional impression." echo "" echo "Usage: `basename $0` [-s][-p][-V] foobar.pcb" echo "-s add a page with mirrored top silk on bottom layer" echo "-p produce photo realistic output" echo "-V launch viewers on produced output" echo "Note: There is a bug in the run of the mill version of PCB, that pr= events" echo "execution of the DISPLAY action on the command line. The applicatio= n" echo "exits preemptively on the assumption, that this command is only val= id" echo "if PCB runs in GUI mode. Because of this, this print script won't w= ork" echo "properly unless a patch has been applied to the source." echo "A patch to make PCB issue a rather than exit right away, can be" echo "downloaded as 'hidnogui-actionscript.patch' from http://gedasymbols= .org ." exit fi =20 BOTTOMTHRU=3D0 PHOTOOUTPUT=3D0 STARTVIEWER=3D0 while getopts ":spV" Option do case $Option in s ) echo "add a page with mirrored top silk on bottom layer"; BOTTO= MTHRU=3D1 ;; p ) echo "produce photorealistic image "; PHOTOOUTPUT=3D1 ;; V ) echo "automatically start viewers "; STARTVIEWER=3D1 ;; * ) echo "unknown option: \""$Option"\"" ; exit; # Default. esac done shift $(($OPTIND - 1)) # go to next argument ####################################################### PCBFILE=3D$1 NAME=3D`basename $PCBFILE .pcb` OUTPDF=3D$NAME"_layout_"`date +%F`".pdf" OUTPNG=3D$NAME"_layout_"`date +%F`".png" OUTPNG_BOTTOM=3D$NAME"_layout_bottom_"`date +%F`".png" PCB=3D/usr/local/bin/pcb PDFVIEWER=3D/usr/bin/okular PNGVIEWER=3D/usr/bin/gthumb SIZE=3D"20x30cm" PAPERSIZE=3D"A4" TMPDIR=3D/tmp/layoutdruck ## echo pcb version $PCB -V mkdir $TMPDIR ## top-refdes echo "Best=C3=BCckungsdruck Nummern, Oberseite von "$OUTPUT $PCB -x eps \ --action-string 'DISPLAY(NameOnPCB)' \ --element-color '#000000' \ --pin-color '#cccccc' \ --layer-color-1 '#cccccc' \ --layer-color-2 '#dddddd' \ --layer-color-3 '#eeeeee' \ --layer-color-4 '#cccccc' \ --layer-color-5 '#dddddd' \ --layer-color-6 '#eeeeee' \ --layer-color-7 '#555555' \ --layer-color-8 '#666666' \ --as-shown \ --only-visible \ --layer-stack "outline,comment,elements,top" \ --eps-file $TMPDIR/toprefdes.eps \ $PCBFILE poster -m$PAPERSIZE -p$SIZE -c12x12mm -o $TMPDIR/toprefdes.ps $TMPDIR/topre= fdes.eps ## top-values echo "Best=C3=BCckungsdruck Werte, Oberseite von "$OUTPUT $PCB -x eps \ --action-string 'DISPLAY(Value)' \ --element-color '#000000' \ --pin-color '#cccccc' \ --layer-color-1 '#cccccc' \ --layer-color-2 '#dddddd' \ --layer-color-3 '#eeeeee' \ --layer-color-4 '#cccccc' \ --layer-color-5 '#dddddd' \ --layer-color-6 '#eeeeee' \ --layer-color-7 '#555555' \ --layer-color-8 '#666666' \ --as-shown \ --only-visible \ --layer-stack "outline,comment,elements,top" \ --eps-file $TMPDIR"/topvalue.eps" \ $PCBFILE poster -m$PAPERSIZE -p$SIZE -c12x12mm -o $TMPDIR/topvalue.ps $TMPDIR/topval= ue.eps ## bottom-refdes echo "Best=C3=BCckungsdruck Unterseite, Nummern von "$OUTPUT $PCB -x eps \ --action-string 'DISPLAY(NameOnPCB)' \ --element-color '#000000' \ --pin-color '#cccccc' \ --layer-color-1 '#cccccc' \ --layer-color-2 '#dddddd' \ --layer-color-3 '#eeeeee' \ --layer-color-4 '#cccccc' \ --layer-color-5 '#dddddd' \ --layer-color-6 '#eeeeee' \ --layer-color-7 '#555555' \ --layer-color-8 '#666666' \ --as-shown \ --layer-stack "outline,comment,elements,bottom,solderside" \ --eps-file $TMPDIR"/bottomrefdes_tmp.eps" \ $PCBFILE ## rectify broken eps syntax: make bounding box parameters integers ## #awk -F [\ \.] ' # { # if ( $1 =3D=3D "%%BoundingBox:" ) # { print $1" "$2" "$3" "$4" "$6 } # else { print $0 } # } #' $TMPDIR"/bottomrefdes_tmp.eps" > $TMPDIR"/bottomrefdes_tmp2.eps" ## crop eps ## epstool --bbox --copy $TMPDIR"/bottomrefdes_tmp.eps" $TMPDIR"/bottomrefdes= .eps" ## make a decently sized postscript page poster -m$PAPERSIZE -p$SIZE -c12x12mm -o $TMPDIR"/bottomrefdes.ps" $TMPDIR"= /bottomrefdes.eps" ## bottom-value echo "Best=C3=BCckungsdruck Unterseite, Werte von "$OUTPUT $PCB -x eps \ --action-string 'DISPLAY(Value)' \ --element-color '#000000' \ --pin-color '#cccccc' \ --layer-color-1 '#cccccc' \ --layer-color-2 '#dddddd' \ --layer-color-3 '#eeeeee' \ --layer-color-4 '#cccccc' \ --layer-color-5 '#dddddd' \ --layer-color-6 '#eeeeee' \ --layer-color-7 '#555555' \ --layer-color-8 '#666666' \ --as-shown \ --layer-stack "outline,comment,elements,bottom,solderside" \ --eps-file $TMPDIR"/bottomvalue_tmp.eps" \ $PCBFILE ## rectify broken eps syntax: make bounding box parameters integers ## #awk -F [\ \.] ' # { # if ( $1 =3D=3D "%%BoundingBox:" ) # { print $1" "$2" "$3" "$4" "$6 } # else { print $0 } # } #' $TMPDIR"/bottomvalue_tmp.eps" > $TMPDIR"/bottomvalue_tmp2.eps" ## crop eps ## epstool --bbox --copy $TMPDIR"/bottomvalue_tmp.eps" $TMPDIR"/bottomvalue.e= ps" ## make a decently sized postscript page poster -m$PAPERSIZE -p$SIZE -c12x12mm -o $TMPDIR"/bottomvalue.ps" $TMPDIR"/= bottomvalue.eps" $PCB -x eps \ --action-string 'DISPLAY(NameOnPCB)' \ --element-color '#000000' \ --pin-color '#cccccc' \ --layer-color-1 '#cccccc' \ --layer-color-2 '#dddddd' \ --layer-color-3 '#eeeeee' \ --layer-color-4 '#cccccc' \ --layer-color-5 '#dddddd' \ --layer-color-6 '#eeeeee' \ --layer-color-7 '#555555' \ --layer-color-8 '#666666' \ --as-shown \ --mirror \ --layer-stack "elements" \ --eps-file $TMPDIR"/elements.eps" \ $PCBFILE ###### Optionally derive a see-thru of bottom with awk and tail=20 ######(very dirty hack that depends on specific layer names and layer group= s) if [ $BOTTOMTHRU =3D=3D "1" ] then=20 echo "Do bottomthru" awk '$0 =3D=3D "% Layer bottom group 1 drill 0 mask 0" { exit } \ { print }' $TMPDIR/bottomrefdes.eps > $TMPDIR/bottomthru.eps awk 'NR <=3D 22 { next } $1 =3D=3D "showpage" { exit } { print }' $TMPDIR/b= ottomrefdes.eps >> $TMPDIR/bottomthru.eps awk 'NR <=3D 21 { next } $1 =3D=3D "showpage" { exit } { print }' $TMPDIR/e= lements.eps >> $TMPDIR/bottomthru.eps tail -n 5 $TMPDIR"/elements.eps" >> $TMPDIR"/bottomthru.eps" poster -mA4 -p$SIZE -c12x12mm -o $TMPDIR"/bottomthru.ps" $TMPDIR"/bottomthr= u.eps" fi ########################################################################### if [ $BOTTOMTHRU =3D=3D "1" ]=20 then=20 PAGES=3D" \ $TMPDIR/toprefdes.ps \ $TMPDIR/bottomrefdes.ps \ $TMPDIR/topvalue.ps \ $TMPDIR/bottomvalue.ps\ $TMPDIR/bottomthru.ps" else PAGES=3D" \ $TMPDIR/toprefdes.ps \ $TMPDIR/bottomrefdes.ps \ $TMPDIR/topvalue.ps \ $TMPDIR/bottomvalue.ps" fi ## combine to a single PDF document psmerge -o$TMPDIR/out.ps $PAGES =20 ps2pdf $TMPDIR/out.ps $OUTPDF ## save the eps files for use in lyx documentation for i in $PAGES; do=20 cp $TMPDIR/`basename $i .ps`.eps $PWD/$NAME"_"`basename $i .ps`.eps done ### optionally start viewer.### if [ $STARTVIEWER =3D=3D "1" ] then $PDFVIEWER $OUTPDF fi ### photorealistic output #### if [ $PHOTOOUTPUT =3D=3D "1" ] then echo "Do a photo realistic view of the top side of the pcb" pcb -x png --photo-mode \ --dpi 600 \ --use-alpha \ --as-shown \ --only-visible \ --outfile $TMPDIR/out.png \ $PCBFILE convert $TMPDIR/out.png \ \( +clone -background black -shadow 75x20+20+20 \) +swap \ -background white \ -layers merge \ -resize 50% \ $OUTPNG echo "Do a photo realistic view of the bottom side of the pcb" pcb -x png --photo-mode \ --dpi 600 \ --use-alpha \ --as-shown \ --only-visible \ --photo-flip-x \ --outfile $TMPDIR/out.png \ $PCBFILE convert $TMPDIR/out.png \ \( +clone -background black -shadow 75x20+20+20 \) +swap \ -background white \ -layers merge \ -resize 50% \ $OUTPNG_BOTTOM ### optionally start viewer.### if [ $STARTVIEWER =3D=3D "1" ] then $PNGVIEWER $OUTPNG $OUTPNG_BOTTOM fi fi # photo realistic output exit # end of script \------------------------- --=20 Kai-Martin Knaak --Sig_/+5Fx6mQvxgyDJRMoFBRaqKD Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (GNU/Linux) iEYEARECAAYFAlGvt4oACgkQt9RkiGwLn1MGzACgkzVVV0DYjcDOjXCYJMmelQwv F2QAoJ9iHApQ9hkReatVvSsP37Y2M4Ob =vCxS -----END PGP SIGNATURE----- --Sig_/+5Fx6mQvxgyDJRMoFBRaqKD--