Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Create script file to run on real robot
#1
Hello,
I created a python script and simulation on RoboDK,
then used Universal Robots URP for generate program.
Python:
   

Generated script file:
   

If, Else is not include in generated script file.
How I can fix it?
Thanks


Attached Files
.rdk   UR10e_sam.rdk (Size: 3.27 MB / Downloads: 22)
#2
Generating programs from the API will output the robot commands. If you have logic or loops in your Python code, they will be evaluated at the time you run your the script for program generation.

If you have specific code to output you can use RunCode to output custom code. Example:
Code:
robodk.RunCode("if a>0")
robodk.RunCode("  ProgramA()")
robodk.RunCode("else")
robodk.RunCode("  ProgramB()")
robodk.RunCode("end")
Some post processors understand statements such as if/then/else and may adjust the syntax if needed.
  




Users browsing this thread:
1 Guest(s)