Using Compare/Update from PML
- Last UpdatedOct 23, 2024
- 4 minute read
The main functions of Compare/Update can be called from PML using the CompareUpdate PML object. The following methods provide the equivalent of the main interactive functions.
|
Method |
Description |
|
selectDesign() |
Select Design Database (DB) source. |
|
selectSchematic() |
Select Schematic DB source. |
|
selectEngineering() |
Select Engineering DB source. |
|
selectInstrumentation() |
Select AVEVA Instrumentation source. |
|
selectElectrical() |
Select AVEVA Electrical source. |
|
selectPID() |
Select AVEVA P&ID source. |
|
selectExternal() |
Select external DB source. |
|
compareEquipment() |
Compare Equipment list. |
|
compareLines() |
Compare Lines list. |
|
comparePipes() |
Compare Pipes list. |
|
compareInstruments() |
Compare Instruments list. |
|
compareValves() |
Compare Valves list. |
|
comparePipingSpecials() |
Compare Piping Specials list. |
|
compare(STRING configuration name) |
Compare a named configuration. |
|
owner(STRING owner name ) |
Set the name of the owner for inserted elements. |
|
acceptAllDisplayed() |
Accept all available changes including inserting new objects and updating attribute values. |
|
acceptAllLinked() |
Accept linked objects (use this to unlink previously linked objects or update attributes on linked objects). |
|
acceptAllMatched() |
Accept all matched objects (use this to link all matched objects). |
|
acceptAllUnmatched() |
Accept all unmatched objects (use this to insert new objects). |
|
updateLink() |
Update the target DB by inserting and linking elements and updating attribute values. |
|
updateUnlink() |
Update the target DB by unlinking elements. |
|
export( STRING elements file path, STRING attributes file path) |
Following a compare operation, output the contents of the two grids into the named files in CSV format. |
Note:
Integration with AVEVA Instrumentation, AVEVA Electrical and AVEVA P&ID are supported from the command line only when the source DBs are setup for NT Authentication,
so no password is required on connection.
These methods require options and mappings to have been configured interactively.
A typical macro could include:
!run = object CompareUpdate()
!run.selectEngineering()
!run.compareEquipment()
!run.acceptAllDisplayed()
!run.updateLink()
MMTools Object
The MMTools object provides methods to link and unlink, objects that could be linked interactively using Schematic 3D Integrator or Compare/Update can be linked in this way. To use these methods the following initialization is required at the top of each PML file (object, function, or macro) where these methods are to be used.
import 'MMservices'
handle any
endhandle
The following initialization is also required in each method, function or macro where the diagram methods are to be called:
using namespace 'Aveva.Pdms.MMServices'
!mmTools = object mmTools()
The string arguments can be a name like '/MyName' or a reference like '=123/45678'. If duplicate names are used, it is best to always use reference numbers to avoid confusion. The array arguments are arrays of strings of the same format.
!mmTools.link(!Name1 is STRING, !Name2 is STRING)
!mmTools.unlink(!Name is STRING)
!mmTools.unlink(!Names is ARRAY)
Note:
The MMTools object is not available in 12.1.SP4, use the following integrator object instead:
-
Equivalent initialization:
!!integratorInit()
-
Equivalent methods:
!!integrator.link(!Name1 is STRING, !Name2 is STRING)
!!integrator.unlink(!Name is STRING)
!!integrator.unlink(!Names is ARRAY)
MMViewer Object
The MMViewer object provides diagram viewer methods. To use these methods, the following initialization is required at the top of each PML file (object, function, or macro) where these methods are to be used.
import 'MMservices'
handle any
endhandle
The following initialization is also required in each method, function, or macro where the diagram methods are to be called.
using namespace 'Aveva.Pdms.MMServices'
!mmViewer = object mmViewer()
The following methods can be used to clear colors and close the current or all diagrams:
!mmViewer.resetDiagramColours()
!mmViewer.resetAllDiagramColours()
!mmViewer.closeDiagram()
!mmViewer.closeAllDiagrams()
The 'findOnDrawing' method opens the diagram for one or more schematic objects and highlights them.
Note:
Note that the argument is an array.
If an object appears on more than one diagram, you will be prompted to choose which diagram to open. This example shows how to view the linked schematic object for the current element in 3D.
!itemList[1] = !!ce.schlnk.ref.string()
!mmViewer.findOnDrawing(!itemList)
Individual Schematic objects can be colored on the Diagram view using the following methods. Note that these methods do not open a diagram or select an object. The results will be visible only if the relevant diagram is already open in the viewer.
!mmViewer.setColour(!Name is STRING, !Colour is STRING)
!mmViewer.setColour(!Name is STRING, !Colour is REAL
Note:
The MMViewer object is not available in 12.1.SP4, use the following IntegratorManager object instead:
-
Equivalent initialization:
import 'IntegratorAddin'
handle any
endhandle
using namespace 'Aveva.Pdms.IntegratorAddin'
!intMan = object IntegratorManager()
-
Equivalent methods:
!intMan.resetDiagramColours()
!intMan.resetAllDiagramColours()
!intMan.closeDiagram()
!intMan.closeAllDiagrams()
!itemList[1] = !!ce.schlnk.ref.string()
!intMan.findOnDrawing(!itemList)
!intMan.setColour(!Name is STRING, !Colour is STRING)
!intMan.setColour(!Name is STRING, !Colour is REAL)
MMManageLinks Object
Note:
This method should be used only when all of the DBs holding objects that have been
linked are current on the MDB.
The MMManageLinks object provides a method to validate and clean uplinks. To use this method the following initialization is required at the top of each PML file (object, function, or macro) where this method is to be used.
import 'MMservices'
handle any
endhandle
The following initialization is also required in each method, function, or macro where the method is to be called.
using namespace 'Aveva.Pdms.MMServices'
!!mmManageLinks = object mmManageLinks()
The validate method returns a BOOLEAN which will be TRUE if there are no links with invalid references, or FALSE if there are link objects with invalid references, such as may have occurred when objects have been deleted. It also outputs a list of links and any errors to the command line.
Note:
The validate method is not read only; it merges partially populated links, for example,
3D object "A" is linked to schematic object "A" by one link and schematic object "A"
is linked to engineering object "A" by another link, as can occur when links are created
in separate extract DBs. This merging has to occur before it can check for invalid
links.
!foundInvalidLinks = !!mmManageLinks.validate().not()
The removeInvalidLinks method deletes any link objects with invalid references.
!!mmManageLinks.removeInvalidLinks()
Note:
The MMManageLinks object is not available in 12.1.SP4, use the following integrator object instead:
-
Use the equivalent initialization:
!!integratorInit()
-
Use the equivalent method:
!!Integrator.validateLinks()