This command offers two modes:
- Extract SCL code blocks from a TIA Portal project based on Openness, save it as SCL text files, and convert it to ST code.
-
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:
-
Set up your AX project:
apax create app tia-scl-import cd tia-scl-import apax add --dev @ax/tia2st -
Initiate the extraction of SCL code blocks and UDTs:
apax tia2st import-scl -i ../tia-projectThe 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!
-
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 -
Build the resulting code to start the first iteration:
apax buildReview 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/**/*.sclThis 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!
-
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.