Home

codesys.com Ingo aliazzz
Attachments
python-editor.png (60911 bytes)
There is a newer version of this page. You can find it here.

Python in CODESYS

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:

  • Test automation
  • CI/CD integration for CODESYS projects
  • Static analysis for CODESYS projects
  • Autodeploy applications on controllers
  • Scan for controllers and update them
  • Automatically discover diagnostic info from multiple controllers in a network
  • Many many more usages ...

See also CODESYS Help

Editing of Python scripts

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 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.

Help.codesys.com

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.

References

cforge heavily uses the scripting API to automate some workflows for developers.