Variable robtarget name
Hi,
Is it possible to define a variable robtarget name and use it?
Something like:
VAR STRING targetname;
VAR robtarget target1:=[[0,0,0],[...etc
VAR robtarget target2:=[[0,0,0],[...etc
VAR robtarget target100:=[[0,0,0],[...etc
VAR num x{100}:={0,0,0,0,....,0};
FOR i FROM 1 TO 100 DO
targetname:="target"+NumToStr(i,0);
x{i}:=targetname.trans.x+10;
ENDFOR
Thanks
Comments
-
x{i}:=targetname.trans.x+10;
in your code targetname is a string varibale, can't use targetname.trans.x
where do u use this program? maybe u can find other way to program.
Peter_ABB2008-4-16 15:54:45Peter0 -
Sorry, that code won't be possible, late binding is only valid for procedure calls and such. You'd like something like .Net's 'FOREACH (Robtarget rt in ...)'
Are you just trying to add 10mm to the x value of each target in the array? Just put all the targets in the array to begin with, and then go:
VAR num x{100}:=[[0,0,0,0,....,0] ... ];
FOR i FROM 1 TO Dim(x,1) DO
x{i}.trans.x:=x{i}.trans.x+10;
ENDFOR
0 -
hi,
with the option advanced rapid you can use the instruction getdataval.
Then your programm can look so:
VAR robtarget targetname;
VAR robtarget target1:=[[0,0,0],[...etc
VAR robtarget target2:=[[0,0,0],[...etc
VAR robtarget target100:=[[0,0,0],[...etc
VAR num x{100}:={0,0,0,0,....,0};
FOR i FROM 1 TO 100 DO
GetDataVal "target"+NumToStr(i,0),targetname;
x{i}:=targetname.trans.x+10;
ENDFOR
0 -
Thats a nice solution Thilbi, didn't think of that!
Just a note, as of 2008, Advanced Rapid is included in the standard robotware.
0
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