# Creating Signal Type

Signal types are loaded dynamically and custom ones can be created in the signal directory. To open this directory run: EneRailroad::Template.open_dir(:signal_type).

## Create Directory (And define ID)

Each signal type template is saved in a sub directory named as its ID. This directory's name must start with your initial or some other rather unique character combination, followed by an underscore (_), to prevent name collisions. If relevant, follow the prefix by the country code.

IDs without leading initials (such as 'SE_electric' rather than 'ene_SE_electric') are reserved for the signals shipped with the extension (and 'ene_' prefix is already reserved by me, Eneroth3). Using such an ID for your own signals may lead to it being overwritten when updating the extension.

Create a sub directory with the chosen ID as name to save the files in.

## Making the Model

Create a model named 'model.skp' in the directory you just created. For backward compatibility save models as Sketchup version 8.

The signal should be horizontally centered at the origin. The origin corresponds to the top of track plane and the foundation of the signal can go further down into the track bed.

The front side of the signal should be facing Positive y. This may seem a bit backward since it's the back side of the model, however it's consistent to how track endings are drawn since the signal is turned inwards to the track its drawn on and not outwards away from it.

All indicators are drawn in the same model and the relevant one will be shown while the rest are hidden. Indicators can be either groups or components and are identified by their name.

valid indicator names:

- indicator_diverge_left
- indicator_diverge_right
- indicator_diverge
- indicator_through_left
- indicator_through_right
- indicator_through_middle
- indicator_through

Some signal types uses different diverging indicators for right or left, some uses the same. The same goes for the through indicators. The plugin first tries to show the indicator also showing left or right and falls back to only showing through or diverge if it cannot be found.

Diverge Left | Diverge Right | Diverge | Through Left | Through Right | Through

## Create/Update Information

To create or edit signal information run EneRailroad::Template.edit_properties in the Ruby console.

distance_to_track is the distance between the track and the signal's origin. Leave blank for default value.

The name typically starts with the country the signal is from and then states if it's electric or mechanic.

## Create Preview Image

To create the preview image of the signal type, open preview.skp in the signal directory. Change signals type of the tracks in the model by right clicking it and open track properties.

The closer to 1362 * 610 the viewport size is, the better line thickness will match those of templates shipped with the plugin. My Viewport Resizer can be used to achieve this.

The scene saved in the model has the camera angle matching other signal previews but since signals differ in size and position you may need to pan and zoom into a better location.

You can also open the track group, open its child groups until you can select the part functioning as a signal (not including the base), right click it and chose zoom extents. When opening the track group you will be asked if you want to prevent the group from being automatically redrawn in the future. Click no since you just need to open it to select an entity, not edit it.

Run this code in console to save preview image:

EneRailroad::Template.create_preview

## Distributing signal type

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

Copyright © Julia Christina Eneroth 2015.