call large number of robtargets

Dear Community,

I am dealing with a very large number robtargets in many paths. I want to modify all of them. I changed the declaration from CONST to PERS as I need the modifications (e.g. point_10.trans.x:=point_10.trans.x + 5.32) to be permanent in the code. But how can I call all those robtargets (point_10 … point_10000) of a path with a single for-loop? Should be something like

var num number:=20
for number …
point_“+number+”.
number:=number+10
endfor

Thanks a lot.

Hi,

You need to use something like the below to be able use a variable with a Robtarget name.

VAR Robtarget TempRobtarget;
PERS Robtarget Point10;
PERS Robtarget Point20;

PROC PosChange()
FOR i FROM 10 to 20 STEP 10 DO
GetDataVal “Point”+ValToStr(i), TempRobTarget;
TempRobTarget.trans.x:= TempRobTarget.trans.x+20;
SetDataVal"Point"+ValToStr(i), TempRobTarget;
ENDFOR
ENDPROC

Hope this helps

Regards
Graeme

Dear Graeme,

great answer. Thanks a lot.

Regards

Tobias