CODESYS comes with built-in support for Ironpython. The Ironpython scripts are running inside of the CODESYS IDE, and can be used to automate huge parts of the system. That virtually everything within CODESYS can be automated this way, and that CODESYS can even be started headless, running a python script, makes the system really mighty.
There are many use cases you can think of:
See also CODESYS Help
CODESYS does not posses an internal Python script editor.
To edit python scripts there are more then enough alternatives available.
Offcourse you are free to use any tool that you wish, but we can give some suggestions (not exhaustive):
Notepad++
1. + Very small but variable installation footprint (dependent on extension choices)
2. - Only provides intellisense help on standard libraries
3. + Syntax highlighting
4. + Indentation help
5. + Quickly edit single files
6. - Less suited for larger projects
VS.Net Select the "Visual Studio IDE Community" version, install IronPython support via the installation proces.
1. - Large but variable installation footprint (heavily dependent on installation/extension choices)
2. + Provides very good intellisense help
3. + Syntax highlighting
4. + Indentation help
5. - Not well suited to edit single files
6. + Suited for large projects
PyCharm
1. + Medium but variable sized installation footprint (dependent on installation/extension choices)
2. + Provides very good intellisense
3. + Syntax highlighting
4. + Indentation help
5. - Not well suited to edit single files
6. + Suited for larger projects
*TIP: you can opt to install notepad++ and PyCharm or Visual Studio in tandem as they complement each other well **
Visual Studio Code or VS.Net can be an alternative, however, the CFORGE tool is developped using VS.NET, so your mileage may vary.
The output of the script will be written to the message view.
Instead of manually selecting the script to execute in the IDE, you can also start CODESYS and let it execute a script without the user interface:
Example:
"C:\Program Files (x86)\CODESYS 3.5.16.0\CODESYS\Common\CODESYS.exe" --noUI --profile='CODESYS V3.5 SP16' --runscript='svn-checkout.py'
With --noUI, CODESYS starts without the IDE and the output of the script is forwarded directly to the terminal:
d:\tmp> "C:\Program Files (x86)\CODESYS 3.5.16.0\CODESYS\Common\CODESYS.exe" --noUI --profile='CODESYS V3.5 SP16' --runscript='svn-checkout.py'
SVN: Information: [12:16:45] ---------- Scripted SVN Operation ----------
SVN: Information: [12:16:45] UpdateStarted <>
SVN: Information: [12:16:47] Added CODESYS_Control_for_Raspberry_Pi
SVN: Information: [12:16:47] Added CODESYS_Control_for_Raspberry_Pi\Camera device
SVN: Information: [12:16:47] Added CODESYS_Control_for_Raspberry_Pi\Camera device\[0]
SVN: Information: [12:16:47] Added CODESYS_Control_for_Raspberry_Pi\I2C
SVN: Information: [12:16:47] Added CODESYS_Control_for_Raspberry_Pi\Onewire
SVN: Information: [12:16:47] Added CODESYS_Control_for_Raspberry_Pi\Plc Logic
SVN: Information: [12:16:47] Added CODESYS_Control_for_Raspberry_Pi\Plc Logic\Application
SVN: Information: [12:16:47] Added CODESYS_Control_for_Raspberry_Pi\Plc Logic\Application\Library Manager
SVN: Information: [12:16:47] Added CODESYS_Control_for_Raspberry_Pi\Plc Logic\Application\PLC_PRG
SVN: Information: [12:16:47] Added CODESYS_Control_for_Raspberry_Pi\Plc Logic\Application\Task Configuration
SVN: Information: [12:16:47] Added CODESYS_Control_for_Raspberry_Pi\Plc Logic\Application\Task Configuration\Main
SVN: Information: [12:16:47] Added CODESYS_Control_for_Raspberry_Pi\Plc Logic\Application\Trace
SVN: Information: [12:16:47] Added CODESYS_Control_for_Raspberry_Pi\Plc Logic\Application\Trace_Axis
SVN: Information: [12:16:47] Added CODESYS_Control_for_Raspberry_Pi\Plc Logic\Application\Visualization
SVN: Information: [12:16:47] Added CODESYS_Control_for_Raspberry_Pi\Plc Logic\Application\Visualization Manager
SVN: Information: [12:16:47] Added CODESYS_Control_for_Raspberry_Pi\Plc Logic\Application\Visualization_1
SVN: Information: [12:16:47] Added CODESYS_Control_for_Raspberry_Pi\SPI
SVN: Information: [12:16:47] Added CODESYS_Control_for_Raspberry_Pi\SoftMotion General Axis Pool
SVN: Information: [12:16:47] Added CODESYS_Control_for_Raspberry_Pi\SoftMotion General Axis Pool\SM_Drive_RaspiStepper
SVN: Information: [12:16:47] Added CODESYS_Control_for_Raspberry_Pi\SoftMotion General Axis Pool\SM_Drive_RaspiStepper_1
SVN: Information: [12:16:47] Added CODESYS_Control_for_Raspberry_Pi\[4]
SVN: Information: [12:16:47] Added GlobalTextList
SVN: Information: [12:16:47] Added Library Manager
SVN: Information: [12:16:47] Added Project Settings
SVN: Information: [12:16:47] Added Visualization
SVN: Information: [12:16:47] Added meta.profile
SVN: Information: [12:16:47] Completed at revision: 24
SVN: Information: [12:16:47] Added: 26
SVN: Information: [12:16:48] ---------- Scripted SVN Operation ----------
As of CODESYS version 3.5.14.0, https://help.codesys.com/webapp/idx-scriptingengine;product=ScriptEngine;version=3.5.14.0 offers an exthaustive overview of the various available scripting objects and their possibilities.
cforge heavily uses the scripting API to automate some workflows for developers.