I'm looking for a smart and short way to implement initialization of visualization variables depending on the visualization input.
For an easy example consider a rectangle which rests at XPos := 0 when the input state is false and at XPos := 50 when the input state is true. My visualization variables look like this:
VAR_IN_OUTState:BOOL;END_VARVARXPos:INT;END_VAR
I put this rectangle via a visualization frame element into another visualization and link a frame reference variable with the state to it.
If the variable is true, the rectangle should rest at XPos := 50 and false at XPos := 0 at visualization init but how should I assign the 50 or 0 to the internal visualization variable XPos? I would need some init-methode for the visualization but I dont want a global init-method for such tasks. I want to do it inside of the visualization element but I can't see any solution for this?
It would be good to be able to define ST-code within the visualization element which runs cyclic at each VISU_TASK task-cycle then I could just check the input state and change the XPos accordingly.
Does someone have a solution?
Last edit: sturmghost 2023-10-01
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm looking for a smart and short way to implement initialization of visualization variables depending on the visualization input.
For an easy example consider a rectangle which rests at XPos := 0 when the input state is false and at XPos := 50 when the input state is true. My visualization variables look like this:
I put this rectangle via a visualization frame element into another visualization and link a frame reference variable with the state to it.
If the variable is true, the rectangle should rest at XPos := 50 and false at XPos := 0 at visualization init but how should I assign the 50 or 0 to the internal visualization variable XPos? I would need some init-methode for the visualization but I dont want a global init-method for such tasks. I want to do it inside of the visualization element but I can't see any solution for this?
It would be good to be able to define ST-code within the visualization element which runs cyclic at each VISU_TASK task-cycle then I could just check the input state and change the XPos accordingly.
Does someone have a solution?
Last edit: sturmghost 2023-10-01