Getting Started - Manual - TIA2ST - A CLI tool to import TIA Portal project data into a SIMATIC AX project. - TIA2ST - Convert parts of TIA Portal projects to ST code,tool

TIA2ST CLI Tool (tia2st)

Portfolio
SIMATIC AX
Product
TIA2ST
Software version
2.0.24
Edition
01/2025
Language
English (original)
Package Name
@ax/tia2st

This command offers two modes:

  1. Extract SCL code blocks from a TIA Portal project based on Openness, save it as SCL text files, and convert it to ST code.
  2. Convert SCL text files directly, bypassing the time-consuming extraction process from TIA Portal Openness.

    Note

    If you use another source for your SCL files you might have files ending .UDT for user defiled types:
    Rename these files to .SCL so that the tool can detect them.
    The Openness export is performing this step autoamtically.

The mode selection depends on the --input parameter. If it points to a TIA Portal project, the first mode is chosen. If not, the tool defaults to the second mode.

Steps:

  1. Set up your AX project:

    apax create app tia-scl-import
    cd tia-scl-import
    apax add --dev @ax/tia2st
    
  2. Initiate the extraction of SCL code blocks and UDTs:

    apax tia2st import-scl -i ../tia-project
    

    The import will result in all SCL code blocks and user-defined data types being saved as SCL files in the folder ./src/import-scl/scl.
    The converted ST code will be placed in ./src/import-scl/.

    Note

    Pointing to a project launches an TIA Portal instance in the background during this operation, opening the project located in ../tia-project/tia-project.ap19, unless it's already open. You will be prompted to allow the tool to connect to the TIA Portal instance. You have the option to grant this permission for each individual import or for all future imports (this will require Administrator rights). If you refuse, the tool will terminate the command.

    Be aware that the generated ST code will be completely replaced with each conversion, and the SCL files will be rewritten with each import!

  3. Depending on the TIA Portal project, add any required libraries that may be used, some examples might be:

    apax add @ax/system-edgedetection
    apax add @ax/system-timer
    apax add @ax/simatic-1500-motioncontrol-native-v8
    
  4. Build the resulting code to start the first iteration:

    apax build
    

    Review the diagnostic messages. Sometimes, it's easier to fix individual locations in the ST code, while other times, a more general fix can be applied in the original SCL source. If the latter is the case, you'll need to convert the SCL code again:

    apax tia2st import-scl -i ./src/import-scl/**/*.scl
    

    This command will directly convert the SCL sources without re-exporting them from the TIA Portal project.

    Note

    Be aware that all modifications in the ST files will be overwritten without notice!

  5. Repeat the build and fix iteration until no more errors are reported, or until you're satisfied with the converted code and can use it elsewhere.

Notice that you can change all input and output paths to your specific project structure with the appropriate option.