User Manual

GETTING STARTED


OTHER EDITIONS


LAUNCHERS


MODULES


PLATFORM


APPENDIX


TUTORIALS & HELPFUL TRICKS


STRATEGIC PARTNER LINKS

Sepasoft - MES Modules
Cirrus Link - MQTT Modules

RESOURCES

Inductive University
Ignition Demo Project
Knowledge Base Articles
Forum
IA Support

ALL USER MANUAL VERSIONS

Ignition 8.1. Offline Version (04/2021)
Ignition 8 Online Version
Ignition 7.9 Online Version
Ignition 7.8 Online Version

Deprecated Pages

SDK Documentation

Employees

Sign In

Skip to end of metadata
Go to start of metadata

This function is used in Python Scripting.

Description

When called from a Vision Client, Perspective Session, or the Designer, returns a list of OPCBrowseElement objects for the given server. Otherwise returns a list of PyOPCTagEx objects.

The following feature is new in Ignition version 8.1.8
Click here to check out the other new features

As of 8.1.8, method nodes are now included in the browse results. Methods can be read and subscribed to, but not written to. 

Client Permission Restrictions

This scripting function has no Client Permission restrictions.

Syntax

system.opc.browseServer(opcServer, nodeId)

  • Parameters

String opcServer - The name of the OPC server connection.

String nodeId - The node ID to browse.

  • Returns

List - A list of PyOPCTagEx objects.

  • Scope

Gateway, Perspective Session

Syntax - Vision Client Scope

system.opc.browseServer(opcServer, nodeId)

  • Parameters

String opcServer - The name of the OPC server connection.

String nodeId - The node ID to browse.

  • Returns

List - A list of OPCBrowseElement objects.

  • Scope

Vision Client

Object Summary

The OPCBrowseElement object has the following methods:

  • getDisplayName() - Returns the display name of the object.
  • getElementType() - Returns the element type. Element types are server, device, view, folder, object, datavariable, property and method.
  • getNodeId() - Returns a string representing the server node ID.

    The following feature is new in Ignition version 8.1.1
    Click here to check out the other new features

  • getDataType() - Returns data type information.


The PyOPCTagEx object has the following methods to retrieve information:

  • getDisplayName() - Returns the display name of the object.
  • getElementType() - Returns the element type. Element types are server, device, view, folder, object, datavariable, property and method.
  • getServerName() - Returns the server name as a string. 

  • getNodeId() - Returns a string representing the server node ID.

    The following feature is new in Ignition version 8.1.1
    Click here to check out the other new features

  • getDataType() - Returns data type information.
Code Examples
Code Snippet
# Print the name of all devices on Ignition OPC UA.
opcServer="Ignition OPC UA Server"
nodeId = "Devices"
devices = system.opc.browseServer(opcServer, nodeId)
for device in devices:
	print device.getDisplayName()
Recursive Browse
# This example attempts to recursively browse OPC nodes. Be mindful of the maxDepth in larger systems.
# The example uses system.util.getLogger asynchronously, so if you're calling this in the Script Console, 
# the output may appear in a different console (i.e., Designer console).

from functools import partial

maxDepth = 1	# Determines how deep the browse will go
serverName = 'Ignition OPC UA Server'
myLogger = 	system.util.getLogger('My Browse') # Creating a logger to print the results

# Determines where the browse should start. An empty string will start at the root.
# Alternatively, '[device name]' will start at a certain device. 
root = ''

def browse(nodeId, depth = 0):
	children = system.opc.browseServer(serverName, nodeId)
	
	for child in children:
		elementType = str(child.getElementType())
		childNodeId = child.getServerNodeId().getNodeId()
		
		msg = 'Depth - %s, Node - %s' % (depth, childNodeId)
		myLogger.info(msg)

		# If the element is a folder, try to browse deeper. 
		if (elementType == 'FOLDER' and depth < maxDepth):
			browse(childNodeId, depth + 1)

system.util.invokeAsynchronous(partial(browse, root))
Keywords

system opc browseServer, opc.browseServer