askic - 2024-07-31

Hello,
I'm coming from Siemens (TIA) world and currently learning Codesys.
I'd like to know if there is an option to add external txt file with ST code for creation of a function block and then use this file as a source file from which FB will be generated?
For example, in TIA, there is an option add external source file to the project structure and then use option "Generate blocks from source". This would create a FB.

Does Codesys have something similar?

This external source file would look like this:

FUNCTION_BLOCK Scaling
VAR_INPUT
    x, k, n : REAL;
END_VAR
VAR_OUTPUT
    y : REAL;
END_VAR
VAR
END_VAR
y := k*x+n;
END_FUNCTION_BLOCK