|
| 1 | +from robolink import * # RoboDK API |
| 2 | +RDK = Robolink() |
| 3 | + |
| 4 | +program = RDK.ItemUserPick('Select a program (make sure the program does not change the robot speed)', ITEM_TYPE_PROGRAM) |
| 5 | + |
| 6 | +# Retrieve the robot linked to the selected program |
| 7 | +robot = program.getLink(ITEM_TYPE_ROBOT) |
| 8 | + |
| 9 | +# Output the linear speed, joint speed and time (separated by tabs) |
| 10 | +writeline = "Linear Speed (mm/s)\tJoint Speed (deg/s)\tCycle Time(s)" |
| 11 | +print(writeline) |
| 12 | +# Prepare an HTML message we can show to the user through the RoboDK API: |
| 13 | +msg_html = "<table border=1><tr><td>"+writeline.replace('\t','</td><td>')+"</td></tr>" |
| 14 | + |
| 15 | +for speed_lin in [1, 5, 10, 20, 50, 100, 200, 500]: |
| 16 | + for speed_joints in [1, 5, 10, 20, 50, 100, 200, 500]: |
| 17 | + # Set the robot speed |
| 18 | + robot.setSpeed(speed_lin, speed_joints) |
| 19 | + |
| 20 | + # Update the program and retrieve updated information: |
| 21 | + # https://robodk.com/doc/en/PythonAPI/robolink.html#robolink.Item.Update |
| 22 | + result = program.Update() |
| 23 | + instructions, time, travel, ok, error = result |
| 24 | + |
| 25 | + # Print the information |
| 26 | + newline = "%.1f\t%.1f\t%.1f" % (speed_lin, speed_joints, time) |
| 27 | + print(newline) |
| 28 | + msg_html = msg_html + '<tr><td>' + newline.replace('\t','</td><td>') + '</td></tr>' |
| 29 | + |
| 30 | +msg_html = msg_html + '</table>' |
| 31 | + |
| 32 | +RDK.ShowMessage(msg_html) |
0 commit comments