The XTrkCAD Wiki : FileFormats

HomePage :: PageIndex · RecentChanges · Login/Register

Scale Definition


All scale definitions are listed in the file xtrkcad.xtq. This file can be found in /usr/local/lib/xtrkcad on a LINUX system and
in the XTrkCad installation directory on Windows.

The SCALE definition looks like:
SCALE O, 48.0, 1.1770
	  1536,24,960
	  2016,30,1200
	  2592,36,1440

O
is the name of the scale,
48.0
is the ratio and
1.1770
is the track gauge in inches.
Easement
The next 3 line define the R, X, and L values for Sharp, Normal and Broad easement curves. These figures are listed in prototype inches. You can copy these from another scale which close to the desired scale. The exact values are not critical.

Basic Graphic Elements


Parameter files and layout files contain the same basic graphic elements.
The lines are (and subject to change):

U
this is the information entered on the turnout designer dialog for this definition
P
define the Paths thru the turnout, the numbers specify the track segments, numbered from 1
E
are the turnout's End-Points
S
is a straight track segment
C
is a curved track segment
L
is a straight line
A
is a curved line
F
is a filled polyline
Y
is a non-filled polyline
G
is a filled circle

These parameter only show up in the xtrkcad.cus file via the group command.

Q
defines a table-edge line. Presently unable to determine the parameter meanings.
B
defines a benchwork line. Presently unable to determine the parameter meanings.
M
defines a dimensions line. Presently unable to determine the parameter meanings.

Let's get some basics out of the way.

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 (Red*65536+Green*256+Blue).
Z values are always 0 (for now).
<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.
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).

It is noted on the Xtrkcad wiki that a negative radius for the "C" and "A" parameters changes the ordination of the swing, I find this to be not so. What I find is that the start angle and the degrees of swing is what's important to draw curve's and arc's properly. What I find the negative radius does do is correct mis-alignments in paths thru an turnout, but I have been successful in creating L/R turnouts, wye and 3-ways without this, but not so with dbl. slips and dbl. crossovers.

U <sp> "textfield1" <sp> "textfield2" <sp> "textfield3" <sp> dimfield1 <sp> dimfield2 <sp> dimfield3

This is an information only parameter. I have found it only exist in parameter files, if an track object is created with the Turnout Designer. The text fields are delimited by quotes and dimensional fields are delimited by a single space. All text fields are listed first then dimensional fields. Since this parameter is informational only it is not a required parameter.

P <sp> "textfield" <sp> 1 <sp> 2 <sp> 3 .... etc.

The Path parameter for track objects only. Defines the path or multiple paths thru an track object. This is determine by the number of track segments define by parameters S and C an their order in the track object definition. Let see if I can explain this, here is a sample of an wye turnout definition.

S 0 0.000000 0.000000 0.000000 0.353100 0.000000
C 0 0.000000 25.305227 0.353134 25.305227 171.786706 8.213370
S 0 0.000000 3.968199 0.259557 6.500000 0.625000
C 0 0.000000 25.305227 0.352999 -25.305227 0.000076 8.213370
S 0 0.000000 3.968199 -0.259557 6.500000 -0.625000

Shown are five track segment definitions, they are number starting with 1 in the order they are define top down, so for a left-hand path thru the turnout is 1 2 3 for a right-hand the path is 1 4 5. It is important that the order of segment definition and path definition match if not an error will display upon loading the parameter file. So if you to re-order the above definition as follow the path for a left-hand path thru the turnout is 1 4 2 for a right-hand the path is 1 5 3.

S 0 0.000000 0.000000 0.000000 0.353100 0.000000
S 0 0.000000 3.968199 0.259557 6.500000 0.625000
S 0 0.000000 3.968199 -0.259557 6.500000 -0.625000
C 0 0.000000 -25.305227 0.353134 25.305227 171.786706 8.213370
C 0 0.000000 25.305227 0.352999 -25.305227 0.000076 8.213370

The textfield of the parameter string is just a label. I have yet to determine any purpose other than to indicate the path purpose. For turnouts with multiple paths (ie, dbl crossvovers, dbl slips), the path are define in the following format 1 2 3 0 7 8 9 for the first pair, the zero is the delimiter for the second match path.

E <sp> X postion <sp> Y position <sp> Angle

The End-point parameter for track objects only. Defines the end-points of an track object,
for each end-point there needs to be a entry. There is no prefer order to defining the
end-points, as far as I have been able to determine.

S <sp> color <sp> line width <sp> X1 postion <sp> Y1 position <sp> X2 postion <sp> Y2 position

