Creating Track Type

Tracks types are loaded dynamically and custom track types can be created in the 'tracks/' folder.

This document describes how to create custom track types. The existing tracks are also great for understanding file structure and how the models are drawn.

Create Directory (And define ID)

The name of the track's directory is also the id of this track type. This directories name must start with your initial or some other rather unique character combination, followed by an underscore (_), to prevent name collisions.

IDs without leading initials (such as 'bridge rather than 'ene_bridge) are reserved for the tracks shipped with the extension (and 'ene_' prefix is already reserved by me, Eneroth3). Using such an ID for your own track may lead to it being overwritten when updating the extension. Create a directory with the chosen ID as name in 'tracks/' to save the files for the track in.

Making the Models

Basically a track consists of extrusions (yellow), arrayed elements (red) and endings (green).

The rails and track bed are typically extrusions while ties/sleepers are arrayed and buffer stops are endings. Bridge heads and tunnel portals are also endings.

By combining these 3 element types all sorts of tracks can be made.

Extrusion Profiles

The extrusion faces are saved in a file named 'extrusion_profile.skp'. Each face in this model must be in its own group. By separating faces to individual groups unnecessary vertices from edges binding other faces can be avoided, reducing the number of faces created in the extrusion.

The groups can be painted with a material or left without material so the user can paint the track (e.g. bridge structures) themselves. The faces should be drawn in the models x-z plane with the front of the face pointing towards negative y. When making a tunnel ceiling however the face can be oriented the other way so the front faces are oriented towards the inside when extruded.

The most important extrusions may be the 2 rails. The standard gauge (distance between inner sides of rails) is 1,435 m. The top side of the rails must be along the x axis. The inner side should be half the gauge distance from the model origin. Many tracks share the same rails and ballast as the default one so these 3 groups can be copied and paste in place in the new track's extrusion file.

Arrayed Elements

Components can be arrayed along the tracks. This is most often done with ties/sleepers but can also be done with pillars supporting bridges or trusses.

These components are saved by the name 'along_<distance>_tie.skp' where <distance> is the distance between them in meters with a point (.) as decimal mark. '_tie' may be used in a future version of the plugin to separate ties/sleepers from other components such as pillars and should be left out for these.

Also in these files x axis represents the top of rail plane and ties/sleepers should normally be underneath it but centered at origin in horizontal(x-y) plane.

Often track types have the same ties/sleepers as the default one and then that model can be copied to their folder.

Endings

Components can also be added at the end of either each piece of track, where the track type changes (e.g. bridge head and tunnel portal) or where the track comes to an halt (e.g. buffer stop).

Endings are typically based on the extrusion profile model with the faces push-pulled towards negative y. It's also possible to do it the other way around; starting with the ending and copy faces from its x-z plane to use for the extrusions. Positive y is where the rest of the track will be.

These files should be named as following:

Double Tracks

For double track bridges or tunnels the whole bridge or tunnel structure can be drawn in just one track.

Extend the structure in endings and profiles towards negative x by the parallel distance of the tracks (usually 4,5 m).

If the corresponding track differs from all existing tracks, e.g. by having a narrower track bed to fit onto a bridge, it can be made its own track type. Typically this is based on the other track but with the structure around the track removed in all files.

Creating Info File

To create or edit track information run Ene_Railroad.property_editor in the Sketchup console. Select track, type in the ID of your track and then enter the information for it.

Naming conversion

To make it easier to find the track in the alphabetic list the name should be a comma-separated list as following describing the track type:

When double tracks are drawn as a pair, e.g. one track type with a bridge included and one corresponding with a track bed adapted to fit it, the one with the shared structure should have " pt1" appended to the name and the other " pt2" appended.

Examples:

Description

There's a tiny space to show a track description with the most vital information such as what time this track type was built or maximum span for a bridge. If the track type is a double track without a dedicated corresponding track (one with the same name except for the number) the description should say what track it corresponds too.

Create Preview Image

To create the preview image of the track, open preview.skp in tracks/. Change track type of the tracks in the model. If your new track type is a tunnel you can have the default track in front of it so the portal is shown. If it's a bridge you can set the track at the back to be elevated to look like a bridge head.

Chose an appropriate scene depending on if the new track is a tunnel, bridge, double etc.

Run this code in console to export image with resolution matching track typed shipped with the extension. The closer to 1362 * 610 the viewport size is, the better line thickness will match. My Viewport Resizer can be used for this.

path = ''#WRITE FULL PATH TO TRACK TYPE DICTIONARY BETWEEN QUOTES
Sketchup.active_model.active_view.write_image path + "/image.png", 150, 100, true

Distributing track

The whole folder for the track type can easily be compressed, shared, and decompressed in someone else's track folder.

Copyright © Julia Christina Eneroth 2014. This document may not be modified, including translated, without permission.