Diagram Viewer Methods
- Last UpdatedMay 02, 2022
- 1 minute read
The MMViewer object provides diagram viewer methods. To use these methods the following initialisation is required at the top of each PML file (object, function or macro) where these methods are used.
import 'MMservices'
handle any
endhandle
The following initialisation is also required in each method or function where the diagram methods are to be called.
using namespace 'Aveva.PDMS.MMServices'
!mmViewer = object mmViewer()
The following methods can be used to clear colours 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 elements and highlights them.
Note:
That the argument is an array. If an object appears on more than one diagram, the
user will be prompted to choose which diagram to open.
!mmViewer.findOnDrawing (!Name is STRing)
!mmViewer.findOnDrawing (!Name is ARRAY)
This example shows how to view the linked schematic object for the current element in 3D.
!mmViewer.findOnDrawing (!!ce.schlnk.ref.string ())
Individual schematic elements can be coloured on the diagram view using the following methods.
Note:
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)
The following method returns a Diagram Page object for the diagram page name of the form <Diagram Name>Page-<Page Number>, for example A0-01-2012-0001 Page-1, such as would be returned by the Integrator diagramList method.
!!mmViewer.diagramPage(!page is STRING) is DIAGRAMPAGE
The following method saves the diagram page to pdf file:
!diagramPage.saveAsPDF(!filename is STRING)