- Open a shell and navigate to the folder on your local hard disk in which the library is to be stored.
- Login to
apax.
The general operation ofapaxand details of the login command are described here. -
Create a new library with
apaxbased on thetiax-libtemplate, install dependencies, and open the library created using AX Code:apax create tiax-lib my-sample-tia-library cd my-sample-tia-library apax install axcode .The prepared TIAX Lib template is shown at the end of the chapter.
-
If you installed the TIA Portal in a folder other than the default folder, edit apax.yml and set the
TIA_INSTALL_PATHvariable to your local installation of the TIA Portal. -
Program the library.
Place some sample code in the
srcfolder, for example anAbsfunction:NAMESPACE Siemens.Tiax FUNCTION Abs : LREAL VAR_INPUT value : LREAL; END_VAR IF value < 0.0 THEN Abs := value * -1.0; ELSE Abs := value; END_IF; END_FUNCTION END_NAMESPACE -
Compile the code and build the library:
apax build -
Convert the library. The results are placed in the folder
./bin/handover-folder:apax export-tia-handover-documents
To generate handover library documents for SINUMERIK ONE, update the export-tia-handover-documents script as outlined below:
scripts:
export-tia-handover-documents: ax2tia -i ./bin/sinu/*.lib -o ./bin/handover-folder -t sinu
Note
To generate handover library documents for a SINUMERIK ONE, ensure to include the relevant targets in the apax.yml file as detailed in the targets section.
When creating handover library documents for the SIMATIC S7-1500 Software Controller, use the option -t swcpu.
NOTICE
TIA Portal Library Importer performs an integrity check on the folder containing the handover library documents. If any of the handover library documents are modified, deleted or if new files are added to the folder, import of TIA Portal library fails.