Menu

LayoutElements

FileFormat (7)
Russell Shilling

Layout Elements

There are element definitions (subject to change):

Tag Description
STRAIGHT is a straight track segment
CURVE is a curved track segment
BEZIER is a curved track segment that is described by a Bezier function
BZRLIN is a line defined by a Bezier function
JOINT is a join element between two tracks
CORNU is a join element between tracks that uses a Cornu curve
NOTE is a Note Text String
BLOCK a track block
CONTROL a control element
SENSOR a sensor element
SIGNAL a signal element
SWITCHMOTOR A motor that controls a turnout
TURNTABLE a turntable

There are elements that are attached to these track elements

  • E are the unconnected End-Points
  • T are the connected End-Points
  • D description

There are also compound objects as follows

  • DRAW is a drawing element (lines, etc)
  • TURNOUT is a set of track segments that describe a turnout
  • STRUCTURE is a group of line segments that define a structure
  • CAR is a group of lines that define a Car

There are segment definitions that appear inside other elements (subject to change):

Char Description
S Straight track segment
C Curved Track segment
L Straight line segment
A Curved line segment
J Joint track segment
G Filled circle segment
Y Poly segment
F Filled poly segment
Z Text Segment
U this is the information entered on the turnout designer dialog for this definition
P define the Paths through the turnout, the numbers specify the track segments, numbered from 1
X special segment
Q defines a table-edge line
B defines a benchwork line
M defines a dimensions line
W defines a Bezier Track Segment
H defines a Bezier Line segment

Track and Line Objects Details

Common Definitions

Let's get some basics out of the way.

  • all lengths are in inches.
  • Degree ordination is read clock-wise, (ie, 0 - 12 O'Clock, 90 - 3 O'Clock, 180 - 6 O'Clock, 270 - 9 O'Clock).
  • Colors values are RGB encoded as (Red65536+Green256+Blue).
  • Z values are above or below the datum.
  • (sp) will indicate a single space between or before parameter data for delimiting.
  • <tab> will indicate a single tab space between or before parameter data for delimiting.</tab>
  • All parameter file dimensional data is in decimal format (ie, 10.000000).
  • All parameter file angle/directional data is in decimal format (ie, 90.000000).

Because curves are always described with clockwise angles, if a curve is needed inside a compound shape that is counter-clockwise the radius will be negative. Note that compound shapes are usually defined left to right and top to bottom and can be offset and rotated as a unit. This reduces the need for counter clockwise elements. But negative radii are very useful in Bezier segments and Cornu.

Track and other Objects

STRAIGHT

STRAIGHT (sp) index (sp) layer (sp) line-width (sp) 0 (sp) 0 (sp) scale (sp) descshow&visibility&no_ties&bridge&roadbed (sp) Desc-x (sp) Desc-y
    Then two end points (E or T)
    END$SEGS

The straight track parameter for track objects only. Defines a straight segment of track. Generally for track objects the color and line width are defaulted to 0 for color and 0 for line width. Visibility is the second bit - so hidden = 0, visible = 2, no_ties = 4, bridge = 8, roadbed = 16. A tunnel mouth is formed when joined tracks transition between visible and invisible.
After this definition there are two end points defined either as E (unconnected) or T (connected).

Option values Meaning
1 Description
2 Visible
4 No Ties
8 Bridge
16 Roadbed

Note line-width is from 0-255.

For an example: a line define from left to right for 6" starting at 0,0 and connected at 6,0 to Track 2 with no elevation definitions would be as shown below.

STRAIGHT 1 1 0 0 0 OO 2 0.000000 0.000000 0.00000 0.00000
    E4 0.00000 0.000000 90.000000
    T4 2 6.000000 0.000000 270.000000
    END$SEGS
CURVE

CURVE (sp) index (sp) layer (sp) line-width (sp) 0 (sp) 0 (sp) scale (sp) visibility&no_ties&bridge&roadbed (sp) center-X (sp) centerY (sp) 0 (sp) radius (sp) helix-turns (sp) desc-X (sp) desc-Y
    Then two end points (E or T)
    END$SEGS

The curve track parameter for track objects only. Defines a curved segment of track. X,Y define the center point of the radius, Generally for track object the color and line width are defaulted to 0 for color and 0 for line width.

Visibility is the second bit - so hidden = 0, visible = 2, no_ties = 4, bridge = 8, roadbed = 16.

This is then followed by two end-points which are either E (unconnected) or T (connected).

Note line-width is from 0-127. If the field is 128 or larger, the track label is shown for a normal curve. For a helix, conversely, the label will be shown if <128 and not shown if greater.

The desc-x is a number from -0.5 to 0.5 as a ratio of the arc that joins the ends of the curve. The desc-y number is a number from -0.5 to 0.5 as a ratio of the radius of the curve. This results in the position of the center of the description.

For an example:
a curve define from left to right starting at 6,0 and swing up clock-wise by 90 degrees for 12" radius with no elevation definitions would be as shown below.

CURVE 2 1 0 0 0 OO 2 0.000000 12.000000 0 12.000000 0 0.000000 0.000000
    E4 18.000000 12.000000 0.000000
    T4 1 6.000000 0.000000 90.000000
END$SEGS
JOINT

JOINT (sp )index (sp) layer (sp) width (sp) 0 (sp) 0 (sp) scale (sp) visible&no_ties&bridge&roadbed (sp) l0 (sp) l1 (sp) R (sp) flip (sp) negate (sp) S-curve (sp) x (sp) y (sp) 0 (sp) angle (sp) desc-x (sp) desc-y
    Two end points (Both Ts as a JOINT must be connected)
    END$SEGS

The desc-x is a number from -0.5 to 0.5 as a ratio of the line that joins the ends of the joint. The desc-y number is a number of inches orthogonal to that.

NOTE

NOTE (sp) index (sp) layer (sp) 0 (sp) 0 (sp) start-x(sp)start-y (sp) length (sp) type (sp) "text1" (sp) "text2"

If index is MAIN then the Note is the Main Note, otherwise it is an on-layout note.

The type is one of the following:

Id Type Text1 Text2
0 Regular Post-It note Contents not present
1 Web Link URL Title
2 Document File Name Document Name

The Note is formatted as it is seen on the screen, with included line feeds and tabs.

BLOCK

BLOCK (sp) index (sp) name (sp) script
    TRK (sp) include-track-index
    ...
    END$BLOCK

A block defines a set of XTrackCAD tracks that an external program (such as JMRI) will consider to be a single named unit. It also includes a script which normally refers to a sensor that will be triggered when the block is occupied.

CONTROL

CONTROL (sp) index (sp) layer (sp) scale (sp) visible (sp) start-x (sp) start-y (sp) name (sp) on-script (sp) off-script

A control defines an object that JMRI can control, its location and some arbitrary scripts that normally define how to turn it on and off

SENSOR

SENSOR (sp) index (sp) layer (sp) scale (sp) visible (sp) start-x (sp) start-y (sp) name

A sensor is something that an external program (such as JMRI) can know the state of. It has a position and a name.

SIGNAL

SIGNAL (sp) index (sp) layer (sp) scale (sp) visible (sp) start-x (sp) start-y (sp) angle (sp) num-heads (sp) name
    ASPECT (sp) aspect-name (sp) aspect-script
    ...
    END$SIGNAL

A signal defines a signal mast/post understood by JMRI. It may have a number heads and have multiple aspects. A head is an indicator (light, LED or semaphore) And aspect is a combined set of these set to indicate something to the driver. Each aspect can have an arbitrary script understood by JMRI.

SWITCHMOTOR

SWITCHMOTOR (sp) index (sp) turnout-index (sp) normal (sp) reverse (sp) pointsense

A Switch motor defines a motor that can control a point. The fields normal, reverse and pointsense are arbitrary strings in XtrkackCAD but are expected to contain an address understood by JMRI of the motor(s) that move the point and an optional sensor.

TURNTABLE

TURNTABLE (sp) index (sp) layer (sp) 0 (sp) 0 (sp) 0 (sp) scale (sp) visible (sp) x (sp) y (sp) 0 (sp) radius (sp) current-ep
    And then a set of E or T records
    END$SEGS

TEXT

DRAW (sp) index (sp) layer (sp) 0 (sp) 0 (sp) 0 (sp) x (sp) y (sp) 0 (sp) rotation
    Z (sp) color (sp) 0 (sp) 0 (sp) 0 (sp) check-box (sp) font-size (sp) "text"
    END$SEGS


Related

Wiki: FileFormats

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.