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

How to change list of referenced visualizations of a frame by programm? (NOT how to switch vis!)

selli69
2019-03-29
2023-06-01
  • selli69 - 2019-03-29

    Hi there!

    I want to change the registered visualisations of a frame by programm. Is this possible? And if so, how can I do this? Is the FrameManager a starting point for this? The documentation is a little sparse on these topics.

    Thanks forward.

     
  • selli69 - 2019-03-29

    Thanks for the quick reply. I have checked this example (and learned a lot from it!). But my problem is not to switch visualisations. I want to change the list of registered visualisations of a frame. Background is, that I have ~100 Frames and ~25 different visualisations which can appear in these frames. The number of visualizations will grow during the development process and I dont want to edit the registrated visualizations for all the frames by hand everytime there is a change.

    Now I experiment with the IFrameManger.RegisterFrame() function. But I have no clue what the parameters for this methods mean. The first one seems to be the path to the frame element...

     
  • Victor Kulikov - 2019-04-23

    Hi, did you find something on topic?
    Very interested on the same thing and got stuck on RegisterFrame too.

     
  • m.prestel - 2019-04-24

    Hello Victor and selli,

    it is currently not possible to dynamically register a visu for a frame.

    The interface you found is used to register an absolute path to a specific frame, which then will be used for the input action "switch frame visualization".

    Hope this clears up some confusion!

    Best regards,
    Marcel

     
  • selli69 - 2019-04-24

    @ Marcel: Thanks for clearing things up!

    @Victor: By now I use a bunch of Auto-It scripts to generate my frame structure by my demands.

     
  • Victor Kulikov - 2019-04-25

    Marcel and selli69, thank you so much!

    Auto It, great! I use the similar things to automate what can't be automated, but with codesys I didn't loose hope yet...
    Digging into the problem, I was able to show visu in empty frame from debug mode. And so, I believe it is possible to do this from program (working on it now).
    The other problem I see here is following, when we manually configure References for frame, codesys generates instaces for each visu in each frame, and puts them to the instance of parent visu, if we don't configure References, we can programmatically (i believe) switch frame to instanse of existing visu, but there would be only one instance of that visu. Then it would be hard or impossible to show different data in the same visu which is displayed in different frames (this is my goal).

    Marcel, it would be nice if I could use the type "TheNameOfMyVisu__vis" in declaration part of POU, I think it would solve my problem, but because of "__" it gets red and doesn't compile.

     
  • m.prestel - 2019-04-26

    Victor Kulikov hat geschrieben:
    Marcel, it would be nice if I could use the type "TheNameOfMyVisu__vis" in declaration part of POU, I think it would solve my problem, but because of "__" it gets red and doesn't compile.

    I do not understand what you are trying to say.As I said it is currently not possible to dynamically register a visu for a frame when online.

    Best regards,
    Marcel

     
  • Victor Kulikov - 2019-04-29

    m.prestel hat geschrieben:
    As I said it is currently not possible to dynamically register a visu for a frame when online.

    Fortunately this is not true )

    https://cloud.mail.ru/public/27oc/tY63pYioz
    (wasn't able to attach video here)

     
  • m.prestel - 2019-04-29

    Hello Victor,

    wanna provide an example?

    Best regards,
    Marcel

     
  • Victor Kulikov - 2019-04-29

    Hi Marcel,

    Sure, here it is!

    I know it's hacky, but works. By the way, in this project on my installation, button in frame doesn't recover its unpressed look, but in the project for my PLC it works well.

    I know there is a risk it can behave not always as expected.

    If you are a developer or close to them, is there any chance you could provide any docs on internal structure of visual entities and how do they interact with eachother and other parts of the program?

    Regards,
    Victor

    openVis.project [176.79 KiB]

     
  • Victor Kulikov - 2019-04-29

    Let me try to explain my task.

    Imagine, I have 50 different types of entities, each entity is defined by FB and has corresponding visu.
    I have hords of instances of such FBs, and I want to show about 16 visus attached to corresponding FBs on one screen. I don't want to configure 50+ references for each frame manually and want to do this programmatically.

    Now I have a technicue to open visus, but I lack the main thing: I need somehow to transfer different pointers or indexes of entities to visu opened in different frames.

    When I open same visu in 2 frames and try to change color, or something in one frame, it changes simultaneously in both frames. This is because actually it is 2 views of the same instance of visu. The only way I see, is to create more instances... I see, codesys creates a TYPE for each visu, and names it like: "TheNameOfMyVisu__vis". I believe, if I could instantiate this type in GVL or some POU, I could use those different instances of visu in different frames and then attach different data through their VAR's.

    The problem is I can't use "TheNameOfMyVisu__vis" type in geclaration. I suspect, the only problem here is "" in the name of type. It is somehow prohibited to write "" in both declaration and program parts of ST editor. Any word which contains "__" gets red in editor.

    The only way further I see is to copy existing instance of visu several times and then attach copies to the frames....

     
  • m.prestel - 2019-05-10

    Hello Victor,

    that is what I meant by saying that it is currently not support.

    Yes there are ways to change a reference but no way to get the different data to the reference.

    Best regards,
    Marcel

     
    • sbt-277 - 2023-06-01

      Now, four years later... Is it now possible?

      I do need exactly this functionality - change the visualization reference at runtime by programm code.

       

      Last edit: sbt-277 2023-06-01

Log in to post a comment.