Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Gateways

Publishing Using PML Macros

  • Last UpdatedJun 04, 2026
  • 4 minute read

You can publish grids, DB views, drawings and datasheets using PML functions as well. To do this, you must first create a macro file that contains the commands to publish. Then, you must run the macro file by dragging it to the command window in AVEVA Engineering.

Selection Methods

Method

Return Type

Description

import 'AVEVA.NET.Gateways.IED.PmlExtensions'

handle any

endhandle

none

Mandatory command that must be available in all macro files

IEDPublisher()

none

Name of the object used for publishing

SelectElement(string elementName)

none

Command for selecting elements for publishing

SelectSubelement(string elementName, string subelementName)

none

Command for selecting a sub element of the specified element

SelectSubelements(string elementName, Hashtable subelementNames)

none

Command for selecting multiple subelements of the specified element, example: subrids of a grid

SelectConfiguration(string cfgInput)

none

Command for selecting the configuration

SelectConfiguration(tring cfgInput, boolean autoUpgrade)

none

Command for selecting the configuration; if autoUpgrade is True, the configuration is automatically upgraded if needed

SelectDbView(string dbViewName)

none

Command for selecting a DB view for publishing by its unique name

SelectGrids(string gridNamePattern)

none

Command for selecting grids matching the specified name pattern

SelectReport(string reportFilePath, boolean scoped)

none

Command for selecting a report file for publishing

SetOption()

none

Command for settings the options

Publish()

none

Command for publishing

AvailableOptions()

none

Command for listing the available options

ErrorsNo()

none

Command for displaying the number of errors after the last Publish() action

Get Methods

Method

Return Type

Description

GetAvailableConfigurations()

array

Returns an array of all available configurations

GetSelectedConfigurations()

array

Returns an array of currently selected configurations

GetSelectedElements()

array

Returns an array of currently selected elements

GetSelectedSubelements(string elementName)

array

Returns an array of selected subelements for the specified element

GetSelectedReports()

array

Returns an array of currently selected reports

GetSelectedDbViews()

array

Returns an array of currently selected DB views

GetSelectedGrids()

array

Returns an array of currently selected grids

Clear Methods

Method

Return Type

Description

ClearSelectedElements()

none

Clears all selected elements

ClearSelectedConfigurations()

none

Clears all selected configurations

ClearSelectedReports()

none

Clears all selected reports

ClearSelectedDbViews()

none

Clears all selected DB views

ClearSelectedGrids()

none

Clears all selected grids

ClearOverrides()

none

Clears all active option overrides

Options Methods

Method

Return Type

Description

SetOption(string name, boolean value)

none

Sets a boolean publishing option by name

SetOption(string name, string value)

none

Sets a string publishing option by name

ResetOptions()

none

Resets all options to their default values

AvailableOptions()

none

Lists all available option names and their current values

Publishing Methods

Method

Return Type

Description

Publish()

boolean

Publishes all selected elements using the selected configurations and options

ErrorsNo()

real

Returns the number of errors from last Publish()

General Methods

Method

Return Type

Description

Version()

none

Displays the current version of the publisher

Info()

none

Displays information about the current publisher state

The following table lists the options available with the SetOption() command.

Option

Default Value

Accepted Values

eiwmContextName

PROJECTCONTEXT

'<STRING>'

eiwmSuffix

_null

'<STRING>'

generateFolderVNETFile

False

'True' | 'False'

generateTriggerStartFile

False

'True' | 'False'

drawingProcessConnectedDrawings

False

'True' | 'False'

gridProcessColumnsMode

OnlyVisible

'All' | 'OnlyVisible'

gridProcessSubGrids

False

'True' | 'False'

itemProcessDataSourceElements

False

'True' | 'False'

itemProcessDatasheets

True

'True' | 'False'

itemProcessDrawings

True

'True' | 'False'

itemProcessGrids

True

'True' | 'False'

itemDataPublishScope

Container

'Attributes' | 'Container'

The following table lists the commands for publishing reports.

Command

Example

SelectReport(string <report file path>, bool <is scoped>)

!iedPublisher.SelectReport('C:\Users\Public\Documents\AVEVA\Everything3D\Data\DFLTS3.1\data\reports\DESIGN-Equipment_List.repv', false)

