dynamic target selection
Paba
✭
I want my program to select a specific target, based on the values of an array.
Short Example:
Proc SelectTarget<br> FOR i FROM 1 TO X DO<br> If array{i}=1 THEN<br> target:=%anothertarget+i%;<br> !command to exit for loop?<br> ENDIF<br> ENDFOR<br>ENDPROC<br>anothertarget1, 2, 3, .... are predefined targets.
I also tried
target:=%"anothertarget"+NumToStr(i)%;
but that didnt work either
What should be the right syntax here?
And is it possible to exit the for loop when if condition is set?
Tagged:
0
Comments
-
Think you're looking for GetDataVal and SetDataVal -- check them out in the Rapid Manual.
0 -
Not 100% sure on this but possibly try the following.....
Use the TEST and CASE method instead of using the IF statement. Also, use the "RETURN;" command or maybe just set "i:=0 after the condition has been set"0 -
firstpoint := "p" + NumToStr(i,0);GetDataVal firstpoint, target{i};
You can Return, I think or (a little more hacky) GOTO out of FOR NEXT. Or make into a WHILE DO.Lee Justice0 -
Here's another hackarific way:
VAR num nArrayPos
VAR robtarget pTempTargetCONST robtarget pArray{##}:=... ;...
nArrayPos:=1;
WHILE DInput(di_finished)=0 DOpTempTarget:=pArray{nArrayPos};MoveL pTempTarget, v1000, fine, t_yourTCP \WObj:=wobjyours;
Incr nArrayPos;ENDWHILE
...
Regarding the 'late binding' ... target:=%"anothertarget"+NumToStr(i)%; From the RAPID overview manual, "Note that the late binding is available for procedure calls only..."
Post edited by SomeTekk on1 -
Thanks for all the answers,GetDataVal was just the right thing i was looking for.Have a nice day0
Categories
- All Categories
- 5.5K RobotStudio
- 394 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 249 ScreenMaker
- 2.7K Robot Controller
- 309 IRC5
- 59 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 785 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 4 Job listings