Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to call "IF else code using program call
#1
Hi, I would like to ask if I want to do an IF/Else condition using the program so for example if My IO_5 is 1 I would like to run "Program A" and if IO_5 is 0, I want to run " program B". just wondering if it's possible. 
If I have to use python to run the If Else, how do I call the program Example " Drop slot 4" that I created in Python. 

I have attached my FILe inside too.
#2
Hi Timothy,

I don't think that your attachment worked properly.

And to answer your question, yes you need to use Python to implement If/else statements.

--------------------------------------------------------
EDIT: The latest release of RoboDK lets you use IF and WHILE statements directly from the UI.

Jeremy
#3
Hi Jeremy, sorry I have reattached the file 
I have attached my FILe inside too. 

RE:
Hi, I would like to ask if I want to do an IF/Else condition using the program so for example if My IO_5 is 1 I would like to run "Program A" and if IO_5 is 0, I want to run " program B". just wondering if it's possible. 

If I have to use python to run the If Else, how do I call the program Example " Drop slot 4" that I created in Python. 


Attached Files Thumbnail(s)
   

.rdk   Capstone_V2.6(Add cap area).rdk (Size: 2.37 MB / Downloads: 107)
#4
Hi Timothy, 

Did you take a look at the Python API documentation? Here it is: https://robodk.com/doc/en/PythonAPI/intro.html

The API is not my strong point but I'm pretty sure you can do something like:

Code:
If RDK.getDI("NameOfTheInput") = True:
  RDK.RunProgram("NameOfTheProgram1")
else:
  RDK.RunProgram("NameOfTheProgram2")

Jeremy
#5
(07-11-2020, 11:36 AM)Timothychew Wrote: Hi Jeremy

Thank you so much!
  




Users browsing this thread:
1 Guest(s)