Use Iterated User Data Types
jawojtek
✭
Hi.
Need to use numbers in variable names and use them (numbers) in loops. To iterate them.
I have a data type with 10 elements of two-dimensional arrays.
I want to use them to store data from SICK IVC-2D camera - read/write product's positions.
I decrease no. of elements to 3 to simplify case:
RECORD poseCol
pose p0, pose p1, pose p2
ENDRECORD
VAR poseCol poseCollection_0;
VAR poseCol poseCollection_1;
VAR poseCol poseCollection_2;
I cannot use array in RECORD statement - so I have to use such a structure.
I need to read/write all elements from all poseCol variables.
I tried to use '%' but I think it works only for PROC:
FOR i FROM 0 TO 2 DO
%"poseCollection_0.p"+NumToStr(i,0)% := ....;
ENDFOR
Does anybody know solution for such a task?
Furthermore because I cannot use arrays in RECORD statement I cannot use DIM function to make my code more flexible.
Need to use numbers in variable names and use them (numbers) in loops. To iterate them.
I have a data type with 10 elements of two-dimensional arrays.
I want to use them to store data from SICK IVC-2D camera - read/write product's positions.
I decrease no. of elements to 3 to simplify case:
RECORD poseCol
pose p0, pose p1, pose p2
ENDRECORD
VAR poseCol poseCollection_0;
VAR poseCol poseCollection_1;
VAR poseCol poseCollection_2;
I cannot use array in RECORD statement - so I have to use such a structure.
I need to read/write all elements from all poseCol variables.
I tried to use '%' but I think it works only for PROC:
FOR i FROM 0 TO 2 DO
%"poseCollection_0.p"+NumToStr(i,0)% := ....;
ENDFOR
Does anybody know solution for such a task?
Furthermore because I cannot use arrays in RECORD statement I cannot use DIM function to make my code more flexible.
Wojciech Wlodarski
PLABB
PLABB
0
Comments
-
Have you tried the SetDataVal command, i have used this for a similar situation before. It allows you to build a string and use that to specify the variable name.0
-
No, I have not... and I think I should
GetDataVal and SetDataVal should solve most of the problems.Thanks!BRWojciech Wlodarski
PLABB0
Categories
- All Categories
- 5.5K RobotStudio
- 396 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.8K Robot Controller
- 316 IRC5
- 61 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 800 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings