Set Variable FAQs

NI Vision Builder

Process Images Tab

Set Variable FAQs

Q: What are variables used for?

Variables can be used to store data so the data is accessible from any state in an inspection. A common use of variables is to implement a For Loop. Variables allow you to initialize a counter variable in one state and loop another inspection state that increments the counter variable. When you transition out of the inspection state, the counter variable has a value of N, where N is the number of times the inspection state executed.

Variables can also be used to pass data between states of an inspection. For example, you may have a state in your inspection that is run several times, but you only want to display an overlay when certain criteria are met. You can put the Custom Overlay and Display steps in a separate state and set the inspection state to transition to the overlay and display state when certain criteria are met. The Custom Overlay step can then use a variable to overlay the results of the inspection state.

Q: How can I use the variable values that are updated by Vision Builder AI?

Variables are accessible from any step in any state that can use measurement results. Variables can also be accessed to trigger transitions from the state diagram Edit Transition dialog box.

Network variables can be used to access data from other devices on the network that support LabVIEW variables. Network variables can also be bound to a hardware resource to expand the I/O if your system.

The Set Variable step is not required to access variables, it is only required when you want to update a variable that may be used in a different state.

Q: Why am I unable to update the value for some system variables?

Vision Builder AI uses a few system variables to store information about the current inspection. Because these built-in system variables are used internally by Vision Builder AI, you are not able to update the value of the variables using the Set Variable step. You can, however, read the value of the variable using any step that allows you to set the value of a control to a variable value.

The following is a list of the built-in system variables used by Vision Builder AI:

  • Device Name
  • IP Address
  • Device Start Date
  • Device Start Time
  • Current Date
  • Current Time
  • Inspection Name
  • Inspection Start Date
  • Inspection Start Time
  • Inspection Iteration Counter
  • Active Time
  • Idle Time
  • Inspection Rate
  • Inspection Status
  • # Pass
  • # Fail
  • # Parts Inspected
  • Yield