JMRI is...

Common Tools

JMRI provides powerful tools for working with your layout.

System-specific Tools

Layout Automation

JMRI can be used to automate parts of your layout, from simply controlling a crossing gate to running trains in the background.

JMRI: Entry/Exit (NX) Routing Documentation

What is NX Routing?

NX Routing builds a dynamic valid path between two locations on a Layout Editor such as Sensors or Signal Masts. The path can traverse a number of Turnouts and different Blocks. The Entry and Exit locations on the Layout Editor are defined by the placement of Sensors at various Block boundaries. When two Sensors are activated and a clear and valid route is found between them, then the Turnouts in the route will automatically be set accordingly.

If there are multiple paths between two locations, then the system will use the path with the smallest cost or number of different Blocks. If one on the Blocks on the path is already occupied and there is a valid alternative path, then this will be taken.

How to setup for Entry Exit Routing

First you will need to have built a representation of your layout in the Layout Editor. Blocks will also need be defined so that the Sensors can be assigned to their boundaries.

Placing Sensors

Sensors can be placed by Turnouts, Layout Editor anchor points and level crossings, but only where there is a boundary between two different layout Blocks.
To add a Sensor, right click on the Turnout, level crossing or anchor point on your Layout Editor Panel. If a Block boundary exists you will be given the option to "Set Sensors..." You can also set Sensors at End Bumpers or Buffer Stops.

You will then be presented with a new pane that allows you to select the Sensor that will be used to either "protect" or be on the boundary between Block x & y.
The boundary or the protecting Block selected will define which direction the Sensors is active in.

In the example above, the Sensor protecting Block 51 will be used for routes going in an easterly direction. While the Sensor protecting Block 50 will be used for routes going in a westerly direction.

For Turnouts and crossings, you can only add sensors for the boundary going into the Turnout or crossing. It is not possible to add a Sensor for the boundary going out from the Turnout or crossing.
E.g., if Block A is the section of track attached to the Turnout and the Turnout is in Block B, you can only add a Sensor that faces into Block A that protects Block B; you cannot add a Sensor that faces into Block B to protect Block A.

Generating Entry Exit Pairs

You can have the system automatically generate the basic Entry Exit pairs and it is also possible to manually add pairs in the system, along with adding in what would normally be considered invalid configuration. To access the Entry Exit panel, select "Entry Exit" from the Tools menu of the Layout Editor. You will then be presented with the following screen...

If you press the Auto Generate Entry Exit Pairs this will then discover all the valid Entry Exit pairs on the layout.
Using the combo boxes it is also possible to manually add in additional Entry Exit pairs.
In all cases when the From Sensor is set active followed by the To Sensor, the route will be set between those two points and the two Sensors will return back to the "Inactive" state. If the Both Way option is ticked, then it is possible to activate the route in either direction, i.e. you can select the To Sensor prior to the From Sensor and the same route will be set.


The Entry Exit currently only deals with the throwing of Turnouts between two Routes. It does not yet provide a method to set-up Signal Mast Logic or full interlocking.