Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Variables $placeholders$ in visualisations, like in v.2.x ?

pnn
2016-06-28
2021-05-06
  • pnn - 2016-06-28

    Hi,

    in Codesys 2.3 it's possible to use placeholders in visu elements configuration, that is to define a variable like this

    Drive_$x$.Start

    Then if we specify that x should be 5 for a specific visu, the above becomes Drive_5.Start

    Is it possible to do the same in v.3.5.x ? I can't see it anywhere.

    Thanks

     
    πŸ‘
    1
  • JAPIB

    JAPIB - 2016-07-09

    Hello

    Each visualization page has an interface (like FB) on witch you can define variables.
    To do this select the command Visualization βž” Interface editor
    Uses this variables to set your animation on the visualization.

    When you place this visualization like a frame, you can acces this variables by reference properties and affect the value or the variables from your application.

    You have to read the Help file "CODESYS Visualisation", chapter "Creating a Structured User Interface", su chapter "Calling Visualization with Interface".

    Best regard

     
  • onstage - 2020-12-15

    Trying to do exactly the same thing as pnn, having 24 identical POU:s which I would like to interface with just one VISU so I don't have to change in 24 places when customer has ideas of look-and-feel.

    Using frame I've managed to switch visualization, but that doesn't make this a walk in the park. (Which Codesys 2.3 would have done using the placeholders)

    Can anyone point me in the right direction?

     

    Last edit: onstage 2020-12-15
    • Morberis

      Morberis - 2020-12-15

      Here you go. If you can't seem to find it in the help file just search a visualization element type like 'Rectangle' and look 'Text' for a link to the placeholders.

       
  • onstage - 2020-12-15

    Dear Morberis, Perhaps I expressed myself a bit unclear. What I would like to achieve is a placeholder for a part of the variable name, just like pnn wrote.

    In my case the POU:s are named P_Axis01..P_Axis24. Displaying the same variable from each POU was super easy in CoDeSys 2. Just insert a placeholder within dollar-signs in the element attribute and then choose what the placeholder should be substituted with in that entire visu. E.g. P_Axis$ID$.bVariable could be substituted with 01..24 at runtime.

     

    Last edit: onstage 2020-12-15
  • onstage - 2021-04-25

    Being back at this very project the question regarding placeholders still arises. My German ist quite weak , but from what I've managed to read in German-speaking forums the function doesn't exist in V3.xxx. I've played around with various uses of input variables and pragmas of the visu, but can't achieve my goal. Can someone with knowledge please verify that this is the case, so I can break down and carry on with my life?

     
  • hence.persson - 2021-04-26

    I don't think so BUT you have the possibility to give in/out variables to a visu..

    This could be used for example making valve faceplates then connecting them to the corresponding valve object..

    If you have your valves in an array you could have a input variable valve no and have the visu connected to the valve array and get a somewhat equal behaviour as you describe..

     
  • JAPIB - 2021-04-26

    Hello,
    I think what you want to do is not possible directly in the view page.
    A solution, unfortunately more complicated, could be to define a variable in the interface editor (for example InternalVar), then, by program, to transfer the value of the variable of each program module in this display variable according to the axis you want. visualize

    For example :
    CASE AxisNum OF
    1 : InternalVar:= P_Axis01.. ;
    2 : InternalVar:= P_Axis02.. ;
    ........
    24 : InternalVar:= P_Axis24.. ;
    END_CASE;

    BR

     

    Last edit: JAPIB 2021-04-26
  • Chris.O - 2021-05-06

    Hi,

    some time ago I had the same problem. My last information was that this placeholders are not longer available.
    As alternative we use Structs.
    Mean:
    We create a visualization makro and use there a Struct like "Drive_x". Inside this struct we have than e.g. Start:Bool;
    This struct you can declare inside this Makro as VAR_IN_OUT. So inside the Marko you can then use the declared Makro. From outside you can then use a struct as interface.

    Attached you can find a short example.

    If this placeholders exist again... please inform me :-)

    BR Chris

     

Log in to post a comment.