Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

For Loop in RoboDK

#1
Hello Everyone,

I was generate ABB robot program using robodk and edit manually to use for loop (i need to change Z height every loop). Is there possible way to use "for" loop and program it inside RoboDK without manually edit after generate program? Thanks

regards,
Irham

Code:
FOR i FROM 20 TO 70 DO

MoveL [[1856.510,539.272,15.000 + (i-1)*15],[0.00000000,-0.07483079,0.99719625,0.00000000],[-1,0,-1,1],[2008.240000,9E+09,9E+09,9E+09,9E+09,9E+09]],[120.00,500,5000,1000],z1,Tool3 \WObj:=Wobj_print;

MoveL [[1856.060,537.297,15.000 + (i-1)*15],[0.00000000,-0.07483079,0.99719625,0.00000000],[-1,0,-1,1],[2007.790000,9E+09,9E+09,9E+09,9E+09,9E+09]],[120.00,500,5000,1000],z1,Tool3 \WObj:=Wobj_print;

MoveL [[1855.670,535.409,15.000 + (i-1)*15],[0.00000000,-0.07483079,0.99719625,0.00000000],[-1,0,-1,1],[2007.390000,9E+09,9E+09,9E+09,9E+09,9E+09]],[120.00,500,5000,1000],z1,Tool3 \WObj:=Wobj_print;

MoveL [[1850.610,511.385,15.000 + (i-1)*15],[0.00000000,-0.07483079,0.99719625,0.00000000],[-1,0,-1,1],[2002.340000,9E+09,9E+09,9E+09,9E+09,9E+09]],[120.00,500,5000,1000],z1,Tool3 \WObj:=Wobj_print;

ENDFOR
#2
You can add the FOR/ENDFOR loop as an insert code instruction in RoboDK.

Then, you can enable the simulation of flow control statements with your station by following these steps:
  1. Right click the root of your station
  2. Select Station parameters
  3. Check the option Enable flow control statements
However, the parametric coordinates won't be automatically calculated when you generate the program unless you customize your post processor.
#3
Hi Albert,

Can you help me using the For loop in the insert code command?
I am using RoboDK 6.0.6

I want to use For loop in the main program for running a specific code 7 times. 
I wrote the following code in insert code command;

i = 1
FOR i = 1 TO 7 

ENDFOR

I have enabled 'Enable Flow Control Statements' option in the station parameters. 
After executing the program, I can not see i value incremented. It is showing error " SyntaxError: Expected token `,' "
How to solve this? And is there any documentation for how to use loops and conditional statements in the insert code command?

Any help would be appreciated. Thanks!!
#4
I got back to you on this other thread:
https://robodk.com/forum/Thread-For-loop...odk-V5-5-3
  




Users browsing this thread:
1 Guest(s)