Is it possible for the UR to work out a value divided by 13 and use the given value as count on when to stop

Hello,

I have an application for a cnc tending UR10, we require the direct labour to input a batch number and from that number the robot to divide it by 13 and use the answer as value for a separate loop to place a part in an inspection location.
Is it possible without URscript or if it is isnt how to programme it in URscript.

Cheers

If you want to keep the Loop node and terminate early you can do something like this using the break command for early loop termination:

batch_number = get user input command

Your Loop_1 Node:
    # Fine tune this logic with >, >=, ceil/ floor etc.
    if Loop_1 > (batch_number / 13):
        break
    
    do_stuff()

Lots of ways to do it. We tend to create script functions for this kind of stuff.

Here’s a script which will ask for a value, divide by 13 & truncate, then show that value:

file location_num.script:

def location_num():

global batch_num=request_integer_from_primary_client(“Enter Batch Number:”)

global location_number = floor(batch_num/13)

popup(location_number,“Location Number:”)

end

Load the script file in the BeforeStart section, then call the function in the program where needed.

def location_num():

    global batch_num=request_integer_from_primary_client(“Enter Batch Number:”)

    global location_number = floor(batch_num/13)

    popup(location_number,“Location Number:”)

end

It’s simple to do without URScript, as well. :slight_smile: There shouldn’t be a need to floor/ceil the calculated inspection interval.