HALCON includes an extension for the inspection of HALCON variables in Visual Studio (see the Installation Guide for the system requirements). A development license is required for this extension to work (see the Installation Guide for the different license types). If the license is valid for the HALCON Progress edition, only the corresponding edition of the HALCON Variable Inspect can be used, i.e., HALCON Progress Variable Inspect requires HALCON Progress. To change the HALCON Variable Inspect edition, you have to reopen Visual Studio and choose the desired HALCON Variable Inspect edition.
The extension is registered by default for your Visual Studio installation while installing HALCON. In case this option was deactivated for the installation, you can register the extension manually by double-clicking the following file:
%HALCONROOT%/misc/HALCON2105ProgressVariableInspect.vsix
If multiple versions of Visual Studio are installed on your machine, the installer will let you select the version(s) you wish to add the extension to. Once installed, the extension should appear in the side pane of Visual Studio. If it does not, select Tools → HALCON 21.05 Progress Variable Inspect. Please note that the environment variable HALCONROOT must be set for the extension to work.
The extension is provided only for the inspection of iconic objects and tuples in the following languages:
| Interface | Language |
| HALCON/C++ | C++ |
| HALCON/.NET | C#, Visual Basic .NET |
Table 3.1: Interface and language.
Restrictions When Using HALCON Variable Inspect
While debugging HALCON programs, the extension allows to inspect the current values of initialized control and iconic variables. You can either set breakpoints at the desired places or single-step through your program.
The inspection window is divided into two tabs Locals and Watch, see figure 3.1.
The Locals tab provides a list of all local HALCON variables from the current scope of the program. The variable list is automatically updated if the scope of the program changes.
The Watch tab contains only selected HALCON variables that have been added by the user to the “Watch” list. It also allows the inspection of global HALCON variables. Variables can only be added to the “Watch” list if the program has reached a break point. In addition, local variables can only be added if they are currently in scope.
There are several ways to add a HALCON variable to the “Watch” list:
Note that the fewer variables are listed in the inspection window the better the performance. Therefore, moving only the desired variables to the “Watch” list and inspecting the variables in the Watch tab improves the performance.
By default, the variables in the inspection window are listed in the same order as in the Locals window of Visual Studio. The variables can be sorted in descending or ascending order by clicking on the header of the respective columns in the inspection window. To switch back to the default order, click on the header of the column “#”.
The table Table 3.2 describes which information is displayed for the variables of the “Locals” and “Watch” list of the inspection window.
| Columns | Description |
| # | This column contains no values. It can be used to restore the default order of the variable list by clicking on the header of this column. |
| Name | Name of the local HALCON variable. |
| Type | Type of the local HALCON variable. Only iconic variables and tuples are supported in the extension. |
| Status | Current status that indicates if the debug information of the variable could be retrieved. In case it has been successfully retrieved, a green checkmark is displayed. If the information could not be retrieved, a red crossmark is displayed. |
| Status Message | Status message for the variable. If the HALCON data of a variable could not be retrieved, the status message delivers more detailed information about the cause. If the HALCON data could be retrieved, additional information about the data is displayed. |
Table 3.2: Columns of the variable lists in the inspection window.
The Watch tab of the inspection window gives some additional information about the scope, see Table 3.3.
| Column | Description |
| Scope | Scope of the HALCON variable. For local HALCON variables the scope “Local” is returned and for global HALCON variables the scope “Global”. If the scope could not be determined, i.e., because the variable is not in the current scope or uninitialized, “Unknown” is returned. |
| Inside Scope | Current status if the HALCON variable is in the current scope of the program. If the variable is in the current scope, “True” is returned, else “False”. |
Table 3.3: Additional columns of the variable list in the Watch tab.
To select a variable for the inspection, click on the corresponding entry in the variable list of the inspection window. If the debug information and HALCON data of the variable has already been retrieved, i.e., if Status has a green checkmark, the value of the variable is displayed. Otherwise, the retrieval of the HALCON data is started and the value of the variable is displayed if the data could be retrieved. To enforce a complete new retrieval of the data, even for variables whose data have already been obtained, double-click on the variable. The inspection window is automatically updated if the content of the currently displayed variable changes.
To deselect a variable, press CTRL and click on the respective line of the variable. Alternatively, right-click on the line of the variable and select Deselect all from the context menu. In some cases it is desired to display the data of a variable again. This can be achieved by deselecting and selecting the variable again or by double-clicking on it.
If a member of a variable cannot be resolved, e.g., if the variable is related to a class, it is not sufficient to inspect only the member of this variable. Instead, mark the complete expression before right-clicking and inspecting the member variable.
Please note that native 64-bit data types, e.g., int8 images, and image data with a size > 0.5 GB are not supported.
The following information is displayed for control variables (tuples): Name of the control variable, type, and length. The actual values are displayed as a list from 0 to length-1.
Iconic variables are displayed graphically in the inspection window, see figure 3.1 for an example. Apart from the visualization of the content, the following information is displayed:
The inspection window has a toolbar with the following functionalities:
Iconic variables may be stacked: For example, image data may be overlayed with region data by first inspecting the image variable and then the region variable.
You can open the operator reference of a specific operator right from the context menu of Visual Studio. Move the mouse cursor over a method name, right-click on it and select HALCON Help.
The following settings are persistent between sessions:
Removing HALCON Variable Inspect from Visual Studio
To remove the extension from Visual Studio follow these steps: