Re: gEDA-user: current working file name in gschemrc
Vladimir Zhbanov wrote: One problem I noticed before is no way to reprint all .eps-files from command line, that is from Makefile also. ack. A way to recursively print all schematics in a hierarchy is missing in the bag of features. ---)kaimartin(--- -- Kai-Martin Knaak tel: +49-511-762-2895 Universität Hannover, Inst. für Quantenoptik fax: +49-511-762-2211 Welfengarten 1, 30167 Hannover http://www.iqo.uni-hannover.de GPG key:http://pgp.mit.edu:11371/pks/lookup?search=Knaak+kmkop=get ___ geda-user mailing list geda-user@moria.seul.org http://www.seul.org/cgi-bin/mailman/listinfo/geda-user
Re: gEDA-user: current working file name in gschemrc
On Thu, Nov 25, 2010 at 11:50:36PM +0100, kai-martin knaak wrote: Vladimir Zhbanov wrote: It would be nice to have the same way to make EPS too. What if you need to make LaTeX files with images This is what I use the PDF output for :-) Last I used latex rather than pdflatex must have been about 2005... which should have the same scale? Good point. In addition to various paper sizes the PDF output should offer a fixed scaling. In this case the size of the output should be set automatically. I know no way to do this without GUI. BTW, how do you set the scale in the GUI? In gschem you use File-Write image... and choose 'Encapsulated Postscript' as output format. Then all your .eps-files have right %%BoundingBox lines within them which specify the figures sizes. Further you can do some calculations. 1000 gschem points (g.p.) = 72 Adobe dots. Adobe Postscript format uses internally 72 dpi (AFAIK). Thus: 1000 g.p. in gschem are equal to 1 inch on a paper. This is fixed. If you want to have then different scaling, e.g. 100 g.p. = 2.5 mm (1000 g.p. = 25 mm), you can use scale factor as follows: factor = 25 mm / 1 inch = 25 mm / 25.4 mm = .984 (BTW, it's handy to have such scale factor which is good for printing of default gschem symbols in metric sizes with almost no difference in appearance.) To apply this scaling to the figures used in latex you could use a standard way: \begin{figure}\includegraphics[scale=.984]{example.eps}\end{figure} Note the 'scale' option here. If you have to reduce all your figures 2 times you can use just [scale=.492] (i.e. 0.984/2) and so on. BTW, last time I read gschem FAQ there was error there: '\begin{image} ... \end{image}' instead of '\begin{figure} ... \end{figure}'. One problem I noticed before is no way to reprint all .eps-files from command line, that is from Makefile also. Best regards. -- vzh ___ geda-user mailing list geda-user@moria.seul.org http://www.seul.org/cgi-bin/mailman/listinfo/geda-user
Re: gEDA-user: current working file name in gschemrc
On Wed, Nov 24, 2010 at 03:42:31AM +0100, kai-martin knaak wrote: John Doty wrote: S2PS=gschem -p -o $@ -s print.scm $ Thanks! I completely missed the existence of that simple scheme script. I wasn't even aware of the possibility to do this kind of scripting. You can call me stupid, now... There is a similar image.scm one for PNG output, too :-) ---)kaimartin(--- That way you solve only one part of the problem. It would be nice to have the same way to make EPS too. What if you need to make LaTeX files with images which should have the same scale? I know no way to do this without GUI. And if I have to change only one library symbol in a document with thirty figures which all have this symbol included, and have to reprint them all to EPS format, it is a disaster. -- vzh ___ geda-user mailing list geda-user@moria.seul.org http://www.seul.org/cgi-bin/mailman/listinfo/geda-user
Re: gEDA-user: current working file name in gschemrc
Vladimir Zhbanov wrote: It would be nice to have the same way to make EPS too. What if you need to make LaTeX files with images This is what I use the PDF output for :-) Last I used latex rather than pdflatex must have been about 2005... which should have the same scale? Good point. In addition to various paper sizes the PDF output should offer a fixed scaling. In this case the size of the output should be set automatically. I know no way to do this without GUI. BTW, how do you set the scale in the GUI? ---)kaimartin(--- -- Kai-Martin Knaak Öffentlicher PGP-Schlüssel: http://pgp.mit.edu:11371/pks/lookup?op=getsearch=0x6C0B9F53 ___ geda-user mailing list geda-user@moria.seul.org http://www.seul.org/cgi-bin/mailman/listinfo/geda-user
Re: gEDA-user: current working file name in gschemrc
Peter Brett wrote: What is the prupose of ~A in this line? It's a Scheme format specifier. I think in this case I will invite you to RTF Guile Manual, since it explains the operation of the 'format' function quite well. :-) http://www.gnu.org/software/guile/manual/html_node/Writing.html#index-simple_002dformat-2052 Ok, I get a faint idea, what is going on. Now, I got stuck with the next step: Copy the pdf produced by cups-pdf in $HOME/PDF to the working directory of the current project. Seems like adding bash commands to the print command works. E.g. lp -d PDF -t mosfet-node; echo foobar or even lp -d PDF -t mosfet-node; ls -l $HOME Output is on stdout. The dot expands correctly to the current working directory. But if I try to access the produced pdf file with lp -d PDF -t mosfet-node; mv $HOME/PDF/mosfet-node.pdf . the second command seems to act on the state before the print command. If there was no PDF file before, I get: mv: cannot stat `/home/kmk/mosfet-node.pdf': No such file or directory If there was such a file, then this file gets copied rather then the newly produced one. It acts, as if the shell that executes the command string does not wait for the lp command to terminate before it proceeds with the mv. Is there anything I can do about this? What kind of shell is the command string executed by? ---)kaimartin(--- -- Kai-Martin Knaak tel: +49-511-762-2895 Universität Hannover, Inst. für Quantenoptik fax: +49-511-762-2211 Welfengarten 1, 30167 Hannover http://www.iqo.uni-hannover.de GPG key:http://pgp.mit.edu:11371/pks/lookup?search=Knaak+kmkop=get ___ geda-user mailing list geda-user@moria.seul.org http://www.seul.org/cgi-bin/mailman/listinfo/geda-user
Re: gEDA-user: current working file name in gschemrc
(Apologies for top-posting) Postscript is passed to the standard input of the print command, which is run using popen(). It uses the default shell 'sh' to run the command. I think that the sort of behaviour you're looking for might be best achieved by writing some sort of wrapper program that accepts Postscript on stdin and a destination filename as its argument. Peter -- Peter Brett pe...@peter-b.co.uk Remote Sensing Research Group Surrey Space Centre - Original message - Now, I got stuck with the next step: Copy the pdf produced by cups-pdf in $HOME/PDF to the working directory of the current project. Seems like adding bash commands to the print command works. E.g. lp -d PDF -t mosfet-node; echo foobar or even lp -d PDF -t mosfet-node; ls -l $HOME Output is on stdout. The dot expands correctly to the current working directory. But if I try to access the produced pdf file with lp -d PDF -t mosfet-node; mv $HOME/PDF/mosfet-node.pdf . the second command seems to act on the state before the print command. If there was no PDF file before, I get: mv: cannot stat `/home/kmk/mosfet-node.pdf': No such file or directory If there was such a file, then this file gets copied rather then the newly produced one. It acts, as if the shell that executes the command string does not wait for the lp command to terminate before it proceeds with the mv. Is there anything I can do about this? What kind of shell is the command string executed by? ___ geda-user mailing list geda-user@moria.seul.org http://www.seul.org/cgi-bin/mailman/listinfo/geda-user
Re: gEDA-user: current working file name in gschemrc
Kai-Martin Knaak kn...@iqo.uni-hannover.de writes: But if I try to access the produced pdf file with lp -d PDF -t mosfet-node; mv $HOME/PDF/mosfet-node.pdf . the second command seems to act on the state before the print command. If there was no PDF file before, I get: mv: cannot stat `/home/kmk/mosfet-node.pdf': No such file or directory If there was such a file, then this file gets copied rather then the newly produced one. It acts, as if the shell that executes the command string does not wait for the lp command to terminate before it proceeds with the mv. The lp terminates, but the printer spooler did not finish the job. A sleep may help. Why don't you print from gschem directly into a ps file, and ps2pdf the result? Is there anything I can do about this? What kind of shell is the command string executed by? ---)kaimartin(--- -- Stephan Böttcher FAX: +49-431-880-3968 Extraterrestrische PhysikTel: +49-431-880-2508 I.f.Exp.u.Angew.Physik mailto:boettc...@physik.uni-kiel.de Leibnizstr. 11, 24118 Kiel, Germany ___ geda-user mailing list geda-user@moria.seul.org http://www.seul.org/cgi-bin/mailman/listinfo/geda-user
Re: gEDA-user: current working file name in gschemrc
On Nov 23, 2010, at 6:20 AM, Kai-Martin Knaak wrote: Still, I'd like to have a one touch PDF output. Or, even better, non-GUI printing from a script. The following Makefile rules do the job for me, using the print.scm distributed with gEDA. S2PS=gschem -p -o $@ -s print.scm $ PS2PDF=ps2pdf -sPAPERSIZE=a4 %.sym.ps : %.sym $(S2PS) %.ps : %.sch $(S2PS) %.pdf : %.ps $(PS2PDF) $ With these in a Makefile, all you have to do to turn whatever.sch to whatever.pdf is execute make whatever.pdf. John Doty Noqsi Aerospace, Ltd. http://www.noqsi.com/ j...@noqsi.com ___ geda-user mailing list geda-user@moria.seul.org http://www.seul.org/cgi-bin/mailman/listinfo/geda-user
Re: gEDA-user: current working file name in gschemrc
John Doty wrote: S2PS=gschem -p -o $@ -s print.scm $ Thanks! I completely missed the existence of that simple scheme script. I wasn't even aware of the possibility to do this kind of scripting. You can call me stupid, now... There is a similar image.scm one for PNG output, too :-) ---)kaimartin(--- ___ geda-user mailing list geda-user@moria.seul.org http://www.seul.org/cgi-bin/mailman/listinfo/geda-user
Re: gEDA-user: current working file name in gschemrc
Peter TB Brett wrote: (define %file-print file-print) (define (file-print) (print-command (format #f lp -d PDF -t \~A\ (get-selected-filename))) (gschem-use-rc-values) (%file-print)) It is horrible and nasty, but it seems to work. It does work! How does it work? By replacing an internal gschem script? I modified the print command line a bit to get the file name rather than the complete path: (print-command (format #f lp -d PDF -t \~A\ (basename (get-selected-filename) .sch))) What is the prupose of ~A in this line? ---)kaimartin(--- -- Kai-Martin Knaak Öffentlicher PGP-Schlüssel: http://pgp.mit.edu:11371/pks/lookup?op=getsearch=0x6C0B9F53 ___ geda-user mailing list geda-user@moria.seul.org http://www.seul.org/cgi-bin/mailman/listinfo/geda-user
Re: gEDA-user: current working file name in gschemrc
John Doty wrote: What's the current schematic at gschem startup, when gschemrc is executed? The one given on the command line? Anyway, for the purpose of the print command, the expression should be evaluated when the print dialog is brought up, not at the start of the session. The gschemrc lines provided by Peter P. do this. --)kaimartin(-- -- Kai-Martin Knaak Öffentlicher PGP-Schlüssel: http://pgp.mit.edu:11371/pks/lookup?op=getsearch=0x6C0B9F53 ___ geda-user mailing list geda-user@moria.seul.org http://www.seul.org/cgi-bin/mailman/listinfo/geda-user
Re: gEDA-user: current working file name in gschemrc
It does work! How does it work? By replacing an internal gschem script? Essentially, yes. What is the prupose of ~A in this line? It's a Scheme format specifier. I think in this case I will invite you to RTF Guile Manual, since it explains the operation of the 'format' function quite well. :-) http://www.gnu.org/software/guile/manual/html_node/Writing.html#index-simple_002dformat-2052 Peter -- Peter Brett pe...@peter-b.co.uk Remote Sensing Research Group Surrey Space Centre ___ geda-user mailing list geda-user@moria.seul.org http://www.seul.org/cgi-bin/mailman/listinfo/geda-user
gEDA-user: current working file name in gschemrc
Currently, my print command in gschemrc is (print-command lp -d PDF) This prints a PDF of the current schematic via cups-pdf. The PDF file appears in $HOME/PDF/ as job_1296-untitled_document.pdf I'd like to replace this with the name of the schematic. The lp command can set the base name of the file with the option -t. But how would I teach gschemrc to automatically fill in the file name of the current schematic? Is there some way to access the file name like this: (print-command lp -d PDF -t $CURRENTFILENAME) ---)kaimartin(--- -- Kai-Martin Knaak tel: +49-511-762-2895 Universität Hannover, Inst. für Quantenoptik fax: +49-511-762-2211 Welfengarten 1, 30167 Hannover http://www.iqo.uni-hannover.de GPG key:http://pgp.mit.edu:11371/pks/lookup?search=Knaak+kmkop=get ___ geda-user mailing list geda-user@moria.seul.org http://www.seul.org/cgi-bin/mailman/listinfo/geda-user
Re: gEDA-user: current working file name in gschemrc
Paul Tan wrote: (get-selected-filename) is a Gschem Scheme procedure which returns the current page filename as string. Unfortunately, my gschem segfaults right away, if gschemrc contains the (get-selected-filename) procedure. It segfaults even if the line is reduced to (define name (get-selected-filename)) ---)kaimartin(--- -- Kai-Martin Knaak Öffentlicher PGP-Schlüssel: http://pgp.mit.edu:11371/pks/lookup?op=getsearch=0x6C0B9F53 ___ geda-user mailing list geda-user@moria.seul.org http://www.seul.org/cgi-bin/mailman/listinfo/geda-user
Re: gEDA-user: current working file name in gschemrc
On 11/19/2010 07:18 PM, kai-martin knaak wrote: Paul Tan wrote: (get-selected-filename) is a Gschem Scheme procedure which returns the current page filename as string. Unfortunately, my gschem segfaults right away, if gschemrc contains the (get-selected-filename) procedure. It segfaults even if the line is reduced to (define name (get-selected-filename)) Well, it shouldn't segfault, but I'm not surprised you can't evaluate it in gschemrc before there is a selected file. What did you expect to happen? ___ geda-user mailing list geda-user@moria.seul.org http://www.seul.org/cgi-bin/mailman/listinfo/geda-user
Re: gEDA-user: current working file name in gschemrc
Hi Kai-Martin Knaak, Oh, I remember there is a bug in the gschem/src/g_funcs.c file. You may want to change the get_selected_filename function in g_funcs.c file, (around line number 299), as follows: /* = */ SCM get_selected_filename(GSCHEM_TOPLEVEL *w_current) { gchar* s; /* Added */ SCM return_value; exit_if_null(w_current); s = g_strdup(w_current-toplevel-page_current-page_filename); /* Changed */ return_value = scm_makfrom0str (s); /* Changed */ g_free (s); /* Added */ return return_value;/* Changed */ } /* = */ The above change made the (get_selected_filename) work for me. Hope it helps. Best Regards, Paul Tan ___ geda-user mailing list geda-user@moria.seul.org http://www.seul.org/cgi-bin/mailman/listinfo/geda-user
Re: gEDA-user: current working file name in gschemrc
Hi Kai-Martin Knaak, (depending on your email system, some lines in the code below may be just a long single line. So I am re-sending with the fix for this. Hope it comes out ok now) Oh, I remember there is a bug in the gschem/src/g_funcs.c file. You may want to change the get_selected_filename function in g_funcs.c file, around line number 299, as follows: /* = */ SCM get_selected_filename(GSCHEM_TOPLEVEL *w_current) { gchar* s; /* Added */ SCM return_value; exit_if_null(w_current); s = g_strdup(w_current-toplevel-page_current-page_filename); /* Changed */ return_value = scm_makfrom0str (s); /* Changed */ g_free (s); /* Added */ return return_value;/* Changed */ } /* = */ The above change made the (get_selected_filename) work for me. Hope it helps. Best Regards, Paul Tan ___ geda-user mailing list geda-user@moria.seul.org http://www.seul.org/cgi-bin/mailman/listinfo/geda-user
Re: gEDA-user: current working file name in gschemrc
John Doty wrote: Well, it shouldn't segfault, but I'm not surprised you can't evaluate it in gschemrc before there is a selected file. What did you expect to happen? From the doxygen comment: * This function gets the whole filename of the current schematic. * Specifically, the Bpage_filename/B of the current page. ---)kaimartin(--- -- Kai-Martin Knaak Öffentlicher PGP-Schlüssel: http://pgp.mit.edu:11371/pks/lookup?op=getsearch=0x6C0B9F53 ___ geda-user mailing list geda-user@moria.seul.org http://www.seul.org/cgi-bin/mailman/listinfo/geda-user
Re: gEDA-user: current working file name in gschemrc
Paul Tan wrote: Hope it helps. I still get segfaults. My get_selected_filename procedure looks like this now: /--- SCM get_selected_filename(GSCHEM_TOPLEVEL *w_current) { gchar* s; SCM return_value; exit_if_null(w_current); s = g_strdup(w_current-toplevel-page_current-page_filename); return_value = scm_makfrom0str (s); g_free (s); return (return_value); } \ ---)kaimartin( -- Kai-Martin Knaak Öffentlicher PGP-Schlüssel: http://pgp.mit.edu:11371/pks/lookup?op=getsearch=0x6C0B9F53 ___ geda-user mailing list geda-user@moria.seul.org http://www.seul.org/cgi-bin/mailman/listinfo/geda-user
Re: gEDA-user: current working file name in gschemrc
On 11/19/2010 08:59 PM, kai-martin knaak wrote: John Doty wrote: Well, it shouldn't segfault, but I'm not surprised you can't evaluate it in gschemrc before there is a selected file. What did you expect to happen? From the doxygen comment: * This function gets the whole filename of the current schematic. What's the current schematic at gschem startup, when gschemrc is executed? * Specifically, theBpage_filename/B of the current page. ---)kaimartin(--- ___ geda-user mailing list geda-user@moria.seul.org http://www.seul.org/cgi-bin/mailman/listinfo/geda-user
Re: gEDA-user: current working file name in gschemrc
On Friday 19 November 2010 12:22:05 Kai-Martin Knaak wrote: I'd like to replace this with the name of the schematic. The lp command can set the base name of the file with the option -t. But how would I teach gschemrc to automatically fill in the file name of the current schematic? Is there some way to access the file name like this: (print-command lp -d PDF -t $CURRENTFILENAME) Hi Kai-Martin, You will be pleased to hear that this is doable without my Scheme API branch. But everything Paul Tan has told you so far has been wrong. :-( What we're going to do is to override the Scheme function that is called to show the print window, so that it first resets the print-command with the filename of the current file. You'll need to add the following to your gschemrc: (define %file-print file-print) (define (file-print) (print-command (format #f lp -d PDF -t \~A\ (get-selected-filename))) (gschem-use-rc-values) (%file-print)) It is horrible and nasty, but it seems to work. Regards, Peter -- Peter Brett pe...@peter-b.co.uk Remote Sensing Research Group Surrey Space Centre signature.asc Description: This is a digitally signed message part. ___ geda-user mailing list geda-user@moria.seul.org http://www.seul.org/cgi-bin/mailman/listinfo/geda-user