I'm trying to create code to generate objects in a visualization and sort them like boxes on a pallet. I have been searching in different topics and I have not found anything similar. Could someone tell me if this option is possible?
On the other hand, can the width and length of a rectangle be modified? Because another option would be to create a specific number of objects and modify their position and size.
For me, if you can fix the number of objects, this is the best. Yes, rectangles can move. In its properties assign variables to Absolute movement, relative movement. These include position and scaling 'movements'.
You can generate these with multiply elements..
Thanks for your answer.
If I have understood this correctly, I will be able to multiply already created objects, correct?
Do you know any way to modify the width and length of the rectangles?
Using these properties you can also change the width/height of the rectangle (not only the top left position)
But I can't modify this property with a variable. I would like to modify this property based on a variable so that I can visualize the resizing in the product. I've seen that in scaling you can add a variable but this doesn't work for me.
Which codesys version are you using? For me (3.5.7) I can put variables there without problems. What is your compiler error? My variables are of type INT, maybe you are trying something different?
I get the following error when I enter the variable in the object property.
Looks like iHight is no variable of the INT data type. How have you declared iHight? And where have you declared it?
Try this in a global variable list or in a Program:
iHight : INT;
and then access the variable in the visu page like this: MyVariableList.iHight
If you have declared iHight within a program you will have to write the qualifier before the variable, so maybe that is your problem?
I have declared the variable as global without the attribute, anyway I tried to add access and I get the same message.
This is weird because the exact same setup works for me. I have one last idea:
Try initializing the values with a non-zero value (it should be the starting coordinate of your edge on the visualization canvas). So for example iWidth : INT := 100;
I hope this does the trick.
You cannot put variables into X/Y/Width/Height
Yes that is true! I thought we were talking about the movement variables!
thought the same, just wanna make sure we are all on the same page ;)
I see what happened:
m.prestel said: "Using these properties you can also change the width/height of the rectangle (not only the top left position)" and meant that you can use the "relative movement" properties to adjust the dimensions of the object. Try putting your variables there.
as i-campbell and m.prestel said, you can use the absolute movement property to move your elements on your visualization page.
You can use the relative movement property to "move" only the right/bottom edge of your object, which makes it possible to change the size of your visualization elements.
I am using this feature to "animate" some of my visualization pages and it works pretty good. I have tested it using up to 30 moved elements which did not slow my cycle time down (obviously this will depend on the hardware you are using). I would be interested if someone tried moving even more elements and observed performance issues.
How many objects would you be interested in?
I don't know - for my current scenario the 20 circles that I am moving are plenty. Will codesys restrict the number of moving elements at some point?
Log in to post a comment.