The straight track parameter for track objects only. Defines a straight segment of track.
X1,Y1 define the start point and X2,Y2 define the ending point. Generally for track object
the color and line width are defaulted to 0 for color and 0.000000 for line width.
For an example: a line define from left to right for 6" starting at 0,0 would be as shown below.

S 0 0.000000 0.000000 0.000000 6.000000 0.000000

C <sp> color <sp> line width <sp> radius <sp> center-X postion <sp> center Y position <sp> start angle <sp> degrees of swing.

The curve track parameter for track objects only. Defines a curved segment of track. X,Y
define the center point of the radius, the start angle defines the start point of the arc swing
(clock-wise), the degrees of swing defines the travel of the arc in degrees. Generally for track
object the color and line width are defaulted to 0 for color and 0.000000 for line width. For an
example: a curve define from left to right starting at 0,0 and swing down clock-wise for 12"
radius and 30 degree swing clock-wise would be as shown below.

C 0 0.000000 12.000000 0.000000 -12.000000 0.000000 30.000000

To define the same curve as above but with a up swing as follow

C 0 0.000000 12.000000 0.000000 12.000000 150.000000 30.000000

A <sp> color <sp> line width <sp> radius <sp> center-X postion <sp> center Y position <sp> start angle <sp> degrees of swing.

The arc line parameter for structure and track objects. Defines a arc/curved line. X,Y define
the center point of the radius, the start angle defines the start point of the arc swing
(clock-wise), the degrees of swing defines the travel of the arc in degrees. For an example:
a arc/curve define from left to right starting at 0,0 and swing down clock-wise for 12" radius
and 30 degree swing would be as shown below.

A 0 0.000000 12.000000 0.000000 -12.000000 0.000000 30.000000

To define the same arc as above but with a up swing as follow

A 0 0.000000 12.000000 0.000000 12.000000 150.000000 30.000000

to define a 12 radius circle at 0,0 see the below example.

A 0 0.000000 12.000000 0.000000 0.000000 0.000000 360.000000

L <sp> color <sp> line width <sp> X1 postion <sp> Y1 position <sp> X2 postion <sp> Y2 position

The line parameter for structure and track objects. Defines a straight line segment. X1,Y1
define the start point and X2,Y2 define the ending point. For an example: a line define
from left to right for 6" starting at 0,0 would be as shown below.

L 0 0.000000 0.000000 0.000000 6.000000 0.000000

F<sp> color <sp> line width <sp> # of end-points
<tab> X1 <sp> Y1 <sp> 0
<tab> X2 <sp> Y2 <sp> 0
<tab> X3 <sp> Y3 <sp> 0

The filled ployline parameter for structure and track objects. Defines a filled ployline object
such as tri-angle, box or irregular shapes. A minmum of 3 end-points must exist
(ie., tri-angle or such). X1,Y1 define the start point and X2,Y2 define the next pointand so
forth. There is no need for a closing point, the last point will close/connect back to the
starting point. For an example: a filled ployline for a 2" width by 1" height rectangle/box
starting at 0,0 with a filled color of black would be as shown below.

F 0 0.000000 4
0.000000 0.000000 0
2.000000 0.000000 0
2.000000 1.000000 0
2.000000 1.000000 0

Line width for this object is not needed, so can be left at 0.000000 width. If the total number
of end-points do not match the number of end-points definitions an error will occur. I have
yet to determine the third field for each end point coordinate, maybe a Z-coordinate but
unlikely since it's not format the same as the X and Y coordinates.

Y <sp> color <sp> line width <sp> # of end-points
<tab> X1 <sp> Y1 <sp> 0
<tab> X2 <sp> Y2 <sp> 0
<tab> X3 <sp> Y3 <sp> 0

The non-filled polyline parameter for structure and track objects. Defines a non-fill ployline
object such as tri-angle, box or irregular shapes. A minmum of 3 end-points must exist
(ie., tri-angle or such). X1,Y1 define the start point and X2,Y2 define the next pointand so
forth. There is no need for a closing point, the last point will close/connect back to the
starting point. For an example: a non-filled ployline for a 2" width by 1" height rectangle/
box starting at 0,0 with a line color of black would be as shown below.

Y 0 0.000000 4
0.000000 0.000000 0
2.000000 0.000000 0
2.000000 1.000000 0
2.000000 1.000000 0

If the total number of end-points do not match the number of end-points definitions an
error will occur. I have yet to determine the third field for each end point coordinate,
maybe a Z-coordinate but unlikely since it's not format the same as the X and Y
coordinates.

