You are here: Start » Program Examples » Using Python code

Using Python code

Aim

The aim of this project is to demonstrate how to use Python functions with Aurora Vision Studio applications.

In this case, there are two functions. The first one returns the "Welcome" message with the typed name. The second one returns the result of adding two integers set via the WebHMI.

Input

Data entered by the user:

Python code:

Output

The "Welcome" message with the typed name and the result of adding integers:

Hints

To use Aurora Vision Studio objects with Python functions, they need to be converted to Python objects. In this case, StringToPythonObject and IntegerToPythonObject are used.

To use Python objects with Aurora Vision Studio filters, they need to be converted to Aurora Vision Studio objects. In this case, PythonObjectToString and PythonObjectToInteger are used.

Use Python_CallFunction to call a specific function from the PY file.

You can create a Global Parameter with the PY file path to use it multiple times without retyping it.

Solution (AVS)

Macrofilter Main.