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 following the steps below will significantly enhance your results:

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"

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".

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, 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).

8) 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)

9) In JMRI, run the script AnyRailExportAdditions.py. 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.

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

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

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

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

14) Once you have the Turnouts, Blocks and Sensors named as desired, run the script "AddOccupancyIconsToPanel.py". 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.

15) 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 need to change your Start Up to load the correct name.