CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum by 3S-Smart Software Solutions GmbH | A member of the CODESYS Group
Deutsche Version English version russian version 
It is currently Wed May 22, 2019 6:32 pm

All times are UTC+01:00

Post new topic  Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Arrays of elements?
PostPosted: Tue Jul 17, 2018 9:33 pm 

Joined: Wed Jan 03, 2018 3:51 pm
Posts: 1
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;

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



 Post subject: Re: Arrays of elements?
PostPosted: Wed Jul 18, 2018 3:58 pm 
Frequent User
Frequent User

Joined: Tue Dec 03, 2013 11:52 pm
Posts: 116
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:
    aGraphPoints        :    ARRAY[0..99] OF VisuElems.VisuStructPoint;
    iCount      :    INT;

FOR iCount := 0 TO 99 DO
    aGraphPoints[iCount].iX := SOMEVALUE_X[iCount];
    aGraphPoints[iCount].iY := SOMEVALUE_Y[iCount];

Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 2 posts ] 

All times are UTC+01:00

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited