Indexing RobotStudio Paths
jwinne
✭
I have used RobotStudio to develop my paths and now would like to write
a simple PROC to index through those paths.
RobotStudio created, "Path1", "Path2", "Path3", etc. I have 290 paths. And
rather than write a PROC with 290 lines of code, I would like to do
something like:
FOR X FROM 1 to 290 DO
PATH{x}
ENDFOR
But how do you identify a PROC as a VAR? Or can you? This would make
my code much shorter. And easier to read. I have several similar
scenarios like this in my program.
a simple PROC to index through those paths.
RobotStudio created, "Path1", "Path2", "Path3", etc. I have 290 paths. And
rather than write a PROC with 290 lines of code, I would like to do
something like:
FOR X FROM 1 to 290 DO
PATH{x}
ENDFOR
But how do you identify a PROC as a VAR? Or can you? This would make
my code much shorter. And easier to read. I have several similar
scenarios like this in my program.
0
Comments
-
Hi,
Use the rapid instruction CallByVar.
Here is the description from the reference manual:
CallByVar - Call a procedure by a variable
CallByVar (Call By Variable) can be used to call procedures with specific names, e.g.
proc_name1, proc_name2, proc_name3 ... proc_namex via a variable.
Examplereg1 := 2;
CallByVar "proc", reg1;
The procedure proc2 is called.Best regards,
Anders Spaak
ABB Robotics0 -
Hello!
I dont know if this is the best or shortest syntax to handle it but you can do something like this!
MODULE Index
LOCAL VAR num nPath;
PROC main()
nPath:=0;
FOR i FROM 1 TO 290 DO
incr nPath;
%"Path"+NumToStr(nPath,0)%;
ENDFOR
ENDPROC
ENDMODULEMODULE Paths
PROC Path1()
! Your instructions
ENDPROC
PROC Path2()
! Your instructions
ENDPROC
PROC Path3()
! Your instructions
ENDPROC
! TO Path 290
ENDMODULE0 -
Thanks! Along those same lines I have set up an array of
"alt_stop{290}" which is used to change "stop1", "stop2", "stop3", etc. In
using the "Offs" function I would like to use the same index format, like:
For x FROM 1 to 290 DO
alt_stop{x}:= Offs(stop{x}, 0, 10, 10);
ENDFOR
However, "stop" is a constant and therefore not indexable. There are 290
"stop"s. RobotStudio generated "stop" so there is not much I can do with
them.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