AnyRail Export to JMRI

AnyRail is a great tool for drawing model railroad panels. It includes a feature to Export as JMRI Layout Editor File. By default, this tool works fine to bring in a background image and your track diagram, but leaves a few steps incomplete. The steps below will move the generated Internal Turnouts and Blocks to your default hardware connection, create occupancy sensors tied to the Blocks, place icons for each of those new sensors, and make several cosmetic improvements. Follow the steps below to enhance your JMRI Panel:

1) Assign meaningful unique "Name"s to your AnyRail Sections. Start that "Name" with a unique number that will correspond to your selected Sensor hardware. e.g. "223 South Staging Lead". Make sure the name will still be unique when the number is removed.

2) Assign meaningful unique "Label"s to your AnyRail Turnouts. Start that "Label" with a unique number that will correspond to your selected Turnout hardware. e.g. "131 South:Staging 5". Make sure the name will still be unique when the number is removed.

3) Set AnyRail Zoom to 1:6. (Note: may need to experiment with other zoom levels to avoid "jaggies", depends on your panel width)

4) Disable "Show Visible track"

5) Take the option "Export As: JMRI Layout File". This will create 2 files, an .xml file and a .jpg file. The .xml file contains the layout editor elements, such as track segments, blocks and turnouts. The .jpg file contains the "background" with all labels, scenic elements, drawn objects, etc. that you defined in your AnyRail drawing.

6) Move both files into your JMRI user files location. (Note: the export specifies an exact scale and the "preferences:" location, so this is critical)

7) In JMRI, make sure that your desired hardware connection is configured and working, and set as Default. Later steps will connect the turnouts and sensors to this connection.

8) In JMRI, use File, Load Table Content and Panels... to open the file you just exported. (You can also add this action to Edit, Preferences, Start Up if desired)
You should see your JMRI track diagram, and a properly-scaled background image with your text and other graphics on it).

9) In JMRI, open the Turnout, Sensor and Block tables, and the JMRI System Console. (You can also add these actions to Edit, Preferences, Start Up if desired)

10) In JMRI, run the script It is included with JMRI, in the jython/anyrail folder.
Alternately, you can edit Preferences, Start Up, Add, Add script to button..., which will make it easy to rerun in future iterations.

11) Check the JMRI System Console for progress and error messages.

12) Review the Turnouts, Sensors and Blocks lists. You should now see your assigned hardware addresses and user names instead of internal names.

13) Go back to the AnyRail drawing and add any missing items, and correct any misspellings, or even reorganize your items for easier use.

14) Repeat from step 5 as needed. You want to minimize/eliminate manual changes to the JMRI side, since those are lost when/if you repeat the export.

15) Once you have the Turnouts, Blocks and Sensors named as desired, run the script "". This will create and place occupancy icons on every block on your panel. Test your blocks by clicking on the new occupancy icons and see that the expected track segments show as occupied.

16) To preserve your changes: File, Store ALL table content and panels. You can use the same name, or make a new name. Remember if you use a new name, you may need to change your Start Up to load the correct name.