LabVIEW Walkthrough: Modifying a System Definition File
- Updated2023-02-21
- 4 minute(s) read
LabVIEW Walkthrough: Modifying a System Definition File
Parent Topic: Programming with System Definition API in LabVIEW
You can use LabVIEW to access the NI VeriStand System Definition .NET API and programmatically control operation of the System Explorer window.
![]() |
Note Creating and communicating with .NET objects in LabVIEW requires the .NET CLR 4.0 that installs with LabVIEW. You must use a .NET 2.0 configuration file if you want to load .NET 2.0 mixed-mode assemblies. |
The following sections provide an example of using the System Definition API to remove a CAN port from a system definition file and add a new one with an associated XNET database, CAN cluster, and incoming frame. As you follow the example, notice that the hierarchy of classes reflect the hierarchy of nodes that appear in the System Explorer window, shown as follows.
Part 1: Opening the File and Finding the First Target
The initial part of this example code programmatically opens an existing system definition file and begins navigating the nodes that all system definitions contain.
|
Open an existing .nivssdf file from disk by initializing a new instance of the SystemDefinition class. |
||
|
Find the first target in the system definition file by:
|
Note that the SystemDefinition constructor, used to open the existing system definition file in step 1, is overloaded.
SystemDefinition(String) | SystemDefinition(String, String, String, String, String, String, String) |
---|---|
Opens an existing system definition file. | Creates a new system definition file with specified configuration options. |
|
|
Related Links
Part 2: Navigating the System Definition Hierarchy to Add and Remove CAN Ports
After obtaining a reference to the target in the system definition file, the remainder of the example code navigates the nodes that appear under the target
|
Continue using Invoke Nodes to traverse the hierarchy of nodes under the Targets section until reaching the CAN section under the first chassis. Obtain an array of references to all CAN ports in that section.
|
||
|
Remove the first CAN port from the CAN section. |
||
|
Associate an existing XNET database with a new CAN port by initializing new instances of the Database and CANPort classes. Notice how the CANPort constructor contains a LinkedDatabase parameter that requires you to specify the XNET database associated with the port. |
||
|
Traverse the hierarchy of sections that will appear under the new CAN port to get the Single-Point section. Add a new signal-based frame associated with the XNET database from step 5, to the Single-Point section. |
||
|
Add the new CAN port to the CAN section of the system definition file. |
||
|
Save the system definition file to disk. |
Related Links
Programming with the System Definition API in LabVIEW