Samples | PLC $plcProject.PlcOpenExport2( 'C:\Export\MyProg.xml',# output file 'POUs.MyProg;DUTs.MyDUT',# selection (project-relative,';' as separator) $false # false = only listed elements, not recursive ); # Export entire POUs folder recursively $plcProject.PlcOpenExport2( 'C:\Export\AllPOUs.xml', 'POUs', $true # true = entire subtree including methods, actions, transitions, properties ); 6.5.5 Creating PLC objects | Creating PLC objects PLC objects such as methods, properties, actions, function blocks, or folders are created using CreateChild .
The call takes the name of the new element, the SubType as a numeric value specifying the desired object type, and an optional vInfo array containing additional information such as the IEC languages or the return data type. The SubType determines which element is created. Requirements TwinCAT XAE is installed and started. A DTE connection to the target instance is active. ITcSysManager is initialized in an STA thread. A PLC project with at least one function block exists. SubType reference The following table lists the SubType values for CreateChild , along with their internal tag, object type, and the elements of the vInfo array.
A dash in the vInfo-Parameter column indicates that no creation parameters are documented for this element. TE1000 229 Version: 1.7.0 SubType Tag Item Category vInfo parameter 600 TREEITEMTYPE P _ LCAPP PLC application, root object – – 601 TREEITEMTYPE P _ LCFOLDER PLC folder Folder No vInfo parameter; use null. 602 TREEITEMTYPE P _ LCPOUPROG Program POU [0, optional]: IEC languages as specified at IECLANGUAGETYPE S. [1, optional]: “Extends”/“Implemen ts” keyword. [2, optional]: Interface or POU name. [3, optional]: “Implements”. [4, optional]: Interface for derivation. 603 TREEITEMTYPE P _ LCPOUFUNC Function POU [0]: IEC language. [1]: Return data type, such as DINT or BOOL.
604 TREEITEMTYPE P _ LCPOUFB Function block POU [0, optional]: IEC language. [1–4, optional]: Extends/ Implements analogous to program.