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

AVEVA™ Engineering

Example Compare Macro

  • Last UpdatedMay 02, 2022
  • 1 minute read

Below is a complete example macro that compares all schematic equipment and pipelines that appear on a particular diagram. It then saves the side-by-side details to Excel and the coloured diagrams to pdf files.

-- File: IntegratorUserGguide.pmlmac

-- Initialise Integrator

import 'MMServices'

handle any

endhandle

using namespace 'Aveva.Pdms.MMServices'

!!mmViewer = object mmViewer()

!!integratorInit()

-- Collect schematic equipment and pipelines that appear on this diagram

!diagram = |/A0-01-2012-0001|

var !items collect all SCEQUI

var !items append collect all SCPLIN

var !diaref evaluate diaref for all from !items

!comlist = ARRAY()

do !i index !items

if (match(!diaref[!i], !diagram) gt 0) then

!comlist.append(!items[!i])

endif

enddo

-- Set report direct to file and do compare

!!integrator.setreportvisible(false)

if (!comlist.size() gt 0) then

!!integrator.compare(!comlist)

handle any

write !!error.text

elsehandle none

-- Write out the compare summary

!!integratorSupportHandler.printSummary()

-- View the report unless running in non graphics mode

if (not istty) then

!file = object FILE('C:\Aveva\report.xml')

if (!file.exists()) then

!!integrator.openreport()

endif

endif

-- Generate compare Excel report and colour coded diagram pdf

!!integrator.saveAsExcel('C:\Aveva\report.xlsx')

!!integrator.openAllReferencedDiagrams()

!list = !!integrator.diagramlist()

do !page values !list

!diagramPage = !!mmViewer.diagramPage(!page)

!diagramPage.saveAsPDF('C:\Aveva\' & !page)

enddo

endhandle

endif

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