Customizing the Inspection Interface in NI Vision Builder for Automated Inspection – Part III

Publish Date: Dec 27, 2007 | 3 Ratings | 5.00 out of 5 |  PDF

Overview

Part I of this tutorial introduced how to use custom interfaces in your Vision Builder AI inspection. Part II demonstrated using a LabVIEW front panel as the interface and having a control on the front panel determine the transitions used in the inspection. Please make sure you have gone through Part I and II before continuing with this part. Part III will demonstrate how to use a LabVIEW VI with controls to change the pass/fail criteria for your inspection and also run the code behind the front panel of the interface for updating a graph with multiple plots.

Using a LabVIEW VI as the Inspection Interface

The templates provided with Vision Builder AI for customizing your inspection may not have the exact appearance or functionality you need. Vision Builder AI 3.5 allows you to use the front panel of a LabVIEW VI as your user interface for ultimate flexibility in designing your custom interface. Follow the steps below to display more information on the custom interface by selecting a LabVIEW VI.

Close any inspections that are open. In the Welcome window of Vision Builder AI, click Configure Inspection to load a blank Vision Builder AI inspection.

  1. Select File»Open from the Vision Builder AI toolbar.
  2. Browse to <Vision Builder AI 3.5>\Examples\Tutorial 4 - Two Cameras Inspection.vbai.
  3. Click OK to open the inspection.
  4. Click Tools»Inspection Interface Configuration to launch the Configure Inspection Interface dialog box.
  5. On the Inspection Interface tab, select the Create New Custom Inspection Interface from: option.
  6. Select LabVIEW VI.
  7. Click the Browse button. The Select a VI dialog box opens.
  8. Navigate to the location where you saved the two_images_with_data.vi that is included at the end of this tutorial.
  9. Select the two_images_with_data.vi, and click Select.

NOTE: Vision Builder AI cannot import VIs that have dependencies, such as sub VIs, DLL calls, or control type definitions.

This user interface consists of two image display indicators, a Chart, a Boolean and two controls and indicators.

  1. Click OK to close the Configure Inspection Interface dialog box.
  2. In the State Configuration Window, click the  Set Inspection Status step. This ensures that the next step we add will be placed immediately after this step.
  3. In the Inspection Steps Palette, click the  Use Additional Tools tab.
  4. Click the  Update Inspection UI step. The property page for the step opens.

Notice that several items appear in the Inspection Interface Indicators table. These are the indicators from the VI front panel.

  1. Select each indicator in the table and set the value for the indicator using the Set to Measurement radio button so that the Inspection Interface Indicators table in your inspection matches the table shown in Figure 3.

Figure 3. Updating Indicators on the LabVIEW VI with Measurement Results

In order for the chart on the LabVIEW front panel to update properly, the code in the block diagram must be run. To run the block diagram code, enable the Run the VI after updating indicators checkbox.

  1. Click OK to close the property page.
  2. Save the Inspection, switch to the Inspection Interface, and click the  Start Inspection button.

Notice that the controls update with the corresponding values. The Inspection interface should resemble the Inspection interface shown in Figure 4.

Figure 4. The Custom UI is Updated with Data from the Inspection

  1. Stop the Inspection and return to the Configuration Interface.

In the current Inspection interface, notice that there are two controls— Upper Limit and Lower Limit. You can use these controls as inputs to the Vision Builder AI inspection. Complete the following instructions to edit the inspection so that the inspection passes only when the Width is below the Upper Limit and above the Lower Limit.

  1. If Vision Builder AI is not in the Configuration interface, switch to the Configuration interface.
  2. In the State Configuration window, double-click the Compute Plank Width step. The property page for the step opens. The calculator diagram should resemble the diagram shown in Figure 5.

Figure 5. Calculator Diagram of Compute Plank Width Step

  1. Click the Edit Inputs/Outputs button. The Edit Inputs/Outputs dialog box opens.
  2. In the Input Measurements tree control, select User Interface Control»Lower Limit and User Interface Control»Upper Limit, and click OK.
  3. On the calculator diagram, you should now see two new controls for the lower and upper limits.
  4. Delete the constants 39.5 and 40.5 and wire the controls as shown in Figure 6. Now, instead of using constants, the step uses the values of the Lower Limit and Upper Limit controls to determine the Step Result.

Figure 6. Edit the Calculator Diagram to use the User Interface Controls

  1. Click OK to save the changes to the Compute Plank Width step and return to the Main window.
  2. Save the inspection, switch to the Inspection Interface, and start the inspection.
  3. Now, you can change the values of the Upper Limit and Lower Limit controls and watch Vision Builder AI pass or fail the inspection based on the control values.

Figure 7. Editing Control Values to Change the Outcome of the Inspection

  1. Stop the inspection.

Block diagram of the User Interface VI

While there is no need for any code on the block diagram of the VI that you use as the Inspection interface, you can have a simple block diagram, with no sub VIs, to allow the interface to execute additional code when the Update Inspection UI step executes. Figure 8 shows the LabVIEW block diagram for Two Images with Data.vi.

Figure 8. Block diagram of Two Images with Data.vi

Continue to the additional examples to learn more about using custom Inspection interfaces with Vision Builder AI inspections.    

Back to Top

Bookmark & Share


Downloads


Ratings

Rate this document

Answered Your Question?
Yes No

Submit