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

Arrays of elements?

jjansen
2018-07-17
2018-07-18
  • jjansen - 2018-07-17

    I'm working on a project where I need to dynamically position lines on the screen. I have structures for what these lines represent, and they are in an array. Is there a way to create an array of lines so I can loop through and do something like:

    FOR i := 0 TO 10 DO
    .....line[i].Position.Points[0].X := bin[0].left;
    .....line[i].Position.Points[1].X := bin[0].right;
    END_FOR

    How and where would I declare such an array? Is there a structure somewhere that represents the positional data of the line?

    Thanks!

    Joe

     

    Related

    Talk.ru: 1

  • Lo5tNet - 2018-07-18

    You can do this using a polyline element in your visualization. Under the "Dynamic Points" properties of the element you specify a pointer to the points array. The structure of the points is VisuElems.VisuStructPoint. Some of your code would look like:

    VAR
        aGraphPoints        :    ARRAY[0..99] OF VisuElems.VisuStructPoint;
        iCount      :    INT;
    END_VAR
    FOR iCount := 0 TO 99 DO
        aGraphPoints[iCount].iX := SOMEVALUE_X[iCount];
        aGraphPoints[iCount].iY := SOMEVALUE_Y[iCount];
    END_FOR
    
     

Log in to post a comment.