Robtargets to array

Hi

Is thear an easy way to convert robtargets to an array? For exampel when you creat a lot of targets in studio simulaition the are all defined with theire own name. An when I move them to the real controller and want to use them in an array, I have to manual reorganize/copy them to an array. Of course I could creat som WHILE/FOR loops and use the SetDataSearch/GetNextSym functions to automaticly move them to array.

Some good advices?

Sorry for my bad english

-Rick

Tagged:

Answers

  • John_Verheij
    John_Verheij Netherlands ✭✭
    It depends on the names of the robtargets. You can do something like this:

    <div>MODULE MainR1<br></div><div>&nbsp;&nbsp;<br></div><div>&nbsp; PERS robtarget p1 := [[1000,0,400],[0,1,0,0],[0,0,0,0],[9e9,9e9,9e9,9e9,9e9,9e9]];<br></div><div>&nbsp; PERS robtarget p2 := [[1000,0,500],[0,1,0,0],[0,0,0,0],[9e9,9e9,9e9,9e9,9e9,9e9]];<br></div><div>&nbsp; PERS robtarget p3 := [[1000,0,600],[0,1,0,0],[0,0,0,0],[9e9,9e9,9e9,9e9,9e9,9e9]];<br></div><div>&nbsp; PERS robtarget p4 := [[1000,0,700],[0,1,0,0],[0,0,0,0],[9e9,9e9,9e9,9e9,9e9,9e9]];<br></div><div>&nbsp; PERS robtarget ps{4};<br></div><div>&nbsp;&nbsp;<br></div><div>&nbsp; PROC main()<br></div><div>&nbsp; &nbsp; VAR robtarget pTemp;<br></div><div>&nbsp; &nbsp;&nbsp;<br></div><div>&nbsp; &nbsp; FOR i FROM 1 TO 4 DO<br></div><div>&nbsp; &nbsp; &nbsp; GetDataVal "p" + ValToStr(i), pTemp;<br></div><div>&nbsp; &nbsp; &nbsp; ps{i} := pTemp;<br></div><div>&nbsp; &nbsp; ENDFOR<br></div><div>&nbsp; &nbsp;&nbsp;<br></div><div>&nbsp; ENDPROC<br></div><div>&nbsp;&nbsp;<br></div><div>ENDMODULE</div>

  • Ricki
    Ricki Finland

    Thanks for the answer, already did that. But isn’t this something that could be done offline in studio when synchronize sing targets to rapid? Or when you have lots of targets in same path?