<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Call or switch visualization through structured text program code (ST)</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/f9e9c2827f/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/f9e9c2827f/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/f9e9c2827f/</id><updated>2023-06-04T11:19:46.858000Z</updated><subtitle>Recent posts to Call or switch visualization through structured text program code (ST)</subtitle><entry><title>Call or switch visualization through structured text program code (ST)</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/f9e9c2827f/?limit=25#c756" rel="alternate"/><published>2023-06-04T11:19:46.858000Z</published><updated>2023-06-04T11:19:46.858000Z</updated><author><name>TimvH</name><uri>https://forge.codesys.com/u/timvh/</uri></author><id>https://forge.codesys.com18bd2d927e504fe8088c44e546da328e4ffc3450</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;In the main visualization place 1 frame.&lt;br/&gt;
In this frame add 3 visualizations (2x green lamp, 1x red lamp).&lt;br/&gt;
Link the FB instances as reference to the visualizations in the frame.&lt;br/&gt;
Then there are multiple options to switch between which visualization to show in the frame.&lt;br/&gt;
A simple one could be just to use the "Switch frame variable" and in your IF statement set the correct value for this variable.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Call or switch visualization through structured text program code (ST)</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/f9e9c2827f/?limit=25#0eb0" rel="alternate"/><published>2023-06-01T11:15:45.556000Z</published><updated>2023-06-01T11:15:45.556000Z</updated><author><name>sbt-277</name><uri>https://forge.codesys.com/u/sbt-277/</uri></author><id>https://forge.codesys.com53eb2bb302a4ded56845fdc39a07f49196cbe920</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I created a simple function block for a green lamp and red lamp:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="err"&gt;FUNCTION_BLOCK GreenLamp&lt;/span&gt;
&lt;span class="err"&gt;VAR&lt;/span&gt;
&lt;span class="err"&gt;    LampActive : BOOL;&lt;/span&gt;
&lt;span class="err"&gt;END_VAR&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;(Red lamp is the same, just the different name)&lt;/p&gt;
&lt;p&gt;And I created a visualization with just one lamp called "GreenLamp" and another one called "RedLamp" with the following interface configuration:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="err"&gt;VAR_IN_OUT&lt;/span&gt;
&lt;span class="err"&gt;    Data : GreenLamp;&lt;/span&gt;
&lt;span class="err"&gt;END_VAR&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;(Red lamp is the same, just the different type name)&lt;/p&gt;
&lt;p&gt;In my main program I instantiated two instances of the green and one instance of the red lamp:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="err"&gt;PROGRAM SR_Main&lt;/span&gt;
&lt;span class="err"&gt;VAR&lt;/span&gt;
&lt;span class="err"&gt;    L1 : GreenLamp;&lt;/span&gt;
&lt;span class="err"&gt;    L2 : GreenLamp := (LampActive := TRUE);&lt;/span&gt;
&lt;span class="err"&gt;    L3 : RedLamp;&lt;/span&gt;
&lt;span class="err"&gt;END_VAR&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Now I will have a main visualization where I want to display and switch between the GreenLamp or RedLamp visualization when some requirements are met in code or when a button is pressed at the main visualization. With another button it is possible to switch between all lamps so I'm able to select which lamp visu I want to display. A primitive pseudo code could look like this:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="err"&gt;If RequirementGreenLampL1 Then&lt;/span&gt;
&lt;span class="err"&gt;    // Switch to GreenLamp L1 visualization&lt;/span&gt;
&lt;span class="err"&gt;Elsif RequirementGreenLampL2 Then&lt;/span&gt;
&lt;span class="err"&gt;    // Switch to GreenLamp L2 visualization&lt;/span&gt;
&lt;span class="err"&gt;Elsif RequirementRedLampL3 Then&lt;/span&gt;
&lt;span class="err"&gt;    // Switch to RedLamp L3 visualization&lt;/span&gt;
&lt;span class="err"&gt;End_If&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;I can't finde any VisuElems documentation. I'm looking for functions/methods to pass the data to the corresponding visualization and to show this visualization in the main visualization. A frame would be good.&lt;/p&gt;
&lt;p&gt;Note: This should be an easy to understand example. The real application will have more custom types (machines with settings visu).&lt;/p&gt;
&lt;p&gt;Does someone have any clue how to do it?&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>