TM-1403 AVEVA Plant (12.1) PML Applied Rev 1.0
TM-1403 AVEVA Plant (12.1) PML Applied Rev 1.0
(12.1)
TRAINING GUIDE
Programmable Macro
Language:
Applied
TM-1403
www.aveva.com
AVEVA Plant (12.1)
Programmable Macro Language: Form Design - TM-1402
www.aveva.com
© Copyright 1974 to current year. 2
AVEVA Solutions Limited and its subsidiaries.
All rights reserved.
AVEVA Plant (12.1)
Programmable Macro Language: Form Design - TM-1402
Revision Log
Date Revision Description of Revision Author Reviewed Approved
04/01/2012 0.1 Issued for Review EJW
13/02/2012 0.2 Reviewed EJW SS
14/02/2012 1.0 Approved for Training PDMS 12.1.SP2 EJW SS NG
Updates
In general, all headings containing updated or new material will be highlighted. However, highlighting has
not been employed at Revision 1.0 as this is the intial release of this training guide.
Suggestion / Problems
If you have a suggestion about this manual or the system to which it refers, please report it to AVEVA
Training & Product Support (TPS) at [email protected]
This manual provides documentation relating to products to which you may not have access or which may
not be licensed to you. For further information on which products are licensed to you please refer to your
licence conditions.
Disclaimer
1.1 AVEVA does not warrant that the use of the AVEVA software will be uninterrupted, error-free or free
from viruses.
1.2 AVEVA shall not be liable for: loss of profits; loss of business; depletion of goodwill and/or similar losses;
loss of anticipated savings; loss of goods; loss of contract; loss of use; loss or corruption of data or
information; any special, indirect, consequential or pure economic loss, costs, damages, charges or
expenses which may be suffered by the user, including any loss suffered by the user resulting from the
inaccuracy or invalidity of any data created by the AVEVA software, irrespective of whether such losses are
suffered directly or indirectly, or arise in contract, tort (including negligence) or otherwise.
1.3 AVEVA shall have no liability in contract, tort (including negligence), or otherwise, arising in connection
with the performance of the AVEVA software where the faulty performance of the AVEVA software results
from a user's modification of the AVEVA software. User's rights to modify the AVEVA software are strictly
limited to those set out in the Customisation Manual.
1.4 AVEVA shall not be liable for any breach or infringement of a third party's intellectual property rights
where such breach results from a user's modification of the AVEVA software or associated documentation.
1.5 AVEVA's total liability in contract, tort (including negligence), or otherwise, arising in connection with the
performance of the AVEVA software shall be limited to 100% of the licence fees paid in the year in which the
user's claim is brought.
1.6 Clauses 1.1 to 1.5 shall apply to the fullest extent permissible at law.
www.aveva.com
© Copyright 1974 to current year. 3
AVEVA Solutions Limited and its subsidiaries.
All rights reserved.
AVEVA Plant (12.1)
Programmable Macro Language: Form Design - TM-1402
1.7. In the event of any conflict between the above clauses and the analogous clauses in the software
licence under which the AVEVA software was purchased, the clauses in the software licence shall take
precedence.
Trademarks
AVEVA and Tribon are registered trademarks of AVEVA Solutions Limited or its subsidiaries. Unauthorised
use of the AVEVA or Tribon trademarks is strictly forbidden.
AVEVA product/software names are trademarks or registered trademarks of AVEVA Solutions Limited or its
subsidiaries, registered in the UK, Europe and other countries (worldwide).
The copyright, trademark rights, or other intellectual property rights in any other product or software, its
name or logo belongs to its respective owner.
Copyright
Copyright and all other intellectual property rights in this manual and the associated software, and every part
of it (including source code, object code, any data contained in it, the manual and any other documentation
supplied with it) belongs to, or is validly licensed by, AVEVA Solutions Limited or its subsidiaries.
All rights are reserved to AVEVA Solutions Limited and its subsidiaries. The information contained in this
document is commercially sensitive, and shall not be copied, reproduced, stored in a retrieval system, or
transmitted without the prior written permission of AVEVA Solutions Limited. Where such permission is
granted, it expressly requires that this copyright notice, and the above disclaimer, is prominently displayed at
the beginning of every copy that is made.
The manual and associated documentation may not be adapted, reproduced, or copied, in any material or
electronic form, without the prior written permission of AVEVA Solutions Limited. Subject to the user's rights,
as set out in the customisation manuals to amend PML software files contained in the PDMSUI and PMLLIB
folders and any configuration files, the user may not reverse engineer, decompile, copy, or adapt the
software. Neither the whole, nor part of the software described in this publication may be incorporated into
any third-party software, product, machine, or system without the prior written permission of AVEVA
Solutions Limited, save as permitted by law. Any such unauthorised action is strictly prohibited, and may
give rise to civil liabilities and criminal prosecution.
The AVEVA software described in this guide is to be installed and operated strictly in accordance with the
terms and conditions of the respective software licences, and in accordance with the relevant User
Documentation.
Copyright 1974 to current year. AVEVA Solutions Limited and its subsidiaries. All rights reserved. AVEVA
shall not be liable for any breach or infringement of a third party's intellectual property rights where such
breach results from a user's modification of the AVEVA software or associated documentation.
AVEVA Solutions Limited, High Cross, Madingley Road, Cambridge, CB3 0HB, United Kingdom.
www.aveva.com
© Copyright 1974 to current year. 4
AVEVA Solutions Limited and its subsidiaries.
All rights reserved.
Contents
1 Introduction .............................................................................................................................................. 7
1.1 Aim..................................................................................................................................................... 7
1.2 Objectives ......................................................................................................................................... 7
1.3 Prerequisites .................................................................................................................................... 7
1.4 Course Structure .............................................................................................................................. 7
1.5 Using this Guide ............................................................................................................................... 7
2 PML Overview .......................................................................................................................................... 9
2.1 PML 1 – String Based Command Syntax ....................................................................................... 9
2.1.1 Example of a simple command syntax macro ........................................................................... 9
2.1.2 Examples of command syntax ................................................................................................... 9
2.1.3 Syntax graphs .......................................................................................................................... 10
2.2 PML 2 – Object-orientated programming .................................................................................... 11
2.2.1 Features of PML 2 .................................................................................................................... 11
2.2.2 Examples of object-orientated PML ......................................................................................... 11
2.2.3 Software Customisation Reference Manual ............................................................................. 11
2.3 PML Objects ................................................................................................................................... 12
2.3.1 Creating variables (instances of objects) ................................................................................. 12
2.3.2 Naming conventions ................................................................................................................. 13
2.3.3 Using the members of an object .............................................................................................. 13
2.3.4 Special objects used in PDMS ................................................................................................. 13
2.4 PML Functions and Methods ........................................................................................................ 14
2.4.1 Arguments of type ANY ............................................................................................................ 14
2.5 PML Forms...................................................................................................................................... 15
2.6 PDMSUI environment variable ...................................................................................................... 16
2.7 PMLLIB environment variable ...................................................................................................... 16
2.8 Modifications to the PDMSUI and PMLLIB .................................................................................. 17
Exercise 1 – Updating the environment variables ..................................................................................... 17
3 Using PML Objects ................................................................................................................................ 19
3.1 What is a PML object? ................................................................................................................... 19
3.2 Example of PML objects available in PDMS ................................................................................ 19
3.3 Why are PML objects used? ......................................................................................................... 20
3.4 Defining a data structure ............................................................................................................... 20
3.5 The Model-View-Presenter concept ............................................................................................. 21
Worked Example – Creating an object ........................................................................................................ 21
Exercise 2 – Developing another object ...................................................................................................... 23
4 User Feedback ....................................................................................................................................... 25
4.1 What is feedback?.......................................................................................................................... 25
4.2 Examples of feedback in within PDMS ........................................................................................ 25
4.3 Aid Graphics ................................................................................................................................... 26
4.4 Adding colour to the model .......................................................................................................... 27
4.5 Adding feedback to a form ............................................................................................................ 28
Worked Example – Adding feedback to the form ....................................................................................... 28
Exercise 3 – Adding feedback to the model ............................................................................................... 30
5 Developing new PML functionality ...................................................................................................... 31
5.1 At the beginning of a development... ........................................................................................... 31
5.2 Stages to the PML development ................................................................................................... 31
5.3 Using Wireline sketches ................................................................................................................ 32
5.4 What do users always need to do? .............................................................................................. 32
5.5 What is good user interface design? ........................................................................................... 33
5.5.1 How easy is the form to use? ................................................................................................... 33
5.5.2 Have the correct gadgets been used? ..................................................................................... 33
5.5.3 Can the form be resized and have gadgets been anchored? .................................................. 34
5.5.4 Have progressive or staged disclosure been considered? ...................................................... 35
5.5.5 How many mouse clicks are required to use the form? ........................................................... 35
5.5.6 Are pop-up alert boxes used? .................................................................................................. 36
5.5.7 Is there a flow through the form ............................................................................................... 37
5.5.8 How much feedback or assistance is offered? ........................................................................ www.aveva.com 37
5.5.9 How reliable is the form? .......................................................................................................... 38
5
© Copyright 1974 to current year.
AVEVA Solutions Limited and its subsidiaries.
All rights reserved.
AVEVA Plant (12.1)
Programmable Macro Language: Appied - TM-1403
www.aveva.com
© Copyright 1974 to current year. 6
AVEVA Solutions Limited and its subsidiaries.
All rights reserved.
CHAPTER 1
1 Introduction
This training guide is designed to give an introduction to the AVEVA Plant Programming Macro Language.
There is no intention to teach software programming but only provide instruction on how to customise PDMS
using Programmable Macro Language (PML) in AVEVA Plant.
This training guide is supported by the reference manuals available within the products installation
folder. References will be made to these manuals throughout the guide.
1.1 Aim
The following points need to be understood by the trainees:
1.2 Objectives
At the end of this training, you will have:
Knowledge of how Forms are created and how Form Gadgets and Form Members are defined
Understanding of Menus and Toolbars are defined with PML
Understanding of Collections, Basic Event Driven Graphics, Error Tracing and PML Encryption
1.3 Prerequisites
The participants must have:
Completed an AVEVA Basic Design Course and have a familiarity with PDMS
Completed the PML: Macros & Functions Course or have familiarity with PML.
Menu pull downs and button press actions are indicated by bold dark turquoise text.
System prompts should be bold and italic in inverted commas i.e. 'Choose function'
Example files or inputs will be in the courier new font with colours and styles used as before.
www.aveva.com
7
© Copyright 1974 to current year.
AVEVA Solutions Limited and its subsidiaries.
All rights reserved.
AVEVA Plant (12.1)
Programmable Macro Language: Appied - TM-1403
www.aveva.com
© Copyright 1974 to current year. 8
AVEVA Solutions Limited and its subsidiaries.
All rights reserved.
CHAPTER 2
2 PML Overview
Programmable Macro Language (PML) is the customisation language used by AVEVA Plant and it provides
a mechanism for users to add their own functionality to the AVEVA Plant software family. This functionality
could be as simple as a re-naming macro, or as complex a complete user-defined application (and
everything in between).
PML is a coding language specific to AVEVA products based on the command syntax that is used to drive
PDMS. As the product develops, PML is also improved providing new functionality and bringing it closer to
other object-orientated programming languages, while still retaining the powerful command syntax.
Although it is one language, there are three distinct parts:
PML 1 the first version of PML based on command syntax. String based and provides IF
statement, loops, variables & error handling
PML 2 object oriented language extending the ability of PML. Use of functions, objects and
methods to process information (also covered in TM-1402 – Form Design)
PML .NET provides the platform in PML to display and use objects created in other .NET
languages (covered in TM-1402 – Form Design)
A simple macro is likely to be written completely in command syntax and allows users to re-run popular
commands. Saved as an ASCII file, the macro can be run in PDMS through the command window (by
typing $m/FILENAME or by dragging and dropping the file).
Macros can be extended to include IF statements, DO loops, variables and error handling (explained further
later in the course) If additional information is typed onto the same line as the call for the macro, then these
become input parameters and are available for use within the macro.
In this example, the three numbers (100, 200 & 300) become the three parameters supplied to the macro.
To set a value to an attribute on the current element (for example XLEN), type XLEN 300
Manipulating the drawlist in DESIGN:
To add the current element to the drawlist, type ADD CE
To add a specific element below a piece of equipment, type ADD ONLY /E1301-S1
To remove all the elements from the drawlist, type REM ALL
The above syntax graph is for the ADD syntax (used to add elements to the drawlist). From the graph it can
be seen that only two words are required (e.g. ADD /PIPE) but others can be included (e.g. ADD ONLY
/PIPE1 /PIPE2 COL 3).
The $Q syntax can also tell you the next allowable part of the syntax. For example ADD $Q-10 would print
the 10 next available words that can follow the command ADD.
More examples of command syntax and the supporting syntax graphs can be found in the relevant
reference manuals provided with AVEVA Plant.
www.aveva.com
© Copyright 1974 to current year. 10
AVEVA Solutions Limited and its subsidiaries.
All rights reserved.
AVEVA Plant (12.1)
Programmable Macro Language: Appied - TM-1403
PML 2 provides for classes of built-in, system-defined and user-defined object types. Objects have members
(their own objects) and methods (their own functions). All PML variables instances of (1) built-in, (2) system-
defined or (3) user-defined objects.
Through the use of method concatenation, it is possible to achieve multi-operations in a single line of code.
This means that PML 2 methods are typically shorter and easier to read than the PML 1 equivalent. While
most PML 1 macros will still run within PDMS, PML 2 brings many new features that were previously
unavailable. If used together with command syntax it must be expressed as a string before use.
Clearing an object
To empty an object, type !exampleObject.clear()
To delete an object that is no longer needed, type !exampleObject.delete()
For each of the members the name, type and purpose is provided
For each method the name, argument types, returned object type and purpose are provided.
Refer to the Software Customisation Reference Manual for more information about the major objects.
www.aveva.com
© Copyright 1974 to current year. 11
AVEVA Solutions Limited and its subsidiaries.
All rights reserved.
AVEVA Plant (12.1)
Programmable Macro Language: Appied - TM-1403
Refer to the Software Customisation Reference Manual for more examples of System-defined objects
When a variable is declared as a specific object type, it is given all the members (attributes) and methods of
the object definition. This means standard groupings can be setup to store data and that code repetition can
be avoided.
A user-defined object provides an opportunity to group data together for a specific purpose. Once grouped
as an object, it can be assigned to a variable and used as any other object. The following are examples of
two user-defined objects:
These objects would be defined as two separate object files (.pmlobj) and loaded into PDMS. You will
notice that the object PRODUCT is able to have a member which is another user-defined object. This
means that the PRODUCT object has access to all the members and methods of a FACTORY object.
The difference between the two is that global variables last for the whole PDMS session and can be
referenced directly from other PML routines. Local variables are only available within the routine which
defined them. The variables a declared with a single „!‟ for local and a double „!!‟ for global
It is also possible to define a variable as an object-type without an initial value. The value is therefore
UNSET
www.aveva.com
© Copyright 1974 to current year. 12
AVEVA Solutions Limited and its subsidiaries.
All rights reserved.
AVEVA Plant (12.1)
Programmable Macro Language: Appied - TM-1403
For example, the type might be WORKERS while the name of the variable might be numberOf Workers
Notice that to make the variable name more meaningful, full words are used with a mixture of upper and
lower case letters to make it readable.
Variable names should not start with a number or contain any spaces or full stops (full stops are used in
PML2 to indicate methods and members – explained later)
AVEVA uses a CD prefix on most of its global variables. Newer functionality does not use a prefix so
all new PML must be checked for name clashes. Using your own prefix could help avoid this.
After being declared as above (using the OBJECT keyword and ending with a double bracket, the local
variable !newPlant is now a FACTORY object and has the same members as the FACTORY object. These
members are available to store information and can be assigned values in the following way:
!newPlant.name = |ProcessA|
!newPlant.workers = 451
!newPlant.output = 2000
Notice the use of a dot between the variable and its member. This works as long as the word after the
dot is a valid member of the variable object-type.
Once assigned a value, this value is available for use and can be recalled. For example:
!numberOfWorkers = !newPlant.workers
This creates a new local real variable and assigns it the value 451
!!CE - a global DBREF object which tracks and represents the current element
!!ERROR - a global ERROR object which holds information about the last error
!!PML - used to obtain file path strings through the .getPathName() method
!!ALERT - used to provide popup feedback to users
!!AIDNUMBERS - used to manage aid graphics
!!APPDESMAIN - the form which represents the main DESIGN interface
www.aveva.com
© Copyright 1974 to current year. 13
AVEVA Solutions Limited and its subsidiaries.
All rights reserved.
AVEVA Plant (12.1)
Programmable Macro Language: Appied - TM-1403
A function and a method are written in the same style, the only difference is where the definition is stored
and how it is called. A function is a global method (stored in its own file) and can be called directly on the
command line (e.g. call !!exampleFunction() ) while a method is local to the object it is defined within (e.g.
!exampleObject.exampleMethod() )
Arguments become local variables within the function/method and the object-types need to be declared
within the definition. The returned object-type is also defined. For example:
In this example, the function !!area is expecting two real arguments. The two arguments are expressed as
local variables which are multiplied together to calculate the local variable !area. Using the return keyword,
the variable !area is then returned. If the function was called in following way, the variable !area will have a
value of 2400:
www.aveva.com
© Copyright 1974 to current year. 14
AVEVA Solutions Limited and its subsidiaries.
All rights reserved.
AVEVA Plant (12.1)
Programmable Macro Language: Appied - TM-1403
The above example is the definition of a form called nameCE. Saved within one file (.pmlfrm), it defines two
form members (a predefined member for the title and a new button gadget) and a form method.
!this is a special local variable and using it replaces the need to reference the owning object directly. For
example, to call the method .print() from within the form, the call is !this.print() and to call the method from
anywhere else, it‟s !!nameCE.print()
www.aveva.com
© Copyright 1974 to current year. 15
AVEVA Solutions Limited and its subsidiaries.
All rights reserved.
AVEVA Plant (12.1)
Programmable Macro Language: Appied - TM-1403
set PDMSUI=C:\AVEVA\Plant\PDMS12.1.1\pdmsui
The purpose of an environment variable is to reduce the length of the command used to call a macro. This
means that $M/%PDMSUI%\DES\PIPE\MPIPE can be typed instead of the full file path.
In standard product, this process is shortened further as all PML1 macros and forms are called using
synonyms. For example, the macros associated with piping are called using the synonym CALLP:
$S CALLP=$M/%PDMSUI%/DES/PIPE/$s1
CALLP MPIPE
If all synonyms are killed then PDMS will cease to function as normal
set PMLLIB=C:\AVEVA\Plant\PDMS12.1.1\pmllib
The PMLLIB environment variable differs because it can be searched dynamically. This means that the
individual files do not need to be referenced directly and can be called by name. This is possible because
PDMS compiles a pml.index file which sits in the PMLLIB folder and provides the path to all suitable files
within it. For example, to load and show a form the command is show !!exampleForm, there is no need to
reference the file path at all.
If a new file is created or the PMLLIB variable is changed then there is a need to update the pml.index file.
This can be done by typing PML REHASH onto the command window. If there are multiple paths that need
updating, type PML REHASH ALL
If a PML object has already been loaded into PDMS, but the file definition has changed then the object
needs to be killed and reloaded before the changes can be seen. This can be done by typing either pml
reload form !!exampleForm or pml reload object EXAMPLEOBJECT
Although not necessary, it is good practice to organise the files below the PMLLIB folder. A standard PDMS
installation organises the files based on application and then on forms, functions, objects. This is normally a
good starting point for organising customisation.
www.aveva.com
© Copyright 1974 to current year. 16
AVEVA Solutions Limited and its subsidiaries.
All rights reserved.
AVEVA Plant (12.1)
Programmable Macro Language: Appied - TM-1403
It keeps the customisation separate from the standard install, so as subsequent versions are
installed there will not be a need to move the customised files.
If any standard files are modified then the originals are still available if required
If the customisation fails, the standard installation is available to go back to
Many local PDMS installations can reference the same customisation from a network address
Any changes to AVEVA standard product may cause PDMS to function inappropriately
It is possible to get PDMS to look in different places for PML and this is done by setting the environment
variables to multiple paths. This allows the standard install to be kept separate from user and company
customisation. This is done by updating the variable to include another path, for example:
This will put the additional file path in front of the standard (which would have already been defined in the
.bat file). This change can also be checked in a PDMS session by typing q evar PDMSUI or q evar PMLLIB
onto the command window.
1 Extract the provided files into the folder a suitable folder, for example C:\temp\
Right –click on the icon that opens PDMS. Choose Open File Location
Save the .bat as a new file to the computers desktop. This is now the icon you
will use to enter PDMS.
4 Confirm that the search paths have been correctly updated by typing q evar PDMSUI or q
evar PMLLIB into the command window.
www.aveva.com
© Copyright 1974 to current year. 17
AVEVA Solutions Limited and its subsidiaries.
All rights reserved.
AVEVA Plant (12.1)
Programmable Macro Language: Appied - TM-1403
www.aveva.com
© Copyright 1974 to current year. 18
AVEVA Solutions Limited and its subsidiaries.
All rights reserved.
CHAPTER 3
Object Members – the properties of the object, used to hold its definition
Object Methods – the actions available on the object
An object can be used to represent anything; consider the computer being used to complete this training
guide:
To investigate these objects, type the following into the command window:
q var !!gphdrawlists.attributes()
q var !!gphdrawlists.methods()
These objects are defined by a .pmlobj file, stored within the %PMLLIB% environment variable. Browse to
find the files and look through their definition.
PML files can be located by passing the name of the object to the PMLDEFINITION function e.g.
www.aveva.com
!!pmldefinition(|gphline|)
19
© Copyright 1974 to current year.
AVEVA Solutions Limited and its subsidiaries.
All rights reserved.
AVEVA Plant (12.1)
Programmable Macro Language: Appied - TM-1403
PML objects can also be used to used to solve complex problems by representing actual objects in the real
world. Consider how a complex problem, such as particle motion could be solved by modelled wach particle
as an object.
As an example, consider the packet of information which is used to configure a graphical pick within PDMS.
Event Driven Graphics (EDG) are controlled by an EDGPACKET object, defining the required pick. The
detail of the EDGPACKET object is fully defined by a series of PML objects, each used to control and
configure different parts of the pick.
To investigate the object structure, type the following into the command window:
q var !packet.pickpacket
q var !packet.pickpacket.methods()
www.aveva.com
© Copyright 1974 to current year. 20
AVEVA Solutions Limited and its subsidiaries.
All rights reserved.
AVEVA Plant (12.1)
Programmable Macro Language: Appied - TM-1403
Model – the stored data or data model that will be interacted with by the user interface
View – provides the data stored in the model and passes it the interaction with the presenter
Presenter – receives data and displays data in the model and displays it in the view.
This technique is widely used in .NET languages when designing a user interface, allowing code to more
flexible and easier to maintain. It also means the model and view can be tested separately.
Consider the following arrangement. It is a PML application of MVP principle, allowing a user to modify a
PDMS element via a PML object:
In this arrangement, the PDMS user interacts with the form to enter the required changes. The form
methods supply the entered information to the PML object, which processes the information and updates the
PDMS element. Once updated, the new information is held by the object and sent back to the form to be
displayed to the user.
It allows the PML object to be created and tested separately from the PML form. It also means that the PML
object can be designed to work with muiltiple forms.
www.aveva.com
© Copyright 1974 to current year. 21
AVEVA Solutions Limited and its subsidiaries.
All rights reserved.
AVEVA Plant (12.1)
Programmable Macro Language: Appied - TM-1403
2. The form performs the element collection within the form methods. An element collection is a generic
operation that could be used by multiple forms. Lets move the collection code to a separate object.
Create a new PML object file called elementcollection.pmlobj and add the following definition:
Save the file and type PML REHASH ALL into the command window to make the object available
3. Move the .collect() method from the form to the object and update it to refer to the object members.
For example,
Update the method so that it returns an array of the collected elements and also stores them as part of
the object. Remove the !this.fillGrid() call.
4. Add an ELEMENTCOLLECTION object to the form as a form member and call it .collection
Add the following callbacks to the three textboxes on the PML form:
!this.collect.callback = |!this.fillGrid()|
Update the .fillGrid() method to call the collect method on the ELEMENTCOLLECTION object by
including the following:
!this.elements = !this.collection.collect()
5. Test the form with a range of collections and filters. How does the form react? How can the methods
be made more robust to prevent any errors?
www.aveva.com
© Copyright 1974 to current year. 22
AVEVA Solutions Limited and its subsidiaries.
All rights reserved.
AVEVA Plant (12.1)
Programmable Macro Language: Appied - TM-1403
If a user works with the same form regularly, they may wish for the form to remember the last values they
entered. Within the same PDMS session, this is already taken care of (as long as the form isn‟t reloaded),
but not between sessions.
To give forms the ability to remember values, develop a PML object called FORMVALUESTORE
.form is FORM
.gadgets is ARRAY
.values is ARRAY
.file is FILE
.formValueStore(!form is FORM)
.saveValues()
.loadValues()
The constructor method receives an instance of the form so it knows which form to read from and load to.
Loop through the members of the form and look for gadgets.
If it‟s a gadget, does it have a .val member
If it does, store the value and gadget in the object members
Save the form name, gadget names and values to a settings file (using %PDMSUSER%)
Consider when the form should call the methods on the object? Would it be when it is loaded or unloaded?
Shown or hidden?
.saveValues()
.loadValues()
www.aveva.com
© Copyright 1974 to current year. 23
AVEVA Solutions Limited and its subsidiaries.
All rights reserved.
AVEVA Plant (12.1)
Programmable Macro Language: Appied - TM-1403
www.aveva.com
© Copyright 1974 to current year. 24
AVEVA Solutions Limited and its subsidiaries.
All rights reserved.
CHAPTER 5
4 User Feedback
Anything which provides the users with information about an action they have just completed can be classed
as feedback. This might include:
Consider the following situation; feedback reinforces and enhances the use of a PML form. The more
feedback provided, the more likely the form will be used correctly and successfully.
Required
outcome
PDMS
User Feedback
The form locates the position using a set of axis and draws the volume of the current element. This aid
graphic information updates to show a preview of where the element will move to if Apply is clicked. This
feedback allows users to visually confirm the move, before committing to it.
A list allows PDMS elements to be grouped so they can be used together. On the form there is a “Highlight”
toggle which highlights the collected elements. This means the user can understand what is contained
within the list before using it.
A GPART element in the catalogue acts as a pointer element, linking the catalogue or template item to the
specification. The form uses a local 3D view to preview of the item being referenced by the GPART. This
means the user doesn‟t have to rely on the name of the item to understand what it is.
For example, to create an aid line between two points with a PML command:
When an aid graphic is created it can be assigned a number. This helps identify it, allowing it to be altered
or removed. For example, to create an number dashed aid line with a PML command:
To remove the numbered line aid graphics, the following command can be used:
Using this command will remove all aid graphics from the screen. If any aid graphics are being used be
another form, these will also be removed
For more information about the available commands and associated syntax graphcs, refer to the
Design Reference Manual : General Commands
To create a line aid graphic using a PML object, use the following
The three REAL arguments to the .draw() method on a LINE object are:
Once drawn, the aid graphic can be used with the PML command AID CLEAR LINE 100
Other geometric PML objects have a .draw() method. Refer to the Software Customisation Reference
Manual for more information
For example, to add colour to an element with a PML command, type the following:
ENHANCE CE COL 10
Where CE is a selection (i.e. current element) and 10 is the required colour (i.e. white)
Once an element has been highlighted, the colour can be removed, type the following:
UNENHANCE CE
UNENHANCE ALL
Running this command will remove all highlight, even if not created by the PML
To highlight an element using PML objects, there are methods available on the global drawlist object, use
the following:
Notice how a colour object can be used to work out what number a colour has.
If more drawlists are created and registered with the global drawlist object, they will be available for use. In
this case, the first drawlist is the drawlist to the main 3D view.
!!gphdrawlists.drawlists[1].unhighlight(!!ce)
If an element is highlighted by PML, it is a good idea to store the element reference. This will make it
easier to remove the highlight once the PML has finished.
2. Consider what parts of the workflow are important to ensure the form does not error. Lets add a method
that checks if the collection criteria has been provided.
Add a method to the form called .checkCriteria() and set it as the callback on the three criteria
text boxes. Move the current callbacks to the .fillGrid() method. Also add it to the form initialisation
callback.
www.aveva.com
© Copyright 1974 to current year. 28
AVEVA Solutions Limited and its subsidiaries.
All rights reserved.
AVEVA Plant (12.1)
Programmable Macro Language: Appied - TM-1403
3. The first check to make it that at least one of the text box has a value set. Update the method:
if !this.types.val.eq(||).and(!this.filter.val.eq(||)).and(!this.scope.val.eq(||)) then
!this.collect.active = FALSE
!this.message.val = |Please enter some collection criteria|
return
endif
endmethod
This method deactivates the Collect Elements button if no value has been entered and provides
feedback. Show the form and test the feedback.
4. Another check might be to confirm that the entered criteria is valid. For example, has the user entered
valid element types. Add the following code to the end of the .checkCriteria() method:
!errors = ||
do !type values !this.types.val.split()
!elementType = object ELEMENTTYPE(!type)
!owners = !elementType.parentTypes()
if !owners.unset() then
!errors = !errors & | | & !type
endif
enddo
if !errors.length().gt(0) then
!this.collect.active = FALSE
!this.message.val = !errors & | - not valid element types|
return
endif
Notice how the ELEMENTTYPE object is used to check if an element is valid. The method builds a
string of the invalid element types and display s them to the user.
5. Test the form further and consider how the method can be extended to check the filter and scopes are
valid. What other messages could be given to the user (e.g. if no elements are found)?
www.aveva.com
© Copyright 1974 to current year. 29
AVEVA Solutions Limited and its subsidiaries.
All rights reserved.
AVEVA Plant (12.1)
Programmable Macro Language: Appied - TM-1403
When elements are collected the list displays the names. To demonstrate these elements to the user, add a
method to the form that highlights collected elements in th drawlist.
The elements in the main drawlist can be obtained with the following:
!members = !!gphdrawlists.drawlists[1].members()
Add an ARRAY member to the form to store the elements that are highlighted
Before highlighting any elements, the method should check if any elements have been previously
highlighted and unhighlight them.
This method can be extended by also labelling the highlighted elements with the name.
Test the form and method to ensure the highlighting works correctly.
www.aveva.com
© Copyright 1974 to current year. 30
AVEVA Solutions Limited and its subsidiaries.
All rights reserved.
CHAPTER 5
At the beginning any new PML development, it is important to understand the reasons and requirements
behind it. The functionality will ultimately be for a specific user to aid their use of PDMS. Identifying the user
and their requirements first will help steer the development, ensuring it addresses the original need.
Who?
Who is the ultimate user of the development and whose requirements are being addressed?
What?
What are the requirements of the end user and what will they expect the new functionality to
provide? Ultimately, what are they trying to achieve?
Why
Why is the functionality needed? What benefits will it bring? Identifying this information will help
define the solution and will help create the test case scenario.
The final user of the functionality is the most important person. This should be considered at every
stage of the development. Their involvement is important to ensure a successful development.
1) Address the Who, What and Why of the proposed new development.
2) Document this information and supply it to the final user for comment. Make the user aware of what
functionality will be provided and how this functionality addresses their requirements.
3) Begin to develop a solution by making some initial decisions.
a. Is a form required?
i. If a form is required, what will it display?
ii. Produce a mock-up sketch (wire-frame) of the proposed layout
b. Do any new PML objects need developing?
i. What will the objects be required to do?
c. Will the PML need do any data manipulation, calculation or processing?
i. Develop a flow diagram showing the how the PML will function
d. What PDMS modules will need to functionality?
i. This will dictate where the PML is stored and what information is available to the
functionality at the time of use
4) Supply the user with more detail of how the development will work and how it will look and feel. Let
the users provide feedback on the layout to ensure it is as they expect
5) Develop the prototype solution and setup an environment with a scenario for the user to test on.
Take away and incorporate any additional feedback from the user. Finalise the solution.
6) Document, deploy and distribute the new development to the users
Getting the user to feed into the development process helps guide it and keeps it focussed on their
requirements. Visual mock-ups and test environments allow the user to experience what will be delivered
and should prevent any user-issues at the end. Instead of trying to guess what a user wants, get them
involved and incorporate their feedback.
www.aveva.com
31
© Copyright 1974 to current year.
AVEVA Solutions Limited and its subsidiaries.
All rights reserved.
AVEVA Plant (12.1)
Programmable Macro Language: Appied - TM-1403
The temptation might be to jump straight into writing PML, but a good sketch is quicker to produce and can
say more than writing a functionality specification.
As an example, there is a requirement to give a user the ability to look at the history of an element. Rather
than guessing what functionality is needed, the following quick sketch can start the discussion.
Not all of the following points will be relevant for every development, but it is worth considering them.
Lock/Fix/ Search/Locate
Protect Work information
Output Information Work Graphically
(automatically)
Reference data
and information
What do users always
Query/Report want to do? Modify
(Dynamically)
Share/Collaborate Clear/Delete
www.aveva.com
© Copyright 1974 to current year. 32
AVEVA Solutions Limited and its subsidiaries.
All rights reserved.
AVEVA Plant (12.1)
Programmable Macro Language: Appied - TM-1403
Although by definition a subjective topic, there are some aspects to form design that are always the case
and should be considered when developing any interface:
Although a context menu will save space on a form, how many users would know to look for it? By moving
this menu onto the form, the functionality is obvious and is clearly available to the users.
Some parts of the forms may need to be complex, but this should be kept to a minimum and assistance
should be provided through documentation or additional feedback on the form.
The aim should be that a user will be able to use the basic form unctionality without guidance
For example, if the user has to make a choice from a set number of options this could be done with a list,
option or combo gadget. It could also be achived with toggles or radio toggles (within a frame).
The choice in gadget should reflect the user expectation and the required outcome. For a short list of fixed
choices consider using radio toggles. For longer variable lists, consider using list or combo gadget.
A combo gadget is good for long lists as a search mechanism could be written within its open callback.
The choice of which gadgets to use will be a trade-off between the desired user experience and the
programming effort to achieve it.
www.aveva.com
© Copyright 1974 to current year. 33
AVEVA Solutions Limited and its subsidiaries.
All rights reserved.
AVEVA Plant (12.1)
Programmable Macro Language: Appied - TM-1403
Consider the above three forms. They all provide the same set of multiple choices, but in different ways. As
the toggles are defined during form definition, the number is fixed in the first form, while the choices on the
others can be extended. However, the code required for the first two is considerably less than the third.
5.5.3 Can the form be resized and have gadgets been anchored?
If a form is designed to display information to the user then the available space should be considered. Is the
form big enough to display all the possible information? A resizeable form gives users the ability to resize a
form to suit its contents. However, allowing a form it resize is only half of the consideration:
If a form can be resized then how the gadgets are docked or anchored needs to be considered. A docked or
anchored gadget will resize or move with the resized form. This means that the above list would resize
making all the information visible.
www.aveva.com
© Copyright 1974 to current year. 34
AVEVA Solutions Limited and its subsidiaries.
All rights reserved.
AVEVA Plant (12.1)
Programmable Macro Language: Appied - TM-1403
Progressive – secondary or additional functionality (i.e. settings) are stored on additional forms or
panels on the form. These are usually accessed by buttons from the main form.
Staged – a “wizard-style” approach to progression through a form. The user is only presented with
functionality as it is required, effectively stepping them through a process. This can be achieved by
controlling the visibility of gadgets on the form, or by sequentially stepping through a series of forms.
For an example of progressive disclosure refer to the “Graphics Settings” form (from Settings>Graphics…
within PDMS Design). Options are available within the tabs, with the more advanced options found on
secondary forms (e.g. “Advanced…” under the Representation tab)
For an example of staged disclosure refer to the “Create DEPT” form (from Create>Department… in within
PDMS Draft). A series of forms are shown in sequence allowing the user to create a Draft hierarchy down to
VIEW level. At any time the user can break the process, or use progressive disclosure to update attributes.
Although not applicable in every development, disclosure allows the user to be guided through a form. If the
functionality has a sequence of predefined steps or a set of advanced settings, consider disclosure to tidy up
the interface.
5.5.5 How many mouse clicks are required to use the form?
If a user has to make too many choices or interact with lots of form gadgets, this can interrupt the workflow
and reduce the user experience.
www.aveva.com
© Copyright 1974 to current year. 35
AVEVA Solutions Limited and its subsidiaries.
All rights reserved.
AVEVA Plant (12.1)
Programmable Macro Language: Appied - TM-1403
Consider a form that has many options the user can choose. The user cannot progress with the form until
they have worked through each option.
Does the user need to make every choice? A set of default values would allow the user to proceed straight
away, or update the choices if required. This could be taken further by writing the users choices to file
during the close event so they are available for next session.
Consider the action of exiting PDMS. If work has not been saved it is appropriate to prompt the user asking
if they wish to save their work.
Alert boxes are useful if you want to disrupt the workflow of the form, but consider whether there are better
ways of addressing the issue. For example, consider the following form. If the user has not made a choice,
they receive a message telling to do so.
A more appropriate approach could be to prevent the Apply button from being clicked before a choice has
been made. Additional feedback on the form would be necessary to direct the user.
www.aveva.com
© Copyright 1974 to current year. 36
AVEVA Solutions Limited and its subsidiaries.
All rights reserved.
AVEVA Plant (12.1)
Programmable Macro Language: Appied - TM-1403
It can be tempting to try a make an alert box fit the question that the user needs to answer. A better solution
would be to use a developed child form specifically for the question. This will avoid the classic “click Yes for
Up” and give more control over its appearance and functionality.
The flow through a form could be assisted with the use of titles and “steps”. Coupled with the staged
activation of gadgets, the users can be led through the for.
www.aveva.com
© Copyright 1974 to current year. 37
AVEVA Solutions Limited and its subsidiaries.
All rights reserved.
AVEVA Plant (12.1)
Programmable Macro Language: Appied - TM-1403
It is good practice that for every assumption made in the code, there should be an appropriate check and
feedback. Do not wait until the “Apply” button is clicked to check the users inputs
Within standard PDMS, it is now common to see functionality appear on right docking forms with a “refresh”
button at the top and “Tasks” at the bottom.
This will include the style of icons used, the type and location of
buttons on the form, the naming convention of displayed
information, wording of feedback etc.
For each, the who, what and why have already been addressed, along with some additional points to
consider while developing a solution.
If there is a specific development that you would like to address instead of these exercises, please
discuss this will the course tutor.
PDMS Designer
www.aveva.com
© Copyright 1974 to current year. 38
AVEVA Solutions Limited and its subsidiaries.
All rights reserved.
AVEVA Plant (12.1)
Programmable Macro Language: Appied - TM-1403
1. Consider the Who, What and Why of the request and develop this as a requirement spec. Identify what
functionality is required to address the problem
2. Develop a wireline sketch to outline your proposed development. Highlight the major pieces of
functionality and add notes to justify what is being provided
4. Finish the development by creating some user documentation to describe its use. How will the
development be considered a success?
PDMS Checker
1. Consider the Who, What and Why of the request and develop this as a requirement spec. Identify what
functionality is required to address the problem
2. Develop a wireline sketch to outline your proposed development. Highlight the major pieces of
functionality and add notes to justify what is being provided
www.aveva.com
© Copyright 1974 to current year. 39
AVEVA Solutions Limited and its subsidiaries.
All rights reserved.
AVEVA Plant (12.1)
Programmable Macro Language: Appied - TM-1403
4. Finish the development by creating some user documentation to describe its use. How will the
development be considered a success?
Project Manager
1. Consider the Who, What and Why of the request and develop this as a requirement spec. Identify what
functionality is required to address the problem
2. Develop a wireline sketch to outline your proposed development. Highlight the major pieces of
www.aveva.com
© Copyright 1974 to current year. 40
AVEVA Solutions Limited and its subsidiaries.
All rights reserved.
AVEVA Plant (12.1)
Programmable Macro Language: Appied - TM-1403
4. Finish the development by creating some user documentation to describe its use. How will the
development be considered a success?
www.aveva.com
© Copyright 1974 to current year. 41
AVEVA Solutions Limited and its subsidiaries.
All rights reserved.
Appendix A
container .frame NOBOX PMLNETCONTROL 'grid' at xmin ymax anchor all width 30 height 9
exit
----------------------------------------------------------------------------------------------------
-- Default CONSTRUCTOR method - Setup the grid and set the callback on the collect button --
----------------------------------------------------------------------------------------------------
define method .c3ex2()
endmethod
www.aveva.com
42
© Copyright 1974 to current year.
AVEVA Solutions Limited and its subsidiaries.
All rights reserved.
AVEVA Plant (12.1)
Programmable Macro Language: Appied - TM-1403
----------------------------------------------------------------------------------------------------
-- Method .collect() - Collect the elements based on the criteria --
----------------------------------------------------------------------------------------------------
define method .collect()
endmethod
----------------------------------------------------------------------------------------------------
-- Method .fillGrid() - Fill the grid with the collected elements --
----------------------------------------------------------------------------------------------------
define method .fillGrid()
-- Create headings
!headings = |Name|
-- Get the collected elements as STRING objects (required for the grid)
!data = !this.elements.evaluate(object BLOCK(|!this.elements[!evalIndex].string()|))
endmethod
----------------------------------------------------------------------------------------------------
-- Method .setupGrid() - Format the grid as required --
----------------------------------------------------------------------------------------------------
define method .setupGrid()
!this.grid.columnExcelFilter(FALSE)
!this.grid.setNameColumnImage()
!this.grid.outlookGroupStyle(FALSE)
!this.grid.fixedHeaders(FALSE)
!this.grid.fixedRows(FALSE)
!this.grid.columnSummaries(FALSE)
!this.grid.autoFitColumns()
!this.grid.editableGrid(FALSE)
endmethod
----------------------------------------------------------------------------------------------------
-- End of form !!c3ex2 definition --
----------------------------------------------------------------------------------------------------
-- (c) Copyright 2011 to Current Year AVEVA Solutions Limited --
----------------------------------------------------------------------------------------------------
www.aveva.com
© Copyright 1974 to current year. 43
AVEVA Solutions Limited and its subsidiaries.
All rights reserved.
AVEVA Plant (12.1)
Programmable Macro Language: Appied - TM-1403
----------------------------------------------------------------------------------------------------
-- --
-- (c) Copyright 2011 to Current Year AVEVA Solutions Limited --
-- --
-- File: elementCollection.pmlobj --
-- --
-- Description: --
-- An object collect and store PDMS elements --
-- --
-- This object represents a solution to worked example 2 in TM1403 --
-- --
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
-- Object definition --
----------------------------------------------------------------------------------------------------
define object elementcollection
member .elementTypes is ARRAY
member .filter is EXPRESSION
member .scope is DBREF
member .elements is ARRAY
endobject
----------------------------------------------------------------------------------------------------
-- Method .collect() ARRAY - Collect the elements as defined in the object --
----------------------------------------------------------------------------------------------------
define method .collect() is ARRAY
endmethod
----------------------------------------------------------------------------------------------------
-- End of object ELEMENTCOLLECTION definition --
----------------------------------------------------------------------------------------------------
-- (c) Copyright 2011 to Current Year AVEVA Solutions Limited --
----------------------------------------------------------------------------------------------------
www.aveva.com
© Copyright 1974 to current year. 44
AVEVA Solutions Limited and its subsidiaries.
All rights reserved.
AVEVA Plant (12.1)
Programmable Macro Language: Appied - TM-1403
----------------------------------------------------------------------------------------------------
-- --
-- (c) Copyright 2011 to Current Year AVEVA Solutions Limited --
-- --
-- File: formValueStore.pmlobj --
-- --
-- Description: --
-- An object to save and restore values from a PML form --
-- --
-- This object represents a solution to worked example 2 in TM1403 --
-- --
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
-- Object definition --
----------------------------------------------------------------------------------------------------
define object FORMVALUESTORE
member .form is FORM
member .gadgets is ARRAY
member .values is ARRAY
member .file is FILE
endobject
----------------------------------------------------------------------------------------------------
-- Default CONSTRUCTOR method - Not used directly --
----------------------------------------------------------------------------------------------------
define method .formValueStore()
endmethod
----------------------------------------------------------------------------------------------------
-- Overloaded CONSTRUCTOR method - Setup the object with a form and populate the information --
----------------------------------------------------------------------------------------------------
define method .formValueStore(!form is FORM)
-- Populate the object with the information and try to populate the form
!this.loadValues()
endmethod
----------------------------------------------------------------------------------------------------
-- Method .saveValues() - Save the values to the object and the settings file --
----------------------------------------------------------------------------------------------------
define method .saveValues()
endmethod
--(Continue on the next page)
www.aveva.com
© Copyright 1974 to current year. 45
AVEVA Solutions Limited and its subsidiaries.
All rights reserved.
AVEVA Plant (12.1)
Programmable Macro Language: Appied - TM-1403
----------------------------------------------------------------------------------------------------
-- Method .loadValues() - load the values from the settings file to the form and object --
----------------------------------------------------------------------------------------------------
define method .loadValues()
endmethod
----------------------------------------------------------------------------------------------------
-- End of object FORMVALUESTORE definition --
----------------------------------------------------------------------------------------------------
-- (c) Copyright 2011 to Current Year AVEVA Solutions Limited --
----------------------------------------------------------------------------------------------------
www.aveva.com
© Copyright 1974 to current year. 46
AVEVA Solutions Limited and its subsidiaries.
All rights reserved.
AVEVA Plant (12.1)
Programmable Macro Language: Appied - TM-1403
!this.initCall = |!this.checkCriteria()|
!this.types.callback = |!this.checkCriteria()|
!this.filter.callback = |!this.checkCriteria()|
!this.scope.callback = |!this.checkCriteria()|
!this.collect.active = TRUE
!this.message.val = ||
if !this.types.val.eq(||).and(!this.filter.val.eq(||)).and(!this.scope.val.eq(||)) then
!this.collect.active = FALSE
!this.message.val = |Please enter some collection criteria|
return
endif
!errors = ||
do !type values !this.types.val.split()
!elementType = object ELEMENTTYPE(!type)
!owners = !elementType.parentTypes()
if !owners.unset() then
!errors = !errors & | | & !type
endif
enddo
if !errors.length().gt(0) then
!this.collect.active = FALSE
!this.message.val = !errors & | - not valid element types|
return
endif
endmethod
www.aveva.com
© Copyright 1974 to current year. 47
AVEVA Solutions Limited and its subsidiaries.
All rights reserved.
AVEVA Plant (12.1)
Programmable Macro Language: Appied - TM-1403
!this.quitCall = |!this.tidy()|
member .highlighted is ARRAY
!this.highlightElements()
endmethod
!this.tidy()
!name = !element.name
!pos = !element.position
handle ANY
!pos = !element.hpos
handle ANY
!volume = object VOLUME(!element)
!pos = !volume.from.midpoint(!volume.to)
endhandle
endhandle
enddo
endmethod
www.aveva.com
© Copyright 1974 to current year. 48
AVEVA Solutions Limited and its subsidiaries.
All rights reserved.
AVEVA Plant (12.1)
Programmable Macro Language: Appied - TM-1403
exit
----------------------------------------------------------------------------------------------------
-- CONSTRUCTOR Method - Set up the form and gadgets --
----------------------------------------------------------------------------------------------------
define method .elementPreviewer()
!this.axis.val = TRUE
!this.trackce.val = TRUE
!this.message.visible = FALSE
!this.messageIcon.visible = FALSE
!dtext[1] = ||
!dtext[2] = |Clear|
!this.searchBox.dtext = !dtext
endmethod
----------------------------------------------------------------------------------------------------
-- First Shown Method - Register the view gadget and attach the drawlist --
----------------------------------------------------------------------------------------------------
define method .firstShown()
-- Add 3D view to view system
!!gphViews.add(!this.volumeView)
-- Add local drawlist add to 3D view
!!gphDrawlists.attachView(!this.drawlist, !this.volumeView)
endmethod
----------------------------------------------------------------------------------------------------
-- Initialisation Method - Update the drawlist and active the view --
----------------------------------------------------------------------------------------------------
define method .init()
-- Active the volume view
!this.volumeView.active = TRUE
-- Turn on holes drawn
!!gphDrawlists.drawlists[!this.drawlist].holes(TRUE)
!this.setDrawList(!!ce)
endmethod
----------------------------------------------------------------------------------------------------
-- Killing Call Method - Detach the drawlist and then delete it --
----------------------------------------------------------------------------------------------------
define method .close()
!!gphDrawlists.detachView(!this.volumeView)
!!gphDrawlists.deleteDrawlist(!this.drawlist)
endmethod
----------------------------------------------------------------------------------------------------
-- Method .track() - If we are tracking the current element, refresh the drawlist --
----------------------------------------------------------------------------------------------------
define method .track()
if !this.trackCe.val then
!this.setDrawlist(!!ce)
endif
endmethod
----------------------------------------------------------------------------------------------------
-- Method .setDrawlist(DBREF) - Display the supplied element in the View --
----------------------------------------------------------------------------------------------------
define method .setDrawlist(!element is DBREF)
-- Add the required element to the drawlist, and update the title
!drawlist.add(!element)
!this.title.val = |Element: | & !element.flnn
-- Continues p.t.o
www.aveva.com
© Copyright 1974 to current year. 50
AVEVA Solutions Limited and its subsidiaries.
All rights reserved.
AVEVA Plant (12.1)
Programmable Macro Language: Appied - TM-1403
-- Loop through the collected elements and add the connected to the drawlist
do !conn values !collection.results()
!drawlist.add(!conn.attribute(|cref|))
enddo
else
endif
endmethod
----------------------------------------------------------------------------------------------------
-- Method .limitsCE() - Refresh the limits of the view to the stored element --
----------------------------------------------------------------------------------------------------
define method .limitsCE()
-- Refresh the limits of the view to ensure the element can be seen
!!gphViews.limits(!this.volumeView, !this.element)
!this.limits = !this.volumeView.limits
endmethod
----------------------------------------------------------------------------------------------------
-- Method .walkDrawlist() - Walk to the elements in the drawlist --
----------------------------------------------------------------------------------------------------
define method .walkDrawlist()
-- Get the drawlist associated with the view
!drawlist = !!gphDrawlists.drawlist(!this.drawlist)
-- Derive a volume object from the members of the drawlist
!volume = object VOLUME(!drawlist.members())
-- Derive a limits array in the expected format
!limits[1] = !volume.from.east
!limits[2] = !volume.to.east
!limits[3] = !volume.from.north
!limits[4] = !volume.to.north
!limits[5] = !volume.from.up
!limits[6] = !volume.to.up
-- Apply the limits to the volume view
!this.volumeView.limits = !limits
handle ANY
-- Incase the drawlist is empty or has no volume
endhandle
endmethod
----------------------------------------------------------------------------------------------------
-- Method .addConnected() - Update the form based on the add connected toggle --
----------------------------------------------------------------------------------------------------
define method .addConnected()
-- If adding connected, activate the clip toggle (and maybe the slider)
!this.clip.active = !this.addConn.val
!this.slider.active = !this.addConn.val.and(!this.clip.val)
if !gadget.val.eq(1) then
-- If they picked the first one, do nothing (its blank)
elseif !gadget.val.eq(!gadget.dtext.size()) then
-- If they choose the last one, clear the list
!dtext[1] = ||
!dtext[2] = |Clear|
!gadget.dtext = !dtext
!gadget.val = 1
else
-- Otherwise, update the form with the chosen element
!elementName = !gadget.dtext[!gadget.val]
!this.setDrawlist(!elementName.dbref())
!gadget.val = 1
endif
endif
endmethod
----------------------------------------------------------------------------------------------------
-- Method .setUpClipBox() - Update the size of the clip box based on the stored element --
----------------------------------------------------------------------------------------------------
define method .setUpClipBox()
www.aveva.com
© Copyright 1974 to current year. 52
AVEVA Solutions Limited and its subsidiaries.
All rights reserved.
AVEVA Plant (12.1)
Programmable Macro Language: Appied - TM-1403
!this.clipbox.active = FALSE
!this.clipbox.set()
!this.clipbox.active = TRUE
!this.volumeView.clipping = TRUE
!this.slide()
endmethod
----------------------------------------------------------------------------------------------------
-- Method .clipBox() - Active and refresh the clip box slider --
----------------------------------------------------------------------------------------------------
define method .clipBox()
!this.slider.active = !this.clip.val
if !this.clip.val then
!this.setUpClipBox()
else
!this.clipbox.active = FALSE
!this.volumeView.clipping = FALSE
endif
endmethod
----------------------------------------------------------------------------------------------------
-- Method .setIcons() - Update the icons on the pixmap gadgets --
----------------------------------------------------------------------------------------------------
define method .setIcons()
!this.limitsCe .addPixmap(!!pml.getPathName(|autocepopupicon.png|))
!this.walkDrawlist.addPixmap(!!pml.getPathName(|ng_zoomtodrawlist.png|))
!this.axis .addPixmap(!!pml.getPathName(|worldaxes16.png|))
!this.searchIcon .addPixmap(!!pml.getPathName(|id_search.png|))
!this.messageIcon .addPixmap(!!pml.getPathName(|exclamation-16.png|))
endmethod
----------------------------------------------------------------------------------------------------
-- Method .setTooltips() - Update the tooltips on the pixmap buttons --
----------------------------------------------------------------------------------------------------
define method .setTooltips()
!this.limitsCe .setTooltip(|Limits CE|)
!this.walkDrawlist.setTooltip(|Walk to drawlist|)
!this.axis .setTooltip(|Toggle axis on/off|)
endmethod
----------------------------------------------------------------------------------------------------
-- Method .setCallbacks() - Update the callbacks on the relevant gadgets --
----------------------------------------------------------------------------------------------------
define method .setCallbacks()
!this.limitsCe.callback = |!this.limitsCE()|
!this.walkDrawlist.callback = |!this.walkDrawlist()|
!this.axis.callback = |!this.volumeView.showAxes = !this.axis.val|
!this.trackCe.callback = |!this.track()|
!this.addConn.callback = |!this.addConnected()|
!this.clip.callback = |!this.clipBox()|
!this.slider.callback = |!this.slide()|
!this.searchBox.callback = |!this.search(|
endmethod
----------------------------------------------------------------------------------------------------
-- Method .setUpView() - Define the properties of the view and setup the clip box --
----------------------------------------------------------------------------------------------------
define method .setUpView()
endmethod
----------------------------------------------------------------------------------------------------
-- End of Form definition and methods --
----------------------------------------------------------------------------------------------------
-- (c) Copyright 2011 to Current Year AVEVA Solutions Limited --
----------------------------------------------------------------------------------------------------
www.aveva.com
© Copyright 1974 to current year. 53
AVEVA Solutions Limited and its subsidiaries.
All rights reserved.
Appendix B
This form will display the available colours within the PDMS session.
Dynamically built, it will always be correct for the current session.
www.aveva.com
54
© Copyright 1974 to current year.
AVEVA Solutions Limited and its subsidiaries.
All rights reserved.
AVEVA Plant (12.1)
Programmable Macro Language: Appied - TM-1403
This form will search the chosen PMLLIB search path for .png image
files and display them in the grid control gadget. A preview of the
image will be displayed and it will be possible to gain a larger preview
from the context menu
As the PMLLIB search paths could be large and contain many images,
it is possible to only search specific sub folders. Standard grid control
functionality is also available to help filter the search results.
The purpose of the form is to visualise all the images available in the
PMLLIB search path. As the images are within the search path, these
images are therefore available for use in any customisation.
Depending on the size of teh pml.index file, this form can take a
while to collect and display all the information.
This form will provide quick access to all the training examples supplied
as part of this course. Split into types, each example can be shown
inside PDMS or opened in the default Windows Program.
The form builds itself based on the contents of a .xls file saved within
the same folder as the form definition.
As you attend further courses, more of the options across the top will be
available.
www.aveva.com
© Copyright 1974 to current year. 55
AVEVA Solutions Limited and its subsidiaries.
All rights reserved.