Universal Robots Forum

Adding Label in manual generated script


In my URCap, I create program nods and manually generate script. I mostli use move and waypoint nodes. I wanna add som complex/clever actions in between but I don’t waana showi those action in program tree. Actually that’s the reason why i generate script manually. The issue is that when the script is generated automatically, by method ScriptWriter.writeChildren(), label with node number and name are added. In script manual we can read:

“Program label code lines, with an “$” as first symbol, are special lines in programs generated by PolyScope that make it possible to track the execution of a program.”


$ 2 “var_1= True”
global var_1= True

Thanks to these labels, we can keep track of currently executed program step indicated by the arrow (like shown below).


Fragment of auto-generated script with labels

while (True):
    $ 1 "Robot Program"
    $ 2 "MoveJ"
    $ 3 "Waypoint_1" "breakAfter"
    movej(get_inverse_kin(Waypoint_1_p, qnear=Waypoint_1_q), a=1.3962634015954636, v=1.0471975511965976)
    $ 4 "Waypoint_2" "breakAfter"
    movej(get_inverse_kin(Waypoint_2_p, qnear=Waypoint_2_q), a=1.3962634015954636, v=1.0471975511965976)
    $ 5 "Waypoint_3" "breakAfter"
    movej(get_inverse_kin(Waypoint_3_p, qnear=Waypoint_3_q), a=1.3962634015954636, v=1.0471975511965976)
    $ 6 "Waypoint_4" "breakAfter"
    movej(get_inverse_kin(Waypoint_4_p, qnear=Waypoint_4_q), a=1.3962634015954636, v=1.0471975511965976)
    $ 7 "Waypoint_5" "breakAfter"
    movej(get_inverse_kin(Waypoint_5_p, qnear=Waypoint_5_q), a=1.3962634015954636, v=1.0471975511965976)
    $ 8 "Waypoint_6" "breakAfter"
    movej(get_inverse_kin(Waypoint_6_p, qnear=Waypoint_6_q), a=1.3962634015954636, v=1.0471975511965976)
    $ 9 "Waypoint_7" "breakAfter"
    movej(get_inverse_kin(Waypoint_7_p, qnear=Waypoint_7_q), a=1.3962634015954636, v=1.0471975511965976)

How can I generate such labels manually? Is there some method to get actual program node number?

Or maybe there is a way to insert own script between automatically generated ones? Method ScriptWriter.writeChildren() return script for all subnode at once so I can’t insert anything between.