1 Locations, angles, etc.
3 Key type is a `loc', which is a named location (absolute, 2D) and
4 direction (at the location). Angles are generally positive
5 anticlockwise; bearings are angles measured from East. The origin is
11 -<identifier> reverse the sense (ie, 180 degrees off)
13 <identifier> simply the named location
14 -<identifier> reverse the sense (ie, 180 degrees off)
15 O![-]<identifier> the location from the specified object
16 in whatever coordinate system that object
18 ^O![-]<identifier> the same, but the object is flipped
19 N-S first (see `part' and `objflip')
20 Quantity (length/angle)
22 Angle units: d (degrees,default) r (radians)
23 Length units: mm (default) cm m
24 Identifiers (of locs and objects) start with lc letter, then
25 alphanums and underscores
30 Defines loc P given coordinates (distances) and absolute bearing
33 Defines loc T: start at loc F, go forward L, translate right R,
34 turn left A (defaults are all 0).
37 K is layer kind (letters and `_', may be empty), L is a layer depth
38 (digits, or `=' meaning current layer; default for L is `='; default
39 KL at start of file is `layer 5'). Controls drawing style, by
40 selecting appropriate parts of the track and locs to draw, according
41 to element selection rules. Default outcomes:
42 K L result (description) result (element letters)
44 empty current default track RLMNasco
45 `s' current nothing (`silent') -
46 `l' current centrelines only CLMNarso
47 other current everything ARSCLMNO
49 extend F T len L [R] length L
50 extend F T upto U [R] s.t. perpendicular at T passes through U
51 extend F T ang A R subtending directionally A
52 extend F T uptoang A R s.t. direction at T is A
53 extend F T parallel U R s.t. direction at T is same as at U
54 Draws an arc or line from loc F, defining the other end as loc T.
55 If length R specified, draws an arc of radius R; R +ve curves to the
56 right; R -ve to the left.
59 Joins one existing loc, F, to another, T. F's direction points to
60 the new track; T's away - ie the added track leaves F in F's
61 direction and arrives at T in T's direction. R is the minimum curve
62 radius allowed. S selects from the available solutions, and may be
64 long prefer longer length solution
65 short prefer shorter length solution
66 right|left prefer mostly bending to the left resp. right
67 beginright|beginleft prefer first bend to the right
68 endright|endleft prefer final bend to the right
69 [!]twoarcs prefer [not] two circular arcs of equal radius
70 [!]arcline prefer [not] one line and an arc of max radius
71 [!]arcsline prefer [not] line between two arcs of min radius
72 if this doesn't resolve, will pick the shortest.
77 Defines the object or part O. Inside the definition, the commands
78 do not draw when the object is being defined. The object has its
79 own coordinate space and its own location namespace. `defpart'
80 defines a `part', which is like an object except that:
81 * showlibrary lists only parts, not objects
82 * the -e and -E command line options distinguish parts and objects
84 part N [^]O [F [A]] [FR AR ...]
86 Places an instance of object or part O. The loc defined inside O as
87 F (`formal parameter', F must be just <identifier>) is placed at
88 existing loc A (`actual parameter').
90 Both objects (defined with defobj) and parts (defined with defpart)
91 may be placed with either command ! Whether it's a part or an obj
92 depends on the definition, not on the use - the use is just
93 different syntaxes for the same kind of operation, and where the
94 features offered by both `part' and `obj[flip]' overlap the
95 behaviour is identical.
97 If `part N ^O' or `objflip' is used, rather than `part N O' or
98 `obj', then the object is placed with object-space y coordinates
99 negated (ie, it is mirrored so that the object's North exchanges
102 For `part', each FR (`formal result') and AR (`actual result')
103 specifies that the loc FR inside O is exported into the global
104 namespace as a new loc AR. Either FR or AR may start with `-'.
105 Also, each loc L inside O is exported into the global namespace as a
106 new loc N_L (unless N_L already exists). If A is not specified then
109 For `obj[flip]' if prefix P (syntax is that of an identifier) is
110 specified, each other loc L inside O is exported into the global
111 namespace as a new loc PL (unless PL already exists). P may be `='
112 to indicate an empty prefix (default is not to export locs).
116 -D turn on debug (level 1) } currently only debug levels are
117 -Dnnn set debug level to nnn } 0 (none) and 1 (some), default=0
119 -lL output for layer L (digits, or `*' for any) (default: *)
121 -e<layersel>[ARSCcLlMNOm]...
122 Turn on and off drawing of elements in groups.
123 These are abbreviations for various -E... options.
127 S rails and sleepers only aRSc
128 C centrelines only arsC
129 c swept area and ticks only Arsc
131 L label top-level locs (turns on bars for them too) LM
132 l do not label any locs l
133 bars at locs (thick lines perp to track dir'n)
134 M bars for top-level locs only Mno
135 N bars for top-level locs and those in obj's MNo
136 O bars for everything, including those inside parts MNO
137 m no bars (turns off labelling too) mnol
139 -E<layersel>[ARSCLMNOarsclmno]...
140 enable (capitals) or disable (lowercase) drawing of
142 A draw track swept area, with ticks
144 S draw track sleepers
145 C draw track centrelines
147 M mark locs with a bar
148 N mark locs with a bar in objs
149 O mark locs with a bar in parts
151 -q quiet: do not print info to stderr
152 (default: prints bounding box, at the moment)
154 <layersel> (for -e and -E) works as follows:
156 When file says `layer KL', default drawing element set is set
157 depending on K and L (see description of `layer' command), using last
158 specified -l layer. Then all -e/-E options are scanned, in order,
159 and each one that matches modifies the drawing element set.
161 <layersel> is GN[D][C][V]. It matches `layer KL' iff the glob
162 pattern G (which may be empty) matches the whole of K, and layer
163 restriction N[D]C matches L. C is several identical `=', `+' or `-';
164 D+ matches L iff L>=D; D++ iff L>D; D+++ iff L>D+1 and so on; D-
165 matches L iff L<=D; D-- iff L<D; etc.; D= matches L iff L==D; D== iff
166 D-1<=L<=D+1; D=== iff D-2<=L<=D+2; etc. If D is omitted the current
167 layer (from the most recent -l option) is used (or `5' if current
168 layer is `*'). N may be empty or `~'; the latter simply inverts the
169 sense of the match. If C is omitted then `=' is assumed. If the
170 final output layer is `*' then we pretend, for the moment, that L was
173 If V is present then C must be exactly one character and it is as if
174 V (must be an integer) copies of C were specified.
177 Special comments in PostScript:
180 a command C with args A is read for execution in scope S
182 point L in scope S has coords X Y and angle A
183 %L bbox width W (L..R)
184 %L bbox height H (B..T)
185 bounding box, giving width W, height H, left L, right R,
186 bottom B and top T. Includes full swept area of track,
187 but only at locs (so curves which bend outside bounding
188 box don't get counted)
189 %L bbox no locs, no bbox
190 there were no locs, so there is no bounding box
191 usu because input file was just obj defns and showlibrary
194 O! when defining object or part O
195 N:T scope T but inside part (introduced with `part') N } when
196 O::T scope T but inside obj (introduced with `obj[flip]') O } placing