# RAPID - Get tooldata by name \[MOVED\]

**URL:** <https://tech-community.robotics.abb.com/t/rapid-get-tooldata-by-name-moved/6099>\
**Category:** Robot Controller\
**Created:** [April 29, 2014, 4:28pm UTC](https://tech-community.robotics.abb.com/t/rapid-get-tooldata-by-name-moved/6099 "2014-04-29T16:28:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![apox](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/apox/32/2392_2.png) [@apox](https://tech-community.robotics.abb.com/u/apox)\
**Post date:** [April 29, 2014, 4:28pm UTC](https://tech-community.robotics.abb.com/t/rapid-get-tooldata-by-name-moved/6099/1 "2014-04-29T16:28:54Z")

</div>

Hi,

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

---

<div class="post-metadata">

**Author:** ![kioog](https://avatars.discourse-cdn.com/v4/letter/k/e47c2d/32.png) [@kioog](https://tech-community.robotics.abb.com/u/kioog)\
**Post date:** [April 30, 2014, 10:26am UTC](https://tech-community.robotics.abb.com/t/rapid-get-tooldata-by-name-moved/6099/2 "2014-04-30T10:26:15Z")

</div>

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;  
ENDPROC

BR

Peter

---

<div class="post-metadata">

**Author:** ![apox](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/apox/32/2392_2.png) [@apox](https://tech-community.robotics.abb.com/u/apox)\
**Post date:** [April 30, 2014, 9:19pm UTC](https://tech-community.robotics.abb.com/t/rapid-get-tooldata-by-name-moved/6099/3 "2014-04-30T21:19:24Z")

</div>

Hi,

thanks a lot, this is exactly what i was looking for.

Regards,  
ASC

---

<div class="post-metadata">

**Author:** ![Micky](https://avatars.discourse-cdn.com/v4/letter/m/a5b964/32.png) [@Micky](https://tech-community.robotics.abb.com/u/Micky)\
**Post date:** [May 6, 2014, 8:47am UTC](https://tech-community.robotics.abb.com/t/rapid-get-tooldata-by-name-moved/6099/4 "2014-05-06T08:47:13Z")

</div>

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
