This repository contains official sample code for the TwinCAT Automation Interface offered by Beckhoff Automation. The sample code is provided as-is under the Zero-Clause BSD license.
The Samples are available as VisualStudio solutions here.
VS2015 or newer with installed TwinCAT XAE Package 3.1.4022 or newer
The ScriptionTestContainer demonstrates various aspects of the TwinCAT XAE Automation Interface.
The Application starts different scripts selectable by the user. The source code of these scripts is located in the 'Scripts' subfolder. To learn about, just set a breakpoint at OnExecute method of the script in the debugger and work through the statements with single step.
The OnExecute method itself is called by some infrastructural code that ensures that the script code can be called several types and is setting up / clearing up its preconditions.
Before starting script:
After execution of the script:
The Code Generation Demo located in the 'CodeGenerationDemo.sln' solution builds up from the same infrastructure like the ScriptingTestContainer demo application. But instead of demonstrating several scripts this demo shows a little application that generates (serial) Machine Configurations and PLC Code basing from a customer order database.
Here the input is coming from an 'Orders.xml' and the different machine options are generated by a combination of Automation Interface Script code and predefined configuration/program templates.
Should you have any questions regarding the provided sample code, please contact your local Beckhoff support team. Contact information can be found on the official Beckhoff website at https://www.beckhoff.com/contact/.
Further information about this sample code can be found on the Beckhoff Information System in the Automation Interface.