Example Compare Macro
- Last UpdatedFeb 15, 2023
- 1 minute read
Below is a complete example macro that compares all schematic equipment and pipelines that appear on a particular diagram.
-- File: compare macro for user guide.pmlmac
-- initialize Integrator
!!integratorInit()
-- Collect schematic equipment and pipelines that appear
-- on this drawing
!scgroup = |/Piping_Diagrams|
!sctypes = |SCEQUI SCPLIN|
!diagExp = |name of diaref eq '/A1-51-2003'|
!sccoll = object COLLECTION()
!sccoll.scope(!scgroup.dbref())
!sccoll.types(!sctypes.split())
!sccoll.filter(object expression(!diagExp))
-- Integrator compare method needs array of strings
!comlist = ARRAY()
do !element values !sccoll.results()
!comlist.append(!element.ref.string())
enddo
-- Set report direct to file and do compare
!!integrator.setreportvisible(false)
!!integrator.setreportpath('c:\mac\compareReport.xml')
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:\mac\compareReport.xml')
if (!file.exists()) then
!!integrator.openreport()
endif
endif
endhandle
endif