RAPID - Get tooldata by name [MOVED]
is there a way to get a tooldata object by its name?
var tooldata tool1 = ....
var tooldata tool2 = ....
var string name = "tool1";
var tooldata currentTool = STR_TO_TOOLDATA(name)
Any help would be appreciated,
ASC
Comments
-
Hello, you can use GetDataVal for this:
here i made quick exemple :
PERS tooldata tool1:=[TRUE,[[1,0,0],[1,0,0,0]],[0.001,[0,0,0.001],[1,0,0,0],0,0,0]];
PERS tooldata tool2:=[TRUE,[[2,0,0],[1,0,0,0]],[0.001,[0,0,0.001],[1,0,0,0],0,0,0]];
PERS tooldata currentTool:=[TRUE,[[1,0,0],[1,0,0,0]],[0.001,[0,0,0.001],[1,0,0,0],0,0,0]];
PROC main()
STR_TO_TOOLDATA currentTool,"tool1";
waittime 3;
STR_TO_TOOLDATA currentTool,"tool2";
waittime 3;
ENDPROC
PROC STR_TO_TOOLDATA(inout tooldata tooldat,string toolname)
VAR tooldata tooltemp;
getdataval toolname,tooltemp;
tooldat:=tooltemp;
ENDPROCBR
Peter
0 -
Hi,
thanks a lot, this is exactly what i was looking for.
Regards,
ASC
0 -
Hi,
you can also use the function ArgName to get the name of the tool.
Example:
VAR string stToolName;
TASK PERS tooldata tGripper:=--
TPwrite "Tool name: "+ArgName(tGripper);
In case of you want to get or set the current tool, work object or loaddata you can also use the instructions GetSysData or SetSysData.
Best regards
Micky
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