Product (pattern) selection can be automated by setting the Product Selection Strategy variable “rf_product_selection_strategy”.

rf_product_selection_strategy chart

rf Variable

Configurable Values

Product Selection Strategy

Description

rf_product_selection_strategy

0

GUI

Uses Pattern Selector (Default selection)

1

First

Selects the first pattern in alphabetical order

2

Predefined

Selects a predefined pattern with a variable (see predefined below)

rf_product_selection_predefined = “my_pattern”

Product Strategy Descriptions

GUI - rf_product_selection_strategy = 0 (default selection)

A window is launched by the Pally GUI URCap where the desired pallet pattern can be selected from a list. Thus, the operator is prompted to select pattern. The list contains all patterns uploaded to the robot.

note

When using strategy 1 or 2, the Pattern Selector screen will not appear after you press the UR Play button

When using strategy 1 or 2, the Pattern Selector screen will not appear after you press the UR Play button

First - rf_product_selection_strategy = 1

The working directory is scanned for patterns and the first pattern is selected automatically. Hence, the sorting of the patterns define which pattern will be used. All pattern names must be set, taking this sorting in to consideration, for the right pattern to be selected with this strategy. If not, it’s adviced to use this strategy only when one single pattern file is present in the working directory. The sorting is done as follows:

  1. Letter case
    Primary sorting is uppercase before lowercase. See examples below:

    1. “Abc.json” before “abc.json”

    2. “ABc.json” before “Abc.json”

    3. “ABC.json” before “ABc.json”.

  2. Alphabetical
    Secondary sorting is alphabetical. Please note that since this is the secondary sorting, an uppercase letter will be sorted before a lowercase letter, no matter the alphabetical order. See example below:

    1. “B.json” before “a.json”

The option for starting or stopping on a partial pallet is not available when using this strategy. Continuing an existing pallet will be available as normal.

Predefined - rf_product_selection_strategy = 2

Automatically selects a predefined pattern from the uploaded patterns. Which pattern is predefined is decided by the variable “rf_product_selection_predefined”, which in turn can be set directly in a program node. It’s important to set the variable when using this strategy as it defaults to an empty text string. The variable should be set to the desired pattern file name (without the extension: .json).

Example:
Desired pattern file to be used is “my_pattern.json”. Thus, the variable should be set: rf_product_selection_predefined = “my_pattern”

Please note that the file name and the “name” field in the JSON file may be different, due to restrictions in the file system: special characters, accents, etc. are removed from the file name. Always use the file name when selecting the pattern programatically.

# Example content of "my_pattern.json"
{
    "name": "mÿ pättërn",
    "description": "",
    "dimensions": {
      "height": 123,
      "width": 123,
      "length": 123,
      "palletHeight": 1234
    },

The option for starting or stopping on a partial pallet is not available when using this strategy.

Using rf_product_selection_predefined in Dual Product mode:

It is possible to define two pattern file names in the following format:

"pattern1;:;pattern2"

(Use separator ";:;" between names)

This will instruct the program to palletize pattern1 from the primary conveyor and pattern2 from the secondary conveyor.

Continue the previous (incomplete) pallet or begin with a new pallet:

In Pally URCap version 2.10 or newer, it is possible to suppress the “Continue Existing Pallet” dialog and control what the program should automatically do with the existing pallet.

To continue the last pallet that was left incomplete when the program stopped, or start a new pallet with the pattern that is defined by the product selection strategy, do the following:

Older Pally versions can’t suppress the Continue Existing Pallet popup.

Example:

Consider a setup where each pattern name begins with a unique 4-digit number, and an external PLC system sends an integer value in order to choose the corresponding pattern to be palletized. It is possible to obtain the list of patterns from the Pallet Manager daemon and get the file name of each pattern json. Then use string manipulation functions in URScript to check if a pattern name matches a search criteria: the first 4 characters of the file name.

def FindPattern(unique_id):
  str_id = str_cat("", unique_id) # make string of int
  nr_patterns = palletmanager_daemon.init_pattern_cache()
  pattern_nr = 0
  while (pattern_nr < nr_patterns):
    file_name = palletmanager_daemon.get_file_name(pattern_nr)
    if (str_sub(file_name, 0, 4) == str_id):
      return file_name
    end
    pattern_nr = pattern_nr + 1
  end
  return "NOTFOUND"
end

Usage of the above script function:

global my_file_name = FindPattern(4856)
if (my_file_name != "NOTFOUND"):
  global rf_product_selection_predefined = my_file_name
end

Where to place the code

Press the WaitingPosition and add the script function.

Tip: Use the input from the PLC instead of 4856 shown in the example.