Date:	Wed, 11 Aug 1993 02:53:54 -1000
From:	jkn@ohm.york.ac.uk (John K Nicoll)
Message-Id: <1993Aug11.125354.9520@ohm.york.ac.uk>
Organization: Electronics Department, University of York, UK
Subject: PostScript program for making template paper

Here is a little PostScript program for printing out sheets marked
like graph paper. By commenting out one or another line, it will
print in imperial units (inch, half and quarter inch), or metric (cm
and 5mm), both horizontally and vertically. I use it with scrap
paper to generate pattern paper for templates etc, and thought it
might be useful to others.

Don't bother to flame me about the quality of the PostScript code -
I know! I wrote it a while ago.

	jon N

PS for the uninitiated: the file begins with the two characters '%!'

%!PS-Adobe-2.0
%%Title:GRID.PS
%%Creator: jon nicoll (j^n), jkn@ohn.york.ac.uk
%%EndComments

% Comment out (by putting a percent '%' at the beginning)
% one only of the following two lines:
%/inchgrid true def % leave uncommented for inch grid
/inchgrid false def % leave uncommented for centimetre grid

% put your desired no. of copies here
/ncopies 1 def

/M { %def
	transform
	round exch round exch
	itransform
	moveto
	} bind def
	
/L { %def
	transform
	round exch round exch
	itransform
	lineto
	} bind def

%EndProlog

/mm {72 mul 25.4 div } bind def
/in. {72 mul } bind def

inchgrid {

gsave
	0.75 setlinewidth
	0 1 12 { %for
		0.25 in. 0.25 in. M 8 in. 0.25 in. L
		pop 0 1 in. translate
		stroke
		} bind for
grestore
gsave
	0.5 setlinewidth
	0 1 12 { %for
		0.25 in. 0.75 in. M 8 in. 0.75 in. L
		pop 0 1 in. translate
		stroke
		} bind for
grestore
gsave
	0.25 setlinewidth
	0 1 12 { %for
		0.25 in. 0.5 in. M 8 in. 0.5 in. L
		stroke
		0.25 in. 1 in. M 8 in. 1 in. L
		stroke
		pop 0 1 in. translate
		} bind for
grestore
% vertical lines
gsave
	0.75 setlinewidth
	0 1 8 { %for
		0.25 in. 0.25 in. M 0.25 in. 12 in. L
		stroke
		pop 1 in. 0 translate
		} bind for
grestore
gsave
	0.5 setlinewidth
	0 1 8 { %for
		0.75 in. 0.25 in. M 0.75 in. 12 in. L
		stroke
		pop 1 in. 0 translate
		} bind for
grestore
gsave
	0.25 setlinewidth
	0 1 8 { %for
		0.5 in. 0.25 in. M 0.5 in. 12 in. L
		stroke
		1 in. 0.25 in. M 1 in. 12 in. L
		stroke
		pop 1 in. 0 translate
		} bind for
grestore
}
{ %cm grid
gsave
	0.5 setlinewidth
	0 1 30 { %for
		5 mm 5 mm M 210 mm 5 mm L
		pop 0 10 mm translate
		stroke
		} bind for
grestore
gsave
	0.25 setlinewidth
	0 1 30 { %for
		5 mm 10 mm M 210 mm 10 mm L
		pop 0 10 mm translate
		stroke
		} bind for
grestore
% vertical lines
gsave
	0.5 setlinewidth
	0 1 21 { %for
		5 mm 5 mm M 5 mm 300 mm L
		stroke
		pop 10 mm 0 translate
		} bind for
grestore
gsave
	0.25 setlinewidth
	0 1 21 { %for
		10 mm 5 mm M 10 mm 300 mm L
		stroke
		pop 10 mm 0 translate
		} bind for
grestore

} ifelse

/#copies ncopies def
showpage
%%Trailer

-- 
john nicoll (jkn@ohm.york.ac.uk)
Department of Electronics  University of York
Heslington   YORK YO1 5DD U.K
Tel +44 (904) 433221   Fax +44 (904) 433222

