Thanks to Lance a problem with this recent posting was spotted
quickly. The mailer destroyed a few lines. So here it
is again with a little more preparation. It is no Smith Chart,
but should be a welcome addition to your postscript collection.
The code included isn't spectacular, so study the red book before
following my examples. This was a Saturday afternoon hack.
-AAK
--------------------cut here--------------------------------
%!
% slide_rule.ps
%
% A. Kinsman 7/31/91 (C) Copyright 1991, all rights reserved
%
% So the future generations will understand how we handled
% engineering problems without pocket calculators.
%
% Such a primitive tool to manufacture with such a sophisticated
% computer.
%
% for on glass debugging clear screen uncomment next line
%clippath 1 setgray fill 0 setgray
/Helvetica findfont 10 scalefont setfont
0 setlinewidth
/inch {72 mul} def
/scale-len 10 def % length of scales in inches
/hash-height 0 def
/hash-incr 0 def
/tag-it 0 def
/raise-5 0 def
/str 20 string def
/tags ( 123456789) def % zeros turn into blanks
% flip axis used for B&D scales
/flip-axis {
1 -1 scale
} def
% flip font used for B&D scales
/flip-font {
currentfont [ 1 0 0 -1 0 0 ] makefont setfont
} def
% flip both used for B&D scales
/flip-it {
flip-axis
flip-font
} def
% for log scales
% ( start increment end hash-height hash-incr tag-it raise-5 -- )
/hash-it
{
/raise-5 exch def
/tag-it exch def
/hash-incr exch def
/hash-height exch def
{
% draw vertical hash
dup log scale-len mul inch 0 moveto 0 hash-height inch rlineto
% extend 5 lines up a bit
raise-5 1 eq
{
dup 1000 mul cvi 1 add % round up a bit
str cvs
hash-incr log cvi 1 getinterval % ( asc-digit -- )
(5) eq { 0 hash-height .3 mul inch rlineto
}
if
}
if
% add number string
% ( num -- )
tag-it 1 eq % ( num bool -- )
{
1000 mul cvi 1 add % ( inum -- )
str cvs % ( string -- )
hash-incr log cvi 1 getinterval % ( asc-digit -- )
cvi % ( int -- )
tags exch 1 getinterval
show % ( -- )
}
{ pop }
ifelse
} for
stroke
} def
% for linear scales
% ( start increment end hash-height hash-incr tag-it raise-5 -- )
/hash-it2
{
/raise-5 exch def
/tag-it exch def
/hash-incr exch def
/hash-height exch def
{
% draw vertical hash
dup scale-len mul inch 0 moveto 0 hash-height inch rlineto
% extend 5 lines up a bit
raise-5 1 eq
{
dup 1000 mul cvi 1 add % round up a bit
str cvs
hash-incr log cvi 1 getinterval % ( asc-digit -- )
(5) eq { 0 hash-height .3 mul inch rlineto
}
if
}
if
% add number string
% ( num -- )
tag-it 1 eq % ( num bool -- )
{
1000 mul cvi 1 add % ( inum -- )
str cvs % ( string -- )
hash-incr log cvi 1 getinterval % ( asc-digit -- )
cvi % ( int -- )
tags exch 1 getinterval
(.) show
show % ( -- )
}
{ pop }
ifelse
} for
stroke
} def
% for linear scales with no labels
% ( start increment end hash-height hash-incr tag-it raise-5 -- )
/hash-it3
{
/raise-5 exch def
/tag-it exch def
/hash-incr exch def
/hash-height exch def
{
% draw vertical hash
dup scale-len mul inch 0 moveto 0 hash-height inch rlineto
} for
stroke
} def
/rule-c {
% start increment end hash-height hash-incr tag-it raise-5
1.0 1.0 10.0 0.20 1 1 0 hash-it % units
/Helvetica findfont 7 scalefont setfont
1.0 0.1 2.0 0.13 10 1 0 hash-it % 1/10ths
/Helvetica findfont 10 scalefont setfont
2.0 0.1 10.0 0.10 10 0 1 hash-it % 1/10ths
1.0 .01 2.0 0.07 100 0 1 hash-it % 1/100ths
2.0 .02 4.0 0.07 0 0 0 hash-it % 1/50ths
4.0 .05 10.0 0.07 0 0 0 hash-it % 1/20ths
} def
/rule-d {
% start increment end hash-height hash-incr tag-it raise-5
1.0 1.0 10.0 0.20 1 1 0 hash-it % units
/Helvetica findfont 7 scalefont setfont
flip-font
1.0 0.1 2.0 0.16 10 1 0 hash-it % 1/10ths
/Helvetica findfont 10 scalefont setfont
2.0 0.1 10.0 0.10 10 0 1 hash-it % 1/10ths
1.0 .01 2.0 0.07 100 0 1 hash-it % 1/100ths
2.0 .02 4.0 0.07 0 0 0 hash-it % 1/50ths
4.0 .05 10.0 0.07 0 0 0 hash-it % 1/20ths
} def
/rule-l {
% start increment end hash-height hash-incr tag-it raise-5
0.0 0.1 1.0 0.20 1 1 0 hash-it2 % units
0.0 0.05 1.0 0.15 1 0 0 hash-it3 % 1/2s
0.0 0.01 1.0 0.10 1 0 0 hash-it3 % 1/10ths
0.0 0.005 1.0 0.07 1 0 0 hash-it3 % 1/20ths
} def
/rule-ab {
% start increment end hash-height hash-incr tag-it raise-5
1.0 1.0 10.0 0.20 1 1 0 hash-it % units
1.0 0.1 10.0 0.10 10 0 1 hash-it % 1/10ths
1.0 .02 2.0 0.07 0 0 0 hash-it % 1/50ths
2.0 .05 5.0 0.07 0 0 0 hash-it % 1/20ths
} def
/rule-k {
% start increment end hash-height hash-incr tag-it raise-5
1.0 1.0 10.0 0.20 1 1 0 hash-it % units
1.0 0.1 6.0 0.10 10 0 1 hash-it % 1/10ths
1.0 .05 6.0 0.07 0 0 0 hash-it % 1/20ths
6.0 0.2 10.0 0.10 0 0 0 hash-it % 1/5ths
} def
% outlines of the device and some literals
/overlap .25 inch def % glue flap
/half-height 2.25 inch def % height of face
/draw-outline{
% boxes, and glue text etc.
0.0 inch 8.0 inch overlap add moveto
11.0 inch 8.0 inch overlap add lineto
11.0 inch 8.0 inch half-height 2 mul sub lineto
0.0 inch 8.0 inch half-height 2 mul sub lineto
closepath
stroke
% cutout area
0.5 inch 7.25 inch moveto
10.5 inch 7.25 inch lineto
10.5 inch 6.25 inch lineto
0.5 inch 6.25 inch lineto
closepath
stroke
% dotted line under glue
[5] 0 setdash
0.0 inch 8.0 inch moveto
11.0 inch 8.0 inch lineto
% dotted line between halves
0.0 inch 8.0 inch half-height sub moveto
11.0 inch 8.0 inch half-height sub lineto
stroke
[] 0 setdash
% draw slide
0.0 inch 3.0 inch moveto
11.0 inch 3.0 inch lineto
11.0 inch 3.0 inch half-height sub overlap add lineto
0.0 inch 3.0 inch half-height sub overlap add lineto
closepath
stroke
% comments
1.0 inch 7.3 inch .25 inch sub moveto
(1. Print or copy onto stiff paper.) show
1.0 inch 7.1 inch .25 inch sub moveto
(2. Fold on dotted lines.) show
1.0 inch 6.9 inch .25 inch sub moveto
(3. Cut this window out carefully.) show
1.0 inch 6.7 inch .25 inch sub moveto
(4. Glue tab back on itself, when dry, glue halves together.) show
.6 inch 8.1 inch moveto ( glue -- glue -- glue) show
5.0 inch 8.1 inch moveto ( glue -- glue -- glue) show
9.6 inch 8.1 inch moveto ( glue -- glue -- glue) show
/Helvetica findfont 8 scalefont setfont
2.1 inch 5.9 inch moveto
( (C) Copyright 1991, Andy Kinsman, P.O. Box 1457, Fairport, N.Y. 14450-1457)
show
6.25 inch 5.9 inch moveto ("Collector of Slide Rules" kin...@ssd.kodak.com)
show
/Helvetica findfont 10 scalefont setfont
} def
% Comment out next two lines for viewing on glass
9.0 inch 0.1 inch translate
90 rotate
% uncomment out one of the following for the model size you wish
%1.4 1.4 scale % debug size model
0.95 0.95 scale % 10 inch model (just wouldn't fit on 11 inch page as designed)
%.8 .8 scale % 8 inch model
%.5 .5 scale % 5 inch model
0.1 inch 0.5 inch translate
draw-outline
% C&D scales
gsave
0.5 inch 6.25 inch translate
flip-it rule-d flip-it
grestore
gsave
0.5 inch 1.50 inch translate
rule-c
grestore
% A&B scales
/scale-len 10 2 div def
gsave
0.5 inch 7.25 inch translate
rule-ab
grestore
gsave
5.5 inch 7.25 inch translate
rule-ab
grestore
gsave
0.5 inch 2.75 inch overlap sub translate
flip-it rule-ab flip-it
grestore
gsave
5.5 inch 2.75 inch overlap sub translate
flip-it rule-ab flip-it
grestore
% K scale
/scale-len 10 3 div def
gsave
0.5 inch 7.60 inch translate
rule-k
grestore
gsave
0.5 inch scale-len inch add 7.60 inch translate
rule-k
grestore
gsave
0.5 inch scale-len inch 2 mul add 7.60 inch translate
rule-k
grestore
% L scale on slide
/scale-len 10 def
gsave
0.5 inch 1.90 inch translate
rule-l
grestore
% add labels to scales
/Helvetica findfont 15 scalefont setfont
0.25 inch 7.60 inch moveto (K) show
0.25 inch 7.25 inch moveto (A) show
0.25 inch 7.05 inch moveto (B) show
0.25 inch 6.70 inch moveto (L) show
0.25 inch 6.25 inch moveto (C) show
0.25 inch 6.05 inch moveto (D) show
% add labels to slide
0.25 inch 2.30 inch moveto (B) show
0.25 inch 1.90 inch moveto (L) show
0.25 inch 1.55 inch moveto (C) show
% tables on back
/Helvetica findfont 10 scalefont setfont
4.50 inch 5.50 inch moveto (CONVERSION FACTORS) show
/Helvetica findfont 9 scalefont setfont
0.50 inch 1.67 0 mul inch add 5.25 inch moveto (LINEAR MEASURE) show
0.50 inch 1.67 1 mul inch add 5.25 inch moveto ( AREA MEASURE ) show
0.50 inch 1.67 2 mul inch add 5.25 inch moveto (VOLUME MEASURE) show
0.50 inch 1.67 3 mul inch add 5.25 inch moveto ( WEIGHT ) show
0.50 inch 1.67 4 mul inch add 5.25 inch moveto (ENERGY - WORK ) show
0.50 inch 1.67 5 mul inch add 5.25 inch moveto ( PRESSURE ) show
/Helvetica findfont 8 scalefont setfont
% column 0
0.50 inch 1.67 0 mul inch add 5.00 inch moveto (1 inch = 2.54 cm ) show
0.50 inch 1.67 0 mul inch add 4.75 inch moveto (1 foot = 0.3048 m) show
0.50 inch 1.67 0 mul inch add 4.50 inch moveto (1 yard = 0.9144 m) show
0.50 inch 1.67 0 mul inch add 4.25 inch moveto (1 mile = 1.609 km) show
0.50 inch 1.67 0 mul inch add 4.00 inch moveto (1 mile = 5280 ft ) show
0.50 inch 1.67 0 mul inch add 3.75 inch moveto (1 naut.mile = 1.152 mi.) show
% column 1
0.50 inch 1.67 1 mul inch add 5.00 inch moveto (1 sq inch = 6.452 cm2) show
0.50 inch 1.67 1 mul inch add 4.75 inch moveto (1 sq foot = 0.0929 m2) show
0.50 inch 1.67 1 mul inch add 4.50 inch moveto (1 sq yard = 0.8361 m2) show
0.50 inch 1.67 1 mul inch add 4.25 inch moveto (1 sq mile = 2.59 km2) show
0.50 inch 1.67 1 mul inch add 4.00 inch moveto (1 sq mile = 640 acres) show
0.50 inch 1.67 1 mul inch add 3.75 inch moveto (1 acre = 43,560 sq ft) show
% column 2
0.50 inch 1.67 2 mul inch add 5.00 inch moveto (1 cu inch = 16.39 cm3) show
0.50 inch 1.67 2 mul inch add 4.75 inch moveto (1 cu foot = 0.0283 m3) show
0.50 inch 1.67 2 mul inch add 4.50 inch moveto (1 cu yard = 0.7646 m3) show
0.50 inch 1.67 2 mul inch add 4.25 inch moveto (1 U.S. gallon = 3.785 liter) show
0.50 inch 1.67 2 mul inch add 4.00 inch moveto (1 U.S. gallon = 231 cu in.) show
0.50 inch 1.67 2 mul inch add 3.75 inch moveto (1 cu foot = 28.32 liter) show
% column 3
0.50 inch 1.67 3 mul inch add 5.00 inch moveto (1 Pound = 0.4536 kg) show
0.50 inch 1.67 3 mul inch add 4.75 inch moveto (1 Grain = 0.0648 g) show
0.50 inch 1.67 3 mul inch add 4.50 inch moveto (1 U.S. gallon = 8.345 lb) show
0.50 inch 1.67 3 mul inch add 4.25 inch moveto (1 cu foot of water = 62.43 lb) show
% column 4
0.50 inch 1.67 4 mul inch add 5.00 inch moveto (1 Btu = 778 ft-lb) show
0.50 inch 1.67 4 mul inch add 4.75 inch moveto (1 hp = 0.707 Btu/sec) show
0.50 inch 1.67 4 mul inch add 4.50 inch moveto (1 hp = 550 ft-lb/sec) show
0.50 inch 1.67 4 mul inch add 4.25 inch moveto (1 hp = 0.746 kw) show
% column 5
0.50 inch 1.67 5 mul inch add 5.00 inch moveto (1 atm = 14.7 psi) show
0.50 inch 1.67 5 mul inch add 4.75 inch moveto (1 ft of water = 0.4335 psi) show
0.50 inch 1.67 5 mul inch add 4.50 inch moveto (1 in. of mercury = 0.4912 psi) show
0.50 inch 1.67 5 mul inch add 4.25 inch moveto (1 in. of mercury = 1.133 ft of water) show
0.50 inch 1.67 5 mul inch add 4.00 inch moveto (1 in. of mercury = 780 ft of air) show
% add pi to the C scale
/Symbol findfont 8 scalefont setfont
5.47 inch 1.62 inch moveto 0 .05 inch rlineto stroke
5.47 inch 1.70 inch moveto (\160) show
% add pi to the D scale
5.47 inch 6.14 inch moveto 0 -.05 inch rlineto stroke
5.47 inch 6.02 inch moveto (\160) show
% doctor the log scale, replacing first .1 with a .0
% and last .1 with a 1.0
/Helvetica findfont 10 scalefont setfont
1 setgray
0.5 inch 1.90 inch .20 inch add moveto (.1) show
0 setgray
0.5 inch 1.90 inch .20 inch add moveto (.0) show
1 setgray
10.5 inch 1.90 inch .20 inch add moveto (.1) show
0 setgray
10.4 inch 1.90 inch .20 inch add moveto (1.0) show
showpage