Author: Dave Sand
Keywords: java model railroad JMRI LogixNG export

# JMRI: Export LogixNG

The LogixNG content in the PanelPro xml data file looks simple but it is internally complex.

The LogixNG default is to use automatic system names. The format is xxxx:AUTO:nnnn. The xxxx is one of many names that all start with IQ. The nnnn is a sequential number. Since the system names are only unique within a xml data file, manually copying LogixNG content to another xml data file is impossible

## LogixNG Export Process

The export is an external process which works with PanelPro xml data files using a Jython script. A file that contains LogixNG is used to create a new file that only has LogixNG content. The system names are changed when the new file is created. The AUTO keyword is replaced by a different keyword. For example using XYZ, the result is that xxxx:AUTO:nnnn becomes xxxx$XYZ:nnnn. Notice that the first colon becomes the dollar character.

Other than the LogixNG content, the new file does not have any other tables or any panels. The file is a valid PanelPro xml data file. It can be loaded after another xml data file. The result is that the LogixNG definitions will be merged. A subsequent store completes the process.

The export process does not change user names. Conflicts will need to be manually resolved.

The export process does not change any table references such as sensors or turnouts. If the existing tables do not have matching items, errors will occur.

### Selective Export

The script exports all of the LogixNG content. If only some items are needed, use the following process after the script has created the output file.

1. Load the output file in a new PanelPro session.
2. Delete the unneeded items from the LogixNG tables.
3. Store the updated LogixNG content.
4. Quit PanelPro

## Running the LogixNG Export

The export process uses a Jython script. From the main PanelPro menu, select Scripting ⇒ Run Script. The ExportLogixNG.py script is in the jython/LogixNG directory at the JMRI install location.

The script requests the input and output file names along with the new system name keyword.

Select Input XML Data File
  The selected file is open read only and will not be changed.
Select Output XML Data File
  The selected file will be created or over written with no warnings.
Enter the replacement keyword for AUTO
  The new keyword should be unique, short and descriptive. It can only contain alpha and numeric characters.

Messages from the script are displayed on the JMRI system console.

    14:11:40,841 jmri.jmrit.jython.exec.ExportLogixNG  INFO  - Run LogixNG Export v1.0 [AWT-EventQueue-0]
    14:12:13,431 jmri.jmrit.jython.exec.ExportLogixNG  INFO  - Export completed, AUTO replaced by XYZ, file .../LogixNG.xml has been created [AWT-EventQueue-0]