Snaptrack‎ > ‎SnapTrack-J‎ > ‎SnapTrack-J Guide‎ > ‎

Custom definitions

You can design your own definitions for SnapTrack by creating a simple xml file containing the dimensions. When the program starts, it builds up the track box by looking in the box folder in SnapTrack's installation directory. If you are creating your own definitions, add a new folder alongside the existing original and sports folders; you can put definitions in those as well if you prefer. Although the file format is an xml file, the extension should be .stbx. Each new section should be in its own file.

Custom files from the old SnapTrack

If you look in the orginal and sports folders you will see that they do not contain any .stbx files but only contain text files. This is because SnapTrak-J can also read text files exported from the original SnapTrak program. So if you already have some custom sections, you can just export those from the old program and drop the .txt files into your new custom folder.

The new XML format

Okay, so what is the format? There are a couple of attached files below which you can use as a starting point. The table below, explains the content. Note that boolean values should be entered as "true" or "false" and not 1 or 0.

Note that the XML tags use US spelling for colours. E.g. fillColor.

Section

The root node. This is the main element that defines the section.

 Attributes Type Notes
 make
 Integer
 0 = Scalextric standard
 1 = Scalextric Sports
 2 = Custom (consistent with old SnapTrack)
 1000 = User (for your own definitions)
 id String     The identifier for the track
 description String The description
 curved Boolean Set true for curved tracks.

 Nested elements
 Type Notes
 outline Line Definition   
 Defines the outline. Just one required.
 nodes
 Nodes List
 List of nodes
 line
 Line Definition
 A line to draw on the section. Can be as many as you like

LineDefinition

A description of an arbitrary shape that is drawn on the section.

 Attributes Type Notes
 isTrack
 Boolean
 This only affects the default colours and widths used if they are omitted.  Defaults to false.
 closed
 Boolean
 True if the shape should be filled.
 curved Boolean True if curved. Affects nested elements

 Nested elements
 TypeNotes
 fillColor
 Colour 
 The fill colour.
 lineColor
 Colour
 The colour used for the line.
 lineWidth
 Float
 The width of the line.
 pointsList    
 Points List Required if curved = false
 angle Float
 Required if curved = true
 width
 Float
 Required if curved = true
 The width of the curved shape.
 radius
 Float Required if curved = true
 The inner radius.

Colour

A description of an RGB colour.

 Attributes Type Notes
 red
 Integer
 Red value. 0 to 255.
 blue
 Integer
 Red value. 0 to 255.
 green Integer
 Blue value. 0 to 255.

 Nested elements
 TypeNotes

Nodes List

A list of nodes used by the section.

 Attributes Type Notes

 Nested elements
 TypeNotes
 node
 Node
 Definition of a connection node. As many as you like. Normally 2 or 4.

 Nested elements
 TypeNotes

Node

Definition of a node.

 Attributes Type Notes
 make Integer
 Defines the nodes to which it connects.
 See section make attribute.
 posX Float The x coordinate on the section for the node.
 Note for curved sections, 0.0 is at the centre of the radius.
 If omitted, the program will position it for you.
 posY Float The Y position for the node.
Note for curved sections, 0.0 is at the centre of the radius.
 If omitted, the program will position it for you.
 angle Float
 The direction of attachment of other section. For the bottom node this would normally be -90 degrees whereas the top node would be +90 degrees. If omitted, the program will work it out for you.

 Nested elements
 TypeNotes
 fillColor
 Colour
The normal fill colour for the node.
Standard colours are red="170" green="0" and blue="0". 
 fillAltColor Colour
The colour used when connected.
Standard colours are red="0" green="170" and blue="0".

Points List

A list of points defining an arbitrary shape.

 Attributes Type Notes

 Nested elements
 TypeNotes
 point2d
 Point
 Definition of a point. These are processed in order to define a shape.
If closed, the last point does not need to be positioned back to the starting point. I.e. to define a rectangle you need 4 points, not 5.

Point

Definition of a point.

 Attributes Type Notes
 x Float x position
 y Float y position

 Nested elements
 TypeNotes



Č
ċ
ď
exampleCurvedSection.stbx
(1k)
Steve Butler,
16 Oct 2011 05:39
ċ
ď
exampleStraightSection.stbx
(2k)
Steve Butler,
16 Oct 2011 05:39
Comments