Universal Robots Forum

Run script or single line of code while in programming mode

Title says it all. I’d like to run a script (i.e. set_tcp()) or a single line of code while in programming mode. Currently I put the code at the beginning of my program, add a halt command, then run the program. However, sometimes what I need to do is further along in the program and I have to run the program for a while and wait until it gets to the point that I need.


As long as the code doesn’t depend on anything before it, you can just click the line you want to start at, and then press play. The second option down that pops-up is “Play from selection.”

I should have specified CB series. :frowning:

Seems like all the development is for e-Series and CB only gets bug fixes.

Sorry to hear that. Although before they added this to e-series, I was doing exactly what you have been doing with the halt for making sure my tcp’s were set when adjusting poses.

The other way you might solve this on a CB3 is to use a thread to execute the command. You can do this as long as the command you are executing does not do any actual motion (example - stopL() or moveJ() commands would not be allowed in a thread). The set_tcp command COULD be executed this way within a thread. Alternatively you could use an event and have a boolean trigger the event to execute the code.

Hi @nnaylor,

If you just only focus on the TCP change during the program, you could use set command with the test button in your CB3 robot.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.