Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
IF else commands in Robodk
#1
Hello RDK People

Im really new in roboDK. Regarding that i have maybe a really "stupid" question, but i havent found a soultion from robodk help to solve it .

I have made 2 diffrent movement programs in robodk. Let´s call them Prog1 and Prog 2.
Now i want make condition if and else. 
How i can do it in RoboDK ? 

I can generate main program, that will run first Prog1 then Prog2, and edit it by hand and add the conditions.
Like that, but i hope RoboDK has better solution inside the program how to do it
Code:
%%%
 VERSION:1
 LANGUAGE:ENGLISH
%%%

MODULE MOD_MainProgram

PERS tooldata rdkTool := [TRUE,[[0,0,0],[1,0,0,0]],[20,[0,0,200],[1,0,0,0],0,0,0.005]];

PROC MainProgram()
!Program generated by RoboDK v5.2.1 for ABB IRB 6400 2.8 120 on 11/02/2021 20:34:18
!Using nominal kinematics.
if andur_1=HIGH THEN
Prog1;
else
Prog2;
ENDIF
ENDPROC

PROC Prog1()
MoveJ [[2145.000,0.000,1143.934],[0.70710678,0.00000000,0.70710678,0.00000000],[0,-1,-1,1],[9E9,9E9,9E9,9E9,9E9,9E9]], v200, fine, rdkTool;
MoveJ [[2145.000,870.641,1143.934],[0.70710678,0.00000000,0.70710678,-0.00000001],[0,0,-1,1],[9E9,9E9,9E9,9E9,9E9,9E9]], v200, fine, rdkTool;
MoveJ [[2145.000,870.641,1981.626],[0.70710678,0.00000000,0.70710678,0.00000000],[0,0,-1,1],[9E9,9E9,9E9,9E9,9E9,9E9]], v200, fine, rdkTool;
MoveJ [[2145.000,3.905,1981.626],[0.70710678,-0.00000001,0.70710678,0.00000000],[0,0,-1,1],[9E9,9E9,9E9,9E9,9E9,9E9]], v200, fine, rdkTool;
MoveJ [[2145.000,889.036,1158.989],[0.70710678,-0.00000001,0.70710678,0.00000000],[0,0,-1,1],[9E9,9E9,9E9,9E9,9E9,9E9]], v200, fine, rdkTool;
ENDPROC

PROC Prog2()
MoveJ [[2145.000,0.000,2075.000],[0.70710678,-0.00000001,0.70710678,0.00000000],[0,0,-1,0],[9E9,9E9,9E9,9E9,9E9,9E9]], v200, fine, rdkTool;
MoveJ [[2145.000,41.161,2382.972],[0.70710678,0.00000000,0.70710678,0.00000000],[0,1,-2,1],[9E9,9E9,9E9,9E9,9E9,9E9]], v200, fine, rdkTool;
MoveJ [[2145.000,695.675,2382.972],[0.70710678,0.00000000,0.70710678,0.00000000],[0,1,-2,1],[9E9,9E9,9E9,9E9,9E9,9E9]], v200, fine, rdkTool;
MoveJ [[2145.000,695.675,2135.282],[0.70710678,-0.00000001,0.70710678,0.00000000],[0,1,-2,1],[9E9,9E9,9E9,9E9,9E9,9E9]], v200, fine, rdkTool;
MoveL [[2145.000,55.244,2135.282],[0.70710678,0.00000001,0.70710678,0.00000001],[0,1,-2,1],[9E9,9E9,9E9,9E9,9E9,9E9]], v200, fine, rdkTool;
ENDPROC

ENDMODULE

.
#2
If/then/else statements are not supported when you use the UI. Your workaround is the best way to go unless you want to use the API. For example, you could write a small script that emulates your logic and triggers the corresponding program.

I'm sorry we can't be of more help at this moment.
  




Users browsing this thread:
1 Guest(s)