robtarget:=robtarget+10

I’ve got a list/path that includes hundreds of points. I’d like to run through a certain drill/deburring operation at every point. Rather than creating a program where I move to every point and call the same routine after every point (resulting in a zillion page redundant program), is there any way I can increment a variable robtarget? These points are not spaced or oriented in any consistent pattern so I can’t just increment their components with trans or pose.

I’ve tried incrementing a variable num and writing that as an addendum to a string “Target_”, but passing the new string to a variable robtarget fails since the string doesn’t count as a reference/pointer or contain the right data type. What’s weird is that Programmaker tells me there are no errors in my program. But RobotStudios dies/can’t load the program as is. The relevant part in my short experimental program looks something like this (with everything defined appropriately):

WHILE point<50 DO

Apoint:=ValToStr(point);

newstring:=Atarget+Apoint;

ok:=StrToVal(newstring,Target_point);

MoveL Target_point,v200,z1,tool0WObj:=wobj0;

rDRILL;

point:=point+10;

ENDWHILE

And yes, I’m trying to do this WITHOUT having to resort to an array. But if that’s the only way to do it, could I please have the proper format/syntax for a robtarget array?

point starts as 10

Atarget:=“Target_”

continues browsing the manuals If there were something like CallByVar that worked for variables (persistant veriables?) instead of procedures only… then I think I’d be set!

Target_point:=(CallByVar(“Target_”,point));

MoveL Target_point,v200,z1,tool0WObj:=wobj0;

rDRILL;

point:=point+10;

I really wish this worked…

Hi
What you could do is create your own Move instruction which includes the stuff you want to do after the motion. Here is just a simple example how to do it, have also included the array stuff.

%%%
VERSION:1
LANGUAGE:ENGLISH
%%%

MODULE ABB
VAR robtarget myTarget{2}:=[[[0,0,0],[1,0,0,0],[0,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],[[0,0,0],[1,0,0,0],[0,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]]];
VAR robtarget myTarget1:=[[0,0,0],[1,0,0,0],[0,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
VAR robtarget myTarget2:=[[0,0,0],[1,0,0,0],[0,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
VAR robtarget myTarget3:=[[0,0,0],[1,0,0,0],[0,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];

!My special instruction
PROC MyMoveL(
robtarget mytarget,
speeddata myspeed,
zonedata myzone,
PERS tooldata mytool,
PERS wobjdata mywobj)

MoveL mytarget,myspeed,myzone,mytoolWObj:=mywobj;
!do the drill stuff
rDrill;
ENDPROC

!
PROC main()
!IF you want to loop thru the array of robtargets
FOR i FROM 1 TO 2 DO
MyMoveL myTarget{i},v200,z1,tool0,wobj0;
ENDFOR
!
!or just if you want to have the motion instruction in a flow
MyMoveL myTarget1,v200,z1,tool0,wobj0;
MyMoveL myTarget2,v200,z1,tool0,wobj0;
MyMoveL myTarget3,v200,z1,tool0,wobj0;
ENDPROC
ENDMODULE

But the question is, can you construct the robtarget name using a variable? For example, can you pass the robtarget name of “Rob_Move”+NumToStr(x,0) as a parameter to the subroutine as the name of the robtarget? I’m guessing that since the name, in this example, is constructed as a string that it will pass it as a string to the subroutine. If that is the case, you will get a type mismatch error.

Only the array portion of the suggested solution uses a variable to define which robtarget will be used. Can this be accomplished on non-arrayed robtargets that have similar names except for an identifier, such as Rob_Move1, RobMove2, RobMove3…RobMove20. ???

have done this before (years ago and cant remeber exactly the process)

I think I used GetDataVal

something like this;

GetDataVal “target”+ ValToStr(num), temprobtarget
MoveL temprobtarget

also answered the over in this post too;