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 [!]loop prefer [not] loop (arcsline, arc of same sense)
73 [!]cross prefer [not] cross (arcsline 2 senses, or twoarcs)
74 if this doesn't resolve, will pick the shortest.
79 Defines the object or part O. Inside the definition, the commands
80 do not draw when the object is being defined. The object has its
81 own coordinate space and its own location namespace. `defpart'
82 defines a `part', which is like an object except that:
83 * showlibrary lists only parts, not objects
84 * the -e and -E command line options distinguish parts and objects
86 part N [^]O [F [A]] [FR AR ...]
88 Places an instance of object or part O. The loc defined inside O as
89 F (`formal parameter', F must be just <identifier>) is placed at
90 existing loc A (`actual parameter').
92 Both objects (defined with defobj) and parts (defined with defpart)
93 may be placed with either command ! Whether it's a part or an obj
94 depends on the definition, not on the use - the use is just
95 different syntaxes for the same kind of operation, and where the
96 features offered by both `part' and `obj[flip]' overlap the
97 behaviour is identical.
99 If `part N ^O' or `objflip' is used, rather than `part N O' or
100 `obj', then the object is placed with object-space y coordinates
101 negated (ie, it is mirrored so that the object's North exchanges
104 For `part', each FR (`formal result') and AR (`actual result')
105 specifies that the loc FR inside O is exported into the global
106 namespace as a new loc AR. Either FR or AR may start with `-'.
107 Also, each loc L inside O is exported into the global namespace as a
108 new loc N_L (unless N_L already exists). If A is not specified then
111 For `obj[flip]' if prefix P (syntax is that of an identifier) is
112 specified, each other loc L inside O is exported into the global
113 namespace as a new loc PL (unless PL already exists). P may be `='
114 to indicate an empty prefix (default is not to export locs).
118 -D turn on debug (level 1) } currently only debug levels are
119 -Dnnn set debug level to nnn } 0 (none) and 1 (some), default=0
121 -lL output for layer L (digits, or `*' for any) (default: *)
123 -e<layersel>[ARSCcLlMNOm]...
124 Turn on and off drawing of elements in groups.
125 These are abbreviations for various -E... options.
129 S rails and sleepers only aRSc
130 C centrelines only arsC
131 c swept area and ticks only Arsc
132 r no lines drawn at all arcs
134 L label top-level locs (turns on bars for them too) LM
135 l do not label any locs l
136 bars at locs (thick lines perp to track dir'n)
137 M bars for top-level locs only Mno
138 N bars for top-level locs and those in obj's MNo
139 O bars for everything, including those inside parts MNO
140 m no bars (turns off labelling too) mnol
142 -E<layersel>[ARSCLMNOarsclmno]...
143 enable (capitals) or disable (lowercase) drawing of
145 A draw track swept area, with ticks
147 S draw track sleepers
148 C draw track centrelines
150 M mark locs with a bar
151 N mark locs with a bar in objs
152 O mark locs with a bar in parts
154 -q quiet: do not print info to stderr
155 (default: prints bounding box, at the moment)
157 <layersel> (for -e and -E) works as follows:
159 When file says `layer KL', default drawing element set is set
160 depending on K and L (see description of `layer' command), using last
161 specified -l layer. Then all -e/-E options are scanned, in order,
162 and each one that matches modifies the drawing element set.
164 <layersel> is GN[D][C][V]. It matches `layer KL' iff the glob
165 pattern G (which may be empty) matches the whole of K, and layer
166 restriction N[D]C matches L. C is several identical `=', `+' or `-';
167 D+ matches L iff L>=D; D++ iff L>D; D+++ iff L>D+1 and so on; D-
168 matches L iff L<=D; D-- iff L<D; etc.; D= matches L iff L==D; D== iff
169 D-1<=L<=D+1; D=== iff D-2<=L<=D+2; etc. If D is omitted the current
170 layer (from the most recent -l option) is used (or `5' if current
171 layer is `*'). N may be empty or `~'; the latter simply inverts the
172 sense of the match. If C is omitted then `=' is assumed. If the
173 final output layer is `*' then we pretend, for the moment, that L was
176 If V is present then C must be exactly one character and it is as if
177 V (must be an integer) copies of C were specified.
180 Special comments in PostScript:
183 a command C with args A is read for execution in scope S
185 point L in scope S has coords X Y and angle A
186 %L bbox width W (L..R)
187 %L bbox height H (B..T)
188 bounding box, giving width W, height H, left L, right R,
189 bottom B and top T. Includes full swept area of track,
190 but only at locs (so curves which bend outside bounding
191 box don't get counted)
192 %L bbox no locs, no bbox
193 there were no locs, so there is no bounding box
194 usu because input file was just obj defns and showlibrary
197 O! when defining object or part O
198 N:T scope T but inside part (introduced with `part') N } when
199 O::T scope T but inside obj (introduced with `obj[flip]') O } placing