Global Variable

You are currently viewing the documentation for the latest version (2.1.1). To access a different version, click the "Switch version" button located in the upper-right corner of the page.

■ If you are not sure which version of the product you are currently using, please feel free to contact Mech-Mind Technical Support.

Description

A global variable can be accessed and used by all projects under the same solution. It enables data sharing across different projects for consistent data management and transfer.

Workflow

The process of configuring this Step is as follows:

global variable workflow
  1. Select the operation that you want to perform on the global variable, either Save or Retrieve.

  2. Connect the ports to form a data flow.

  3. Set the variable name and variable mode.

  4. (Optional) Set the data type of the variable. After configuration, you need to reconnect the Step ports.

  5. Run the Step.

Parameter Description

Parameter Description

Operation

Select whether to save data to the variable or retrieve data from the variable.

  • Save: When this option is selected, the Step will display an input port for connecting to an output port of another Step to save data to the variable.

  • Retrieve: When this option is selected, the Step will display an output port for connecting to one or more input ports of other Steps, so as to retrieve data from the variable.

You can view all the saved global variables in the current solution in Global Variable Viewer.

Variable Name

The variable name is the unique identifier of the global variable.

If you need to retrieve data, ensure that the specified variable name exists; otherwise, the operation will fail.

Variable Mode

Defines how data is stored in and retrieved from the variable.

  • Single result: The variable always holds only the most recent result. New data overwrites the old one. The data in the variable can be retrieved multiple times.

  • Queue: The variable can store up to 10 results in the order they are saved. Each retrieval returns the earliest result and removes it from the variable (first in, first out).

Variable Data Type

The type of data stored in the variable.

The currently supported types mainly include Surface (surface data), Profile, SurfaceCloud (point cloud), Image, Number, Shape3D (3D geometric features), Bool, String, and Pose. See Data Type for details.

Troubleshooting

  • For common errors, see Error Code List.

  • If the error code is inconsistent with the error message, please contact Technical Support for help.

Failed to Save the Global Variable

Symptom:

The execution of the Step failed when the “Operation” was set to Save.

Possible causes:

  • No data is flowing into the input port.

  • The variable name is empty.

  • The set variable name already exists, but the variable mode does not match.

  • The set variable name already exists, but the variable data type does not match.

  • In the current solution, the number of global variables has reached the upper limit (100).

Solutions:

  • Connect the ports to ensure that data flows into the input port.

  • Name the variable.

  • If you want to save an existing global variable again, ensure that the variable mode remains the same as when it was first saved.

  • If you want to save an existing global variable again, ensure that the data type of the variable is the same as when you first saved it.

  • Delete an useless variable and try again: After deleting the “Global Variable” Step corresponding to the useless variable, restart the software to delete the useless variable completely.

Failed to Retrieve Data from the Global Variable

Symptom:

The execution of the Step failed when the “Operation” was set to Retrieve.

Possible causes:

  • The variable name is empty.

  • The variable does not exist.

  • The specified variable exists, but the variable mode does not match.

  • The specified variable exists, but the variable data type does not match.

  • The variable mode is “Queue,” and the data stored in the variable has been emptied.

Solutions:

  • Enter the names of an available variable.

  • Reset the variable name to ensure that it exists.

  • Reset the variable mode using the information of the current variable.

  • Reset the variable data type using the information of the current variable.

  • Ensure that the variable contain data that can be retrieved.

Is this page helpful?

You can give a feedback in any of the following ways:

We Value Your Privacy

We use cookies to provide you with the best possible experience on our website. By continuing to use the site, you acknowledge that you agree to the use of cookies. If you decline, a single cookie will be used to ensure you're not tracked or remembered when you visit this website.