Customizing the Inspection Interface in NI Vision Builder for Automated Inspection – Part II
Overview
The ability to customize the inspection interface is a new feature introduced in Vision Builder AI 3.5. This powerful feature provides a way to customize how the inspection interface looks, and can even control the flow of the inspection or change parameters used in steps of the inspection while the inspection is running.
NI Vision Builder for Automated Inspection 3.5 or later (Vision Builder AI) allows you to customize an inspection state diagram to define inspections with custom states and transitions that govern the execution flow of the inspection. When using a LabVIEW VI front panel for the Inspection interface you can run the code on the VI block diagram when the interface is updated. This option is useful to keep track of statistical information for histograms, produce averages of result sets, or change the interface based on control values or results from the inspection. LabVIEW 8.5 VIs must be used to create the custom interface.
This tutorial is the second document in a three-part series that guides you though setting up a custom Inspection interface. Refer to Customizing an Inspection Interface in NI Vision Builder for Automated Inspection – Part I for information on setting up a simple Inspection interface. Refer to Customizing an Inspection Interface in NI Vision Builder for Automated Inspection – Part III for using a custom UI to set pass fail limits for steps. Refer to additional Vision Builder AI custom Inspection interface examples to see additional ways to use a custom Interface.
Note: Launch Vision Builder AI if it is not open. Refer to Customizing an Inspection Interface in NI Vision Builder for Automated Inspection – Part I for more information.
Loading an inspection
Select File»Open from the Vision Builder AI toolbar, and navigate to <Vision Builder AI 3.5>\Examples\Chocolates Tray Inspection.vbai. Click OK to open the inspection in the Configuration interface.
Adding a VI to 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. Complete the following steps to add One Image with Switch Control.vi to the Chocolates Tray Inspection.vbai inspection to create a custom Inspection interface template for the Inspection interface.
- Select Tools»Inspection Interface Configuration to launch the Configure Inspection Interface dialog box.
- On the Inspection Interface tab, select the Create New Custom Inspection Interface from: option.
- Select LabVIEW VI.
- Click the Browse button. The Select a VI dialog box opens.
- Navigate to the location where you saved the i mage_with_switch_control.vi included at the end of this tutorial.
- Select the i mage_with_switch_control.vi, and click Select.
Note: Vision Builder AI cannot import VIs that have dependencies, such as subVIs, DLL calls, or control type definitions.
- Click OK to close the Custom Inspection Interface dialog box.
Modifying the Inspection State Diagram
The configurable process model in Vision Builder AI is represented by a state diagram. Complete the following steps to add the Update UI state to the inspection state diagram.
- Click the
Toggle Main Window View Window button on the toolbar to bring the state diagram to the Main window.
- Right-click an open area on the state diagram and select Create New State to add a new state to the inspection. The Edit State Name dialog box opens.
- In the State Name control, enter Update UI, and click OK.
- Click the Handle Good Trays state default transition and drag it to the Update UI state.
- Click the Rework Bad Trays state default transition and drag it to the Update UI state.
- Click the Update UI state default transition and drag it to the End point.
The state diagram should now resemble the state diagram shown in Figure 1.
Figure 1. Adding the Update UI state to the Inspection State Diagram
- Click the Update UI state.
- In the Inspection Steps palette, select the
Use Additional Tools tab.
- Click the
Update Inspection UI step. The property page for this step opens.
- From the Inspection Interface Indicators table, select Image.
- For the Operation, select Set to Measurement.
- Set the value of the Image indicator to Current Image.
- From the Inspection Interface Indicators table, select Inspection Status and select Set to Measurement for the Operation.
- Set the value of the Inspection Status indicator to Variables»System Inspection»Inspection Status.
- Click OK to add the Update Inspection UI step to the inspection.
Vision Builder AI includes the updated Inspection interface with the inspection to update the image and Boolean indicators with results from the inspection.
Using a Control to Change the Inspection Flow
The Mode control allows you simply acquire images or run the complete inspection. This could be useful for focusing a camera or adjusting the aperture without running the complete inspection. Complete the following steps to add a transition to the inspection that will use the value of the Mode control on the interface to determine which states to run.
- Click the Toggle Main Window View button on the toolbar to bring the state diagram to the Main window.
- Right-click the Acquire Image state, and select Create New Transition.
- Drag the new transition so it points to the Update UI state to create a transition between the Acquire Image state and the Update UI state.
- Double-click the transition to launch the Edit Transition dialog box.
- In the Transition Name control, enter Acquire Mode.
- In the Measurement control, configure the transition to occur when User Interface Control – Mode is True.
- Click OK to close the Edit Transition dialog box.
The state diagram should now resemble the state diagram shown in Figure 2.
Figure 2: Adding the Acquire Mode control to the Inspection State Diagram
- Select File»Save to save the inspection.
- Select File»Switch to Inspection Interface to switch to the Inspection interface. Notice that Vision Builder AI now uses the custom Inspection interface instead of the default Inspection interface. The custom Inspection interface consists of an image display indicator, inspection status indicator, and a toggle switch.
- Click the
Start Inspection button to run the inspection. When you run the inspection, notice that when the switch is in Acquire mode, the inspection will skip all the inspection states. When the switch is in Inspect mode, the inspection states will run normally.
- Click the
Stop Inspection button to stop the inspection.
- Select Inspection»Switch to Configuration Interface to return to the Configuration interface.
Continue to Customizing an Inspection Interface in NI Vision Builder for Automated Inspection – Part III to learn more about using Custom Inspection interfaces in your inspections. Part III uses LabVIEW VI controls to change pass/fail criteria in the inspection. Additional Vision Builder AI examples provide sample inspections that demonstrate more advanced uses for the custom inspection interface.
Reader Comments | Submit a comment »
Legal
This tutorial (this "tutorial") was developed by National Instruments ("NI"). Although technical support of this tutorial may be made available by National Instruments, the content in this tutorial may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this content with each new revision of related products and drivers. THIS TUTORIAL IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).