G <sp> color <sp> line width <sp> radius <sp> center-X postion <sp> center Y position <sp> 0.

The filled circle parameter for structure and track objects. Defines a filled circle. X,Y define
the center point of the radius. For an example: a filled circle defined starting at 0,0 and a 1"
radius and filled color of black would be as shown below.

G 0 0.000000 1.000000 0.000000 0.000000 0

Line width for this object is not needed, so can be left at 0.000000 width. I have yet to
determine the last field, maybe a Z-coordinate but unlikely since it's not format the same
as the X and Y coordinates.

B <sp> color <sp> unknown <sp> startX <sp> startY <sp> 0 <sp> endX <sp> endY <sp> 0 <sp> lumbersize

Benchwork

B 16760832 0.041667 0.000000 0.375000 0 14.000000 0.375000 0 131585

lumbersize
131584 (0010 0000 0010 0000 0000)=1x1 on edge
131585 (0010 0000 0010 0000 0001)=1x1 flat
132096 (0010 0000 0100 0000 0000)=1x2 on edge
132097 (0010 0000 0100 0000 0001)=1x2 flat
132608 (0010 0000 0110 0000 0000)=1x3 on edge
132609 (0010 0000 0110 0000 0001)=1x3 flat
133120 (0010 0000 1000 0000 0000)=1x4 on edge
133121 (0010 0000 1000 0000 0001)=1x4 flat
133632 (0010 0000 1010 0000 0000)=1x5 on edge
133633 (0010 0000 1010 0000 0001)=1x5 flat
134144 (0010 0000 1100 0000 0000)=1x6 on edge
134145 (0010 0000 1100 0000 0001)=1x6 flat

263168 (0100 0000 0100 0000 0000)=2x2 on edge
263169 (0100 0000 0100 0000 0001)=2x2 flat
263680 (0100 0000 0110 0000 0000)=2x3 on edge
263681 (0100 0000 0110 0000 0001)=2x3 flat
264192 (0100 0000 1000 0000 0000)=2x4 on edge
264193 (0100 0000 1000 0000 0001)=2x4 flat
265216 (0100 0000 1100 0000 0000)=2x6 on edge
265217 (0100 0000 1100 0000 0001)=2x6 flat
266240 (0100 0000 0000 0000 0000)=2x8 on edge
266241 (0100 0000 0000 0000 0001)=2x8 flat

526337 (1000 0000 1000 0000 0001)=4x4 flat

M <sp> color <sp> unknown <sp> startX <sp> startY <sp> 0 <sp> endX <sp> endY <sp> 0 <sp> typesize

Dimension Line

Typesize 0=Tiny, 1=Small, 2=Medium, 3=Large

Q <sp> 0 <sp> 0.187500 <sp> startX <sp> startY <sp> 0 <sp> endX <sp> endY <sp> 0

Table Edge

Q 0 0.187500 12.000000 36.000000 0 48.000000 36.000000 0

Parameter Files


There are three file structure header parameters of an parameter file as follows:

CONTENTS file title

Required as the first line of the parameter file.
Followed with an title of the parameter file purpose which is also required.
This title description displays in the content navigation menu upon right
clicking the object bar, only if there are no SUBCONTENTS headings.

SUBCONTENTS Subcontents title

Not required but gives parameter file good organization structure and
allows for users to navigate the object bar easier.
Followed with an title of the subcontents. This title description displays
in the content navigation menu upon right clicking the object bar.

# comment description

Can be used anywhere in the parameter file for commenting purposes.

There are three object parameters used to define Track objects, Structures/Misc objects and Rolling Stock/Motive Power as follows:

TURNOUT Defines all Track objects (ie, Turnouts, cross, bridges, straight sectional track, curve sectional track, etc).
STRUCTURE Defines all objects not Track or Rolling Stock/Motive Power (ie, buildings, trees, etc).
CARPART Defines all Rolling Stock and Motive Power.

The object parameters TURNOUT, STRUCTURE and CARPART must have a closing parameter
of END to indicate the end of the object definition.

TURNOUT <sp> scale <sp> "textfield1 <tab> textfield2 <tab> textfield3"

The TURNOUT parameter has two basic parameters scale and a quote delimited text field

scale - is the scale the object is being created for (ie, N, HO, O, etc).

