summaryrefslogtreecommitdiff
path: root/app/lib/demos/dmgroup.xtr
blob: 2c7741b7a5bdfb488fe574820f48dce15506f2c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
# XTrkCad Version: 3.0.1, Date: Wed Sep 20 22:05:35 2000

VERSION 10
DEMOINIT
PARAMETER display labelenable 1
ORIG 1.0 0.0 0.0
TURNOUT  6 0 0 0 0 DEMO 2 2.125000 2.281250 0 0.000000 "Peco-55	Medium Right	SL-E395F"
	E 2.125000 2.281250 270.000000
	E 7.530000 2.281250 90.000000
	E 7.495000 1.759250 99.686000
	D -0.108750 -0.832750
	P "Normal" 1 2
	P "Reverse" 1 3 4
	S 0 0.000000 0.000000 0.000000 0.353000 0.000000
	S 0 0.000000 0.353000 0.000000 5.405000 0.000000
	C 0 0.000000 23.136000 0.351000 -23.136000 0.004000 9.700000
	S 0 0.000000 4.251000 -0.331000 5.370000 -0.522000
	END
REDRAW
RESET
MESSAGE
The <Group> and <Ungroup> commands (on the Tools menu) are a powerful way to manipulate Turnout and Structure definitions.

We'll start with a simple turnout and add a switch machine.
END
STEP
COMMAND DrawLine
PARAMETER draw linewidth 0
PARAMETER draw linecolor 0
PARAMETER GROUP draw
PARAMETER draw linewidth 4
MOUSE 1 2.500 3.000
COMMAND DrawLine
MOUSE 2 2.500 3.000
MOUSE 4 2.500 1.500
COMMAND DrawLine
KEYSTATE A
MOUSE 2 3.200 3.000
KEYSTATE A
MOUSE 4 3.200 1.500
STEP
COMMAND DrawFilledBox
PARAMETER draw linecolor 0
PARAMETER GROUP draw
KEYSTATE A
MOUSE 1 2.600 3.000
KEYSTATE A
MOUSE 2 2.600 3.000
KEYSTATE A
MOUSE 4 3.100 2.500
KEYSTATE A
MOUSE 2 2.600 2.000
KEYSTATE A
MOUSE 4 3.100 1.500
MESSAGE
_________________________________________

Now that we have drawn a rough outline of a switch machine we will group it with the turnout definition.

First we Select the objects in the new definition.
END
STEP
COMMAND Select
MOUSE 1 0.781 3.375
MOUSE 2 0.781 3.375
MOUSE 3 8.312 1.312
MOUSE 4 8.312 1.312
MESSAGE
_________________________________________

Now do the <Group> command.
END
STEP
PARAMETER misc cmdGroup
MESSAGE
_________________________________________

The <Group> command dialog shows the Title (Manufacturer, Description and Part Number) of the new definition.  This information is taken from the Selected objects you are grouping.
END
STEP
MESSAGE
_________________________________________

The 'Replace with new group?' toggle will replace the Selected objects with the new definition.
END
STEP
PARAMETER group replace 1
MESSAGE
_________________________________________

If we don't change the Title then the new definition will replace the existing definition.

We'll give this definition a new Description.
END
STEP
PARAMETER group desc M Medium Right
PARAMETER group desc Modi Medium Right
PARAMETER group desc Modified Medium Right
MESSAGE
_________________________________________

We're done with this definition.  Press Ok.
END
STEP
PARAMETER group ok
MESSAGE
_________________________________________

You will see the updated image on the HotBar.
END
STEP
CLEAR
MESSAGE
The <Ungroup> command replaces any Selected turnouts or structures with their parts.

Structures and non-track segements of turnouts are composed of Lines, Circles and other shapes.  In this turnout these are the two lines and the two squares.

We will Ungroup this turnout and see how the individual parts can be changed.

First Select the turnout and then Ungroup it.

