LabVIEW SDK Programming Reference Manual
LabVIEW SDK Programming Reference Manual
Version: V1.0.1
Date: 2020-05-13
All rights reserved. No parts of this manual may be used or reproduced, in any forms or by any means,
without prior written permission of China Daheng Group, Inc. Beijing Image Vision Technology Branch.
The right is also reserved to modify or change any parts of this manual in the future without prior notification.
© 2020 China Daheng Group, Inc. Beijing Image Vision Technology Branch
Web: http://www.daheng-imaging.com/en
1. Camera Workflow
Function control
Acquire images
Float
SetFloatValue
GetFloatValue
Enum
SetEnumValue
Query whether GetEnumValue
Open the device the feature is Close the device
OpenDeviceBySN implemented CloseDevice
IsImplemented Bool
SetBoolValue
GetBoolValue
String
SetStringValue
GetStringValue
Command
SetCommandValue
2. Programming Guide
In order to make it easy for the user to call SDKs of the.NET interface on the LabVIEW platform, we have
encapsulated sub-VIs on the LabVIEW platform. There are 25 sub-VIs in GxLVLib.lvlib. These VIs are
secondary encapsulation of part of SDKs of the.NET interface, which internally calls dynamic link libraries
of SDKs. And the user can directly call the.NET interface.
First create a new project. In the Project Explorer, right-click My Computer, click Add » File, and add
GxLVLib.lvlib to the project. Create a new VI and name it Demo.vi. Then open Demo.vi, you can add VIs
in GxLVLib.lvlib for camera operation in the Block Diagram.
The GxIAPINET.dll called by the VI will be searched automatically. If it is not found, please click Browse
manually to add the path of GxIAPINET.dll in the SDK.
GxLVLib.lvlib is a secondary encapsulation of the .NET interface library, and initialization and de-
initialization must be performed when use GxIAPINET.
You must call Init.vi to perform initialization before calling other interfaces.
Before exiting the process, you must call UnInit.vi to release all resources requested by GxIAPINET.
The user can enumerate all available devices by calling UpdateDeviceList.vi, and the function return value
is device SN list (DeviceSNList). The number of elements in the device information list is the number of
devices enumerated, and the data type of the elements in the list is string.
The user can open the device by OpenDeviceBySN.vi. The input parameter of the function is the SN, and
the type is string.
Before opening the device, the user should call UpdateDeviceList.vi to update the device list inside the
GxIAPINET library. Otherwise, the device may open failed.
The user can call CloseDevice.vi to close the device and release all device resources.
The user can call StartGrab.vi and StopGrab.vi to start and stop acquisition after the device is opened
successfully and the camera acquisition parameters are set.
Before starting acquisition, you need to open the data stream of the stream channel. Currently, only the
data stream of channel 0 is supported. And then you can execute StartGrab.vi.
Before stopping acquisition, you need to execute StopGrab.vi, and then close the stream channel.
The user can get images through GetImage or callback method. If the callback method is adopted, the
callback event needs to be registered by Register Event Callback before start acquisition.
Remote device feature controller: such as width, height, exposure, gain, etc. We provide VIs to access
and control the remote device feature controller.
Local feature controller: different types of devices have different functions. The user can directly use the
IGXDevice::GetFeatureControl function of the IGxAPINET library for control.
Stream object feature controller: a feature access controller for acquisition control and acquisition data
statistics. The user can directly use the IGXStream::GetFeatureControl function of the IGxAPINET library
for control.
2.2.5.2. Feature data type
Int:
Related interfaces:
SetIntValue.vi //Set
GetIntValue.vi //Get
Sample code:
Float:
Related interfaces:
SetFloatValue.vi //Set
GetFloatValue.vi //Get
Sample code:
Enum:
Related interfaces:
SetEnumValue.vi //Set
GetEnumValue.vi //Get
Sample code:
Bool:
Related interfaces:
SetBoolValue.vi //Set
GetBoolValue.vi //Get
Sample code:
String:
Related interfaces:
SetStringValue.vi //Set
GetStringValue.vi //Get
Sample code:
Command:
Related interfaces:
SetCommandValue.vi //Set
Sample code:
It is recommended that the user query whether the feature is implemented before operating the
feature:
The error information of LabVIEW is represented by two error cluster widgets: error in and error out. The
clusters are composed of a bool (status) representing the status, a 32-bit int (code) representing the error
code, and a string (source) representing the source of the error. The error clusters are used to transmit
error messages during the execution of LabVIEW code.
The user can use the Error Code Editor to user-define error codes as follows.
1) Click Tools » Advanced » Edit Error Codes to open the Error Code Editor.
2) In the prompt box that appears, click New to create a new error code file or click Existing to find the
existing error code file.
3) Enter comments about the error code file in the Comments about this file.
4) Click error codes to edit, click the text field to add a text description for the error. Click Add Error
Code to add another error code to the error code file.
5) To edit error codes and descriptions, select the error codes or texts you want to modify, and then enter
your changes. Click Error Code Sort to sort the error codes in ascending order. To delete an error
code, select the error code and click Delete Selected Error Code.
6) After editing the error code file, click Save to save the error code file to the labview\user.lib\errors
directory. The error code file must be kept as xxx-errors.txt, where xxx is user-defined.
The error code file we provided is GxLVLib-errors.txt, which is placed in the \GxLVLib\res directory. When
you use it, you must copy it to the labview\user.lib\errors directory.
Two types of error are currently provided. You can add and modify them:
When the GxIAPINET library reports an error, it is expressed in the form of throwing an exception. And the
LabVIEW will directly pop up the exception message, as shown in the Figure 2-3.
3.1. Init.vi
Descriptions:
Parameters:
error in Error in
3.2. UnInit.vi
Descriptions:
Parameters:
error in Error in
3.3. UpdateDeviceList.vi
Descriptions:
Parameters:
error in Error in
3.4. OpenDeviceBySN.vi
Descriptions:
Parameters:
error in Error in
3.5. CloseDevice.vi
Descriptions:
Parameters:
error in Error in
3.6. OpenStream.vi
Descriptions:
The user specifies the StreamID to open a stream and get the stream channel object
Parameters:
error in Error in
3.7. CloseStream.vi
Descriptions:
Parameters:
error in Error in
3.8. IsImplemented.vi
Descriptions:
Parameters:
error in Error in
IsImplement Is it implemented
3.9. GetBoolValue.vi
Descriptions:
Parameters:
error in Error in
3.10. SetBoolValue.vi
Descriptions:
Parameters:
error in Error in
3.11. GetIntValue.vi
Descriptions:
Parameters:
error in Error in
3.12. SetIntValue.vi
Descriptions:
Parameters:
error in Error in
3.13. GetFloatValue.vi
Descriptions:
Parameters:
error in Error in
3.14. SetFloatValue.vi
Descriptions:
Parameters:
error in Error in
3.15. GetEnumValue.vi
Descriptions:
Parameters:
error in Error in
3.16. SetEnumValue.vi
Descriptions:
Parameters:
error in Error in
3.17. GetStringValue.vi
Descriptions:
Parameters:
error in Error in
3.18. SetStringValue.vi
Descriptions:
Parameters:
error in Error in
3.19. SetCommandValue.vi
Descriptions:
Parameters:
error in Error in
3.20. StartGrab.vi
Descriptions:
Parameters:
error in Error in
3.21. StopGrab.vi
Descriptions:
Parameters:
error in Error in
3.22. GetImage.vi
Descriptions:
After the acquisition is started, the image can be directly got through this interface. Note that this
interface cannot be used with the callback acquisition method
Parameters:
error in Error in
3.23. ImageGrabEvent.vi
Descriptions:
Parameters:
3.24. GrabImageDisplay.vi
Descriptions:
Parameters:
error in Error in
3.25. SaveImage.vi
Descriptions:
Parameters:
error in Error in
4. FAQ
Question 1: LabVIEW pops up the searching interface (for .dll) during loading VI.
Solution:
The GxIAPINET.dll called by the VI will be searched automatically. If it is not found, please click Browse
manually to add the path of GxIAPINET.dll in the SDK.
Question 2: After browsing and selecting the path of GxIAPINET.dll, it prompts "An error occurred trying to
load the assembly".
Solution:
The user may select the 32-bit GxIAPINET library when using 64-bit LabVIEW, or select the 64-bit
GxIAPINET library when using 32-bit LabVIEW. When using LabVIEW, please select the appropriate
version of the library.
5. Revision History