All objects and command which CODESYS provides for scripting are also available in the "scriptengine
" Python module. Whenever a script is started, an implicit <code>from scriptengine import *</code>
results. This allows for easy access to CODESYS. However, if your script imports modules that require access CODESYS APIs, then these modules have to import the module scriptengine
themselves.
In the following table, you will find the main objects (categories) that can be used in Python scripts as entry points. For comprehensive documentation about entry points, see the API reference documentation for the CODESYS ScriptEngine.
Objects |
Description |
---|---|
System |
Access to general CODESYS functionalities Examples:
|
projects |
Access to the CODESYS project as an object tree that combines the three navigator views (devices, POUs, modules) in one project tree Also allows for the loading, creating, saving, and closing of projects For most objects in a project, there are special methods with detailed functionality, for example compiling, access to ST POUs, export, import, device configuration, etc. |
online |
Access to online functionalities Examples:
|
librarymanager |
Permits the management of library repositories and viewing, installation, and removal of libraries |
device_repository |
Handling of device repositories; import and export of device descriptions |
modulerepository |
Management of CODESYS Application Composer modules and CODESYS Application Composer repositories |
See the following specific sample scripts for ways to access CODESYS functionalities. For detailed information, see the API reference documentation for the CODESYS.