GetSelectedReports()

!reports = !iedPublisher.GetSelectedReports()

q var !reports

ClearSelectedReports()

!iedPublisher.ClearSelectedReports()

SelectGrids(string)

Registers a single grid name or glob pattern for grid selection. The grid is included in publishing if it exists and its lstpub attribute is set to true. Can be called multiple times to register multiple names or patterns.

GetSelectedGrids()

Returns a TextArray of all currently registered grid names and glob patterns.

ClearSelectedGrids()

Clears all registered grid names and glob patterns.

The following is an example of the contents of a macro file.

import 'AVEVA.NET.Gateways.IED.PmlExtensions'

handle any

endhandle

using namespace 'AVEVA.NET.Gateways.IED.PmlExtensions'

!publisher = object IEDPublisher()

--(APS) Centrifugal Pumps

!publisher.SelectElement('=23997/1366')

--(APS) Filters

!publisher.SelectElement('=23997/1330')

--(APS)P1501A_CENTRIPUMP_DST

!publisher.SelectElement('=23997/988')

--(APS)P1501B_CENTRIPUMP_DST

!publisher.SelectElement('=23997/989')

!publisher.SelectConfiguration('T1')

!publisher.SetOption('itemProcessDatasheets', false)

!publisher.SetOption('itemProcessGrids', true)

!publisher.SetOption('itemProcessDrawings', false)

!publisher.SetOption('drawingProcessConnectedDrawings', false)

!publisher.SelectDbView('CENTRIFUGALPUMP_View')

--(APS project) Selects DbView using it's unique name

!publisher.Publish()

!errorsNo = !publisher.ErrorsNo()

-- Include sub-grids when publishing grids

!publisher.SetOption('gridProcessSubGrids', 'true')

-- Publish all element attributes from grid scope, grouped by element type

!publisher.SetOption('itemDataPublishScope', 'Attributes')

Select Grids by Name or Glob Pattern

You can use SelectGrids() to select grids for publishing by their exact name (lstnam attribute) or by a glob pattern that matches their full hierarchy path (for example, Mechanical/Centrifugal_Pumps).

Note: A grid is published only if it exists and its lstpub (can be published) attribute is set to true. Grids with lstpub set to false are not published even if they match the selection.

Note: If a grid name or any segment of a glob pattern contains a special glob character (such as *, ?, or /), the special character must be escaped by enclosing it in square brackets []. For example, a grid named Centri*fugal/Pumps must be written as Centri[*]fugal[/]Pumps.

The following is an example macro that selects grids using a combination of exact name and glob pattern:

import 'AVEVA.NET.Gateways.IED.PmlExtensions'

handle any

endhandle

using namespace 'AVEVA.NET.Gateways.IED.PmlExtensions'

!publisher = object IEDPublisher()

!publisher.SelectConfiguration('TTY')

-- Select a specific grid by exact name

!publisher.SelectGrids('Mechanical/Centrifugal_Pumps')

-- Select all grids under the Mechanical hierarchy

!publisher.SelectGrids('Mechanical/*')

-- Publish

!publisher.Publish()

To retrieve the currently registered selections:

!selectedGrids = !publisher.GetSelectedGrids()

q var !selectedGrids

To clear all registered grid selections and start again:

!publisher.ClearSelectedGrids()

-- Register a new selection after clearing

!publisher.SelectGrids('Mechanical/Centrifuges')

!publisher.Publish()

Glob Pattern Syntax

Glob patterns match grids by their full hierarchy path, for example Mechanical/Centrifugal_Pumps.

The following wildcards are supported:

Pattern

Description

Example

*

Matches any sequence of characters within a single hierarchy segment

Mechanical/* matches all grids directly under Mechanical

**

Matches any sequence of characters including hierarchy separators (recursive)

** or **/* matches all grids at any level

?

Matches any single character

Mechanical/Pump? matches Mechanical/Pump1, Mechanical/PumpA

[c]

Escapes a special glob character c so it is treated as a literal

Centri[*]fugal[/]Pumps matches the literal name Centri*fugal/Pumps

For a full reference on glob syntax, see Glob (programming)

TitleResults for “How to create a CRG?”Also Available in