quote delimited text field - is created from 3 text boxes from the Turnout designer dialog
mfg. box, L or R description box and L or R part no. box, if this is other than a std. LH/RH
turnout then it is only mfg. box, description box and part no. box. These 3 text fields are
delimited inside the quotes by tab spaces only.

STRUCTURE <sp> scale <sp> "textfield1 <tab> textfield2 <tab> textfield3"

The STRUCTURE parameter has two basic parameters scale and a quote delimited text field

scale - is the scale the object is being created for (ie, N, HO, O, etc). For STRUCTURE
parameter, an non-scale specific parameter file can be created by using an * this allows
the parameter file to be used with any scale (ie., tree parameter file), if something is define
as 1" long it is 1" long for all scales.

quoted delimited text field - is created from 3 text boxes from the group command dialog
mfg. box, description box and part no. box. These 3 text fields are
delimited inside the quotes by tab spaces only.

The following is the info used to define rolling stock and motive power parameter files.

Use the following format for a non-scale or Prototype specific parameter file. All dims(in inches) should be in prototype lengths.

CARPART <sp> "Description" <sp> 0 <sp> Type <sp> Car Length <sp> Car Width <sp> 0 <sp> 0 <sp> Truck Center <sp> Overall Coupler Length

These are the Type codes:

10101(Diesel), 10201(Steam), 10301(Electric), 30100(Freight), 50100(Passenger), 70100(M-O-W) or 90100(Other)

The option before the Type code defines either 0 for square or 2 for angle lead end of stock. There are two 0 options between the Car width and Truck center dims which the use of these options have yet to be determine.

A parameter file created using the following example format can be used with any scale.

CARPART "Box, 40'" 0 30100 486.500 126.000 0 0 368.000 518.500
F 255 0.000000 4
0.000000 0.000000 0
486.500000 0.000000 0
486.500000 126.000000 0
0.000000 126.000000 0
L 128 0.013333 40.541667 117.600000 0 40.541667 8.400000 0
L 128 0.013333 81.083333 117.600000 0 81.083333 8.400000 0
L 128 0.013333 121.625000 117.600000 0 121.625000 8.400000 0
L 128 0.013333 162.166667 117.600000 0 162.166667 8.400000 0
L 128 0.013333 202.708333 117.600000 0 202.708333 8.400000 0
L 128 0.013333 244.023048 117.600000 0 244.023048 8.400000 0
L 128 0.013333 283.791667 117.600000 0 283.791667 8.400000 0
L 128 0.013333 324.333333 117.599832 0 324.333333 8.400000 0
L 128 0.013333 364.875000 117.547752 0 364.875000 8.347752 0
L 128 0.013333 405.416667 117.547752 0 405.416667 8.347752 0
L 128 0.013333 445.958333 117.547584 0 445.958333 8.347584 0
END

Any of the following parameter objects can be use to draw body and details for your rolling stock or Motive power (see structure section for usage)

L Defines a straight line.
A Defines a arc or circle.
F Defines a filled polyline.
Y Defines a non-filled polyline.
G Defines a filled circle.

For a Scale specific parameter file. All dims(in inches) should be in scale lengths.

CARPART <sp> Scale <sp> "Description" <sp> 0 <sp> Type <sp> Car Length <sp> Car Width <sp> 0 <sp> 0 <sp> Truck Center <sp> Overall Coupler Length <sp> Color

The description field has a unique format for Scale Specific parameter files, as follows:

"Manufacturer <tab> X1 <comma> <sp> X2 <comma> <sp> X3 <sp> X4 <tab> X5 <tab> X6 <tab> X7 <tab> X8 <tab> x9"

Some usage I have determine for the following fields:

X1 Car type (ie, Hopper)
X2 Car Desription field 1 (ie, Centerflow)
X3 Car Desription field 2 (ie, 50' ACF 3-Bay)
X4 Car Desription field 3 (any info)
X5 Car Desription field 4 (any info)
X6 Car Desription field 5 (ie, mfg part number)
X7 Full Road Name
X8 Report Markings
X9 Car number

These field show up in the Car Inventory Edit/Add dialog screens in the following format

Car Prototype field X1, X2, X3 X4
Part & Description field X6 X5 X8 X9
Full Road Name field X7
Report Markings field X8
Car Number field X9

All fields need to be fill in or data will shift between fields. Review some of the existing
rolling stock parameter files to get a better understanding of the proper format.


Thanks to Dwayne Ward for much of the information in this document.

CategoryDevel

There are no comments on this page. [Add comment]

SourceForge.net
Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by Wikka Wakka Wiki 1.1.6.3
Page was generated in 0.0905 seconds