END
STEP
MOUSE 1 7.156 2.094
MOUSE 2 7.156 2.094
MOUSE 4 7.156 2.094
PARAMETER misc cmdUngroup
MESSAGE
_________________________________________

Notice that the Title now indicates the turnout is Ungrouped.

Hit Escape to deselect everything.
END
STEP
MOUSE 2800 4.094 5.188
RESET
MESSAGE
_________________________________________

Now Select the lines and squares.
END
STEP
#KEYSTATE C
MOUSE 1 2.500 2.812
#KEYSTATE C
MOUSE 2 2.500 2.812
KEYSTATE C
MOUSE 4 2.500 2.812
KEYSTATE C
MOUSE 2 2.850 2.500
KEYSTATE C
MOUSE 4 2.850 2.500
KEYSTATE C
MOUSE 2 3.200 2.000
KEYSTATE C
MOUSE 4 3.200 2.000
KEYSTATE C
MOUSE 2 2.850 1.500
KEYSTATE C
MOUSE 4 2.850 1.500
MOUSE 1 5.000 1.000
MESSAGE
_________________________________________

We could modify these object or add new ones.  For now we'll just delete them.
END
STEP
PARAMETER misc cmdDelete
MESSAGE
_________________________________________

And move the Label out of the way.
END
STEP
COMMAND MoveLabel
MOUSE 1 5.000 2.116
MOUSE 2 5.000 2.116
MOUSE 4 4.594 0.844
ORIG 1.0 0.0 0.0
MESSAGE
_________________________________________

Notice that the turnout has been broken into three parts.
END
STEP
COMMAND Describe
MOUSE 1 4.531 2.219
MOUSE 2 4.531 2.219
MOUSE 4 4.531 2.219
BIGPAUSE
MOUSE 1 6.984 1.812
MOUSE 2 6.984 1.812
MOUSE 4 6.984 1.812
BIGPAUSE
MOUSE 1 2.359 2.266
MOUSE 2 2.359 2.266
MOUSE 4 2.359 2.266
BIGPAUSE
#DESCRIBE OK
PARAMETER describe ok
RESET
MESSAGE
_________________________________________

Two ends of the turnout, from the frog to the end of the diverging leg and from the points to the left, are now straight track sections.

The a turnout is made of a number of individual straight and curved track segements.  This turnout had four segments:
   1 a short straight segment to the left of the points
   2 a long straight segment to the right of the points
   3 a curved segment from the points to the frog
   4 a straight segment from the frog to the end of the diverging leg.
The first and last segments have be converted to straight tracks.
The second and third segments form the the body of the turnout and can not be ungrouped further.

You can later Group this turnout with the straight segments to recreate the turnout definition.  You can also add other track segments to turnout definitions.

END
STEP
KEYSTATE S
MOUSE 2 4.625 1.969
KEYSTATE S
MOUSE 4 4.625 1.969
REGRESSION START 10 - group 1
TURNOUT  16 0 32 0 0 DEMO 2 2.477615 1.950213 0 0.000000 "Peco-55	Modified Medium Right	SL-E395F"
	T4 17 2.478000 2.281250 270.000000 0 0.0 0.0 0.0 0.0 0 0 0 0.000000 
	E4 7.530000 2.281250 90.000000 0 0.0 0.0 0.0 0.0 0 0 0 0.000000 
	T4 18 6.375762 1.950213 99.704000 0 0.0 0.0 0.0 0.0 0 0 0 0.000000 
	D -0.409808 -1.271732
	P "P1" 1
	P "P2" 2
	S 0 0.000000 0.000385 0.331037 5.052385 0.331037
	C 0 0.000000 23.136000 -0.001615 -22.804963 0.004000 9.700000
	END
STRAIGHT 17 0 0 0 0 DEMO 2
	E4 2.125000 2.281250 270.000000 0 0.0 0.0 0.0 0.0 0 0 0 0.000000 
	T4 16 2.478000 2.281250 90.000000 0 0.0 0.0 0.0 0.0 0 0 0 0.000000 
	END
STRAIGHT 18 0 0 0 0 DEMO 2
	T4 16 6.376000 1.950250 279.686360 0 0.0 0.0 0.0 0.0 0 0 0 0.000000 
	E4 7.495000 1.759250 99.686360 0 0.0 0.0 0.0 0.0 0 0 0 0.000000 
	END
REGRESSION END
PARAMETER misc cmdDelete
ORIG 1.0 0.0 0.0
CLEAR
MESSAGE
Now, create a track and place the new turnout on it.
END
STEP
COMMAND Straight
MOUSE 1 0.281 0.688
MOUSE 2 0.281 0.688
MOUSE 3 11.156 4.281
MOUSE 4 11.156 4.281
BIGPAUSE
COMMAND TurnoutHotBar
#PARAMETER turnout list 0 
PARAMETER GROUP turnout
HOTBARSELECT Peco-55	Modified Medium Right	SL-E395F
MOUSE 1 4.750 1.906
MOUSE 2 4.750 1.906
MOUSE 4 4.750 1.906
MOUSE 8200 4.750 1.906
MESSAGE
_________________________________________

Now suppose we want to replace the black squares with green circles.

First we Select the turnout.
END
STEP
COMMAND Select
MOUSE 1 6.062 2.906
MOUSE 2 6.062 2.906
MOUSE 4 6.062 2.906
MESSAGE
And now Ungroup it (from the Tools Menu)
END
STEP
PARAMETER misc cmdUngroup
MESSAGE
_________________________________________

Notice that the name has changed to indicate the turnout was Ungrouped.
END
STEP
MESSAGE
_________________________________________

Now, hit escape to deselect everything and then Select the 2 squares and delete them.
END
STEP
MOUSE 2800 6.062 2.906
RESET
BIGPAUSE
MOUSE 1 5.219 3.000
MOUSE 2 5.219 3.000
MOUSE 4 5.219 3.000
KEYSTATE S
MOUSE 2 5.219 2.000
KEYSTATE S
MOUSE 4 5.219 2.000
PARAMETER misc cmdDelete
MESSAGE
_________________________________________

Now draw the green circles...
END
STEP
ORIG 1.0 0.0 0.0
COMMAND DrawFilledCircleCenter
PARAMETER draw linecolor 0
PARAMETER GROUP draw
PARAMETER draw linecolor 65280
MOUSE 1 5.203 2.812
MOUSE 2 5.203 2.812
MOUSE 3 5.359 2.609
MOUSE 4 5.359 2.609
PARAMETER GROUP draw
MOUSE 1 5.516 1.891
MOUSE 2 5.516 1.891
MOUSE 3 5.672 1.719
MOUSE 4 5.672 1.719
PARAMETER GROUP draw
MESSAGE
and Group the new definition.
END
STEP
ORIG 1.0 0.0 0.0
COMMAND Select
KEYSTATE S
MOUSE 1 3.719 4.156
KEYSTATE S
MOUSE 2 3.719 4.156
KEYSTATE S
MOUSE 3 10.531 0.969
KEYSTATE S
MOUSE 4 10.531 0.969
BIGPAUSE
PARAMETER misc cmdGroup
PARAMETER group replace 1
BIGPAUSE
PARAMETER group ok
MESSAGE
_________________________________________

Notice that the turnout in the HotBar is angled the same as the turnout on the layout.  Make sure your new definition is rotated the way you want it.
END
STEP
KEYSTATE S
MOUSE 2 5.000 2.188
KEYSTATE S
MOUSE 4 5.000 2.188
REGRESSION START 10 - group 2
STRAIGHT 19 0 0 0 0 DEMO 2
	E4 0.281000 0.688000 251.716920 0 0.0 0.0 0.0 0.0 0 0 0 0.000000 
	T4 32 4.672994 2.139075 71.716920 0 0.0 0.0 0.0 0.0 0 0 0 0.000000 
	END
STRAIGHT 20 0 0 0 0 DEMO 2
	T4 32 9.805140 3.834688 251.716920 0 0.0 0.0 0.0 0.0 0 0 0 0.000000 
	E4 11.156000 4.281000 71.716920 0 0.0 0.0 0.0 0.0 0 0 0 0.000000 
	END
TURNOUT  32 0 0 0 0 DEMO 2 4.672994 2.139075 0 0.000000 "Peco-55	Modified Medium Right	SL-E395F"
	T4 19 4.672994 2.139075 251.716920 0 0.0 0.0 0.0 0.0 0 0 0 0.000000 
	T4 20 9.805140 3.834688 71.716920 0 0.0 0.0 0.0 0.0 0 0 0 0.000000 
	E4 9.935665 3.328060 81.403280 0 0.0 0.0 0.0 0.0 0 0 0 0.000000 
	D 0.000000 0.000000
	P "P0" 1 3
	P "P1" 4 2 3
	L3 0 0.055556 0.130589 0.800108 0 0.601157 -0.624169 0
	L3 0 0.055556 0.795251 1.019707 0 1.265820 -0.404571 0
	S 0 0.000000 5.132146 1.695614 0.335180 0.110740
	C 0 0.000000 -23.136000 7.591323 -21.857939 341.720920 9.700000
	S 0 0.000000 0.335180 0.110740 0.000000 0.000000
	S 0 0.000000 5.262670 1.188985 4.140240 1.019299
	G3 65280 0.000000 0.256018 0.530006 0.672925 0
	G3 65280 0.000000 0.232207 0.843006 -0.248075 0
	END
REGRESSION END
PARAMETER misc cmdDelete
CLEAR
RESET
MESSAGE
We can also create turnouts from simple straight and curved tracks.

We'll create two tracks that have a common endpoint.
END
STEP
COMMAND Straight
MOUSE 1 2.000 2.000
MOUSE 2 2.000 2.000
MOUSE 3 10.000 2.000
MOUSE 4 10.000 2.000
MESSAGE

When we create the curve from the straight track endpoint we need to hold down the <Shift> key to prevent XTrackCAD from trying to join the two tracks.
END
COMMAND CurveEndPt
MOUSE 1 2.000 2.000
KEYSTATE S
MOUSE 2 2.000 2.000
KEYSTATE S
MOUSE 3 9.000 2.000
KEYSTATE S
MOUSE 4 9.000 2.000
KEYSTATE S
MOUSE 2 9.000 2.000
KEYSTATE S
MOUSE 3 8.875 3.062
KEYSTATE S
MOUSE 4 8.875 3.062
MESSAGE
_________________________________________

At this point we can modify the tracks if necessary.

We will use the <Describe> command to change the tracks.
END
STEP
COMMAND Describe
MOUSE 1 9.438 2.000
MOUSE 2 9.438 2.000
MOUSE 4 9.438 2.000
MESSAGE
_________________________________________

We'll make the Length 7.5".

If we change the Length, each End-Point will be moved to shorten the track.  We want to just move the Right End-Point.  To control this, change the Lock to First which means the Left End-Point will be unchanged when we change the length (or angle) of the track.
END
STEP
#DESCRIBE Pivot	0
PARAMETER describe P1 0
MESSAGE
_________________________________________

Now when change the Length only the Right End-Point will move.
END
STEP
#DESCRIBE Length	7.500
PARAMETER describe F7 7.500
#DESCRIBE OK
PARAMETER describe ok
RESET
MESSAGE
_________________________________________

Now let's look at the curved track.
END
STEP
COMMAND Describe
MOUSE 1 7.688 2.625
MOUSE 2 7.688 2.625
MOUSE 4 7.688 2.625
MESSAGE
_________________________________________

Here the Left End-Point (which we don't want to move) is the Second End-Point, so we'll make that the Lock.
END
STEP
#DESCRIBE Pivot	2
PARAMETER describe P1 2
MESSAGE
_________________________________________

We want the curve to have a radius of 20" and an angle of 17.5�.
First change the Radius...
END
STEP
#DESCRIBE Radius	20.000
PARAMETER describe F9 20.000000
MESSAGE
and the the Angular Length.
END
STEP
PARAMETER describe F11 17.5
BIGPAUSE
#DESCRIBE OK
PARAMETER describe ok
MESSAGE
_________________________________________

Now Select both tracks...
END
STEP
COMMAND Select
MOUSE 1 7.500 2.750
MOUSE 2 7.500 2.750
MOUSE 4 7.500 2.750
KEYSTATE S
MOUSE 1 8.000 2.000
KEYSTATE S
MOUSE 2 8.000 2.000
KEYSTATE S
MOUSE 4 8.000 2.000
MESSAGE
and Group them.
END
PARAMETER group manuf 
PARAMETER group desc 
PARAMETER group partno 
STEP
PARAMETER misc cmdGroup
PARAMETER group manuf Custom
PARAMETER group desc Left
PARAMETER group partno 99-L
MESSAGE
_________________________________________

If the two tracks have a common End-Point then they will form a Turnout and can be switched with the <Train> command.  Otherwise they will just be two track segments grouped together.
END
STEP
PARAMETER group ok
MESSAGE
_________________________________________

We have created a left hand turnout and we also want a right hand version.

We'll use the <Flip> command.
END
STEP
COMMAND Select
MOUSE 1 7.812 2.250
MOUSE 2 7.812 2.250
MOUSE 4 7.812 2.250
COMMAND Flip
MESSAGE
_________________________________________

Drag a horizontal line that will be the mirror for the <Flip> command.
END
STEP
MOUSE 1 1.438 1.938
MOUSE 2 1.438 1.938
MOUSE 3 11.625 1.938
MOUSE 4 11.625 1.938
MESSAGE
_________________________________________

Notice the title has changed to Flipped Left.

Now Group the turnout.
END
STEP
PARAMETER misc cmdGroup
MESSAGE
_________________________________________

We'll change the Title and Part No for the new defintion.
END
STEP
PARAMETER group desc Right
PARAMETER group partno 99-
PARAMETER group partno 99-R
PARAMETER group replace 1
PARAMETER group ok
STEP
CLEAR
MESSAGE
To Remove the definitions, use the Custom Management dialog on the Tools menu.
END
STEP
PARAMETER misc cmdCustmgm
MESSAGE
_________________________________________

Select the definitions you added and Delete them.
END
STEP
PARAMETER custmgm inx 0 	Peco-55	DEMO	SL-E395F	Modified Medium Right
PARAMETER custmgm delete
PARAMETER custmgm inx 0 	Custom	DEMO	99-L	Left
PARAMETER custmgm delete
PARAMETER custmgm inx 0 	Custom	DEMO	99-R	Right
PARAMETER custmgm delete
PARAMETER custmgm ok
MESSAGE
=========================================
END
STEP
REGRESSION START 10 - group 3
TURNOUT  36 0 0 0 0 DEMO 2 2.000000 1.876000 0 0.000000 "Custom	Right	99-R"
	E4 2.000000 1.876000 270.000000 0 0.0 0.0 0.0 0.0 0 0 0 0.000000 
	E4 9.500000 1.876000 90.000000 0 0.0 0.0 0.0 0.0 0 0 0 0.000000 
	E4 8.014116 0.950339 107.500000 0 0.0 0.0 0.0 0.0 0 0 0 0.000000 
	D 0.000000 0.000000
	P "P0" 1
	P "P1" 2
	S 0 0.000000 0.000000 0.000000 7.500000 -0.000000
	C 0 0.000000 20.000000 -0.000000 -20.000000 0.000000 17.500000
	END
REGRESSION END
CLEAR