You are on page 1of 50
AVEVA Plant (12 Series) PML Upgrade LA 2 2 oO © = < 2 - AVEVA Plant (12 Series) Customisation Upgrade AVEVA Plant (12 Series) Customisation Upgrade Revision Log 18.02.09| 0 __| Approved for training 12.0.SP3 JS. st Updates All headings containing updated or new material will be highlighted. Suggestion / Problems If you have a suggestion about this manual or the system to which it refers please report it to the, AVEVA Group Solutions Centre at asc@aveva.com 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. Visit our website at http://www.aveva.com Disclaimer Information of a technical nature, and particulars of the product and its use, is given by AVEVA Solutions Ltd and its subsidiaries without warranty. AVEVA Solutions Ltd. and its subsidiaries disclaim any and all warranties and conditions, expressed or implied, to the fullest extent permitted bylaw. Neither the author nor AVEVA Solutions Ltd or any of its subsidiaries shall be liable to any person or entity for any actions, claims, loss or damage arising from the use or possession of any information, particulars or errors in this publication, or any incorrect use of the product, whatsoever. Trademarks AVEVA and Tribon are registered trademarks of AVEVA Solutions Ltd or its subsidiaries. Unauthorised use of the AVEVA or Tribon trademarks is strictly forbidden. AVEVA product names are trademarks or registered trademarks of AVEVA Solutions Ltd 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, its name or logo belongs to its respective owner. AVEVA Plant (12 Series) Customisation Upgrade 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 AVEVA Solutions Ltd. or its subsidiaries. Al other rights are reserved to AVEVA Solutions Ltd 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 Disclaimer and Copyright notice 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 Ltd. The user may also not reverse engineer, decompile, copy or adapt the associated software. Neither the whole nor part of the product 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 or save as permitted by law. Any such unauthorised action is strictly prohibited and may give rise to civil liabilities and criminal prosecution The AVEVA products described in this guide are to be installed and operated strictly in accordance with the terms and conditions of the respective licence agreements, and in accordance with the relevant User Documentation. Unauthorised or unlicensed use of the product is strictly prohibited. Printed by AVEVA Solutions on 19 February 2009 © AVEVA Solutions and its subsidiaries 2001 - 2007 AVEVA Soll ns Ltd, High Cross, Madingley Road, Cambridge, CB3 OHB, United Kingdom, Contents 1 Introduction.. 44 Aim. 12 Objectives 4.3. Prerequisites 44 Course Structure 4.5 Using this guide 2 Updates to PM 24 Overview 2.2 New modification of the PMLLIB search path.. Exercise 1 — Update PMLLIB ..ns 3 PML form gadgets. 3.4 New PML form gadgets 3.1.1 ComboBox. 342 Line... 3.4.3 Numeric input . 3.1.4 Container... aos 3.2 Changes to existing PML form gadgets 3.21 — Button... 322 — List. 3.2.3 Option. 3.24 Form.. 3.3 Other Exercise 2 - Using the new PML gadgets... 4 PML Objects 44 NewiRevised Objects and Methods 42 FMSYS object.. Exercise 3 — Progress and Interrupt Methods. 43 Global Drawlist object. Exercise 4 Individual Drawlists.. 5 PML.NET 5. Import an Assembly into PDMS. S44 Syntax... Exercise 5 - Create a File browser Object. 5.2. Creating a PML form containing the NET Control... Exercise 6 - Explorer Control on PML Form... 5.3 Grid Control... AVEVA Plant (12 Series) Customisation Upgrade 5.3.1 Applying Data to the Grid 532 Events and Callbacks. Exercise 7 - A Grid Control on a PML Form.. Exercise 8 (a) ~ Nozzle Checker... Exercise 8 (b) - Nozzle Checker and Equipment Viewer.. 6 Menu Customi Exercise 9 - Create a new CommandBar... ‘Appendix A - Grid Control API. Appendix B - Example Code.. Appendix B1 - Example code for Exercise 2 Appendix B2 - Example code for Exercise 3 ‘Appendix B3 - Example code for Exercise 4 Appendix B4 - Example code for Exercise 6 vnsmm Appendix BS - Example code for Exercise 7 Appendix B6 - Example code for Exercise 8(a).. Appendix B7 - Example code for Exercise 8(b).. CHAPTER 1 [tert During the following training course, the Trainees will be given basic instruction and practice into the new PML features of the AVEVA Plant (12 Series). The training will be split into 3 parts (1) new gadgets/objects/methods (2) PML.NET and (3) the XML Menu system, PML.NET is new to AVEVA Plant it gives the ability of customisation using other .NET programming languages such as C# or Visual Basic. 14 Aim To provide a basic understanding into the new features available now available to PML, the course will be limited to PML and all references to other software for example Cit .net or Visual Basic .net are purely for completeness and are not covered by this course. 1.2 _ Objectives ‘+ Explore new features (gadgets/objects/methods) available to PML. © Create and use a PML Form that has a .net control. ‘* Customise the XML Menu System 1.3 _ Prerequisites All Trainees must be familiar with PML and should have attended the PML Customisation Training. They should also be familiar with MS Windows. 1.4 Course Structure Training will consist of oral and visual presentations, demonstrations and set exercises. Each workstation will have a training project, populated with model objects. These will be used by the trainees to practice their methods, and complete the set exercises. 1.5 __Using this guide Certain text styles are used to indicate special situations throughout this document, here is a summary: Menu pull downs and button press actions are indicated by bold dark turquoise text. Items of interest written in a block of text will be emphasised by bold black text Information the user has to key-in will be red and bold. ‘Annotation for trainees benefit: ® Additional information (2) Refer to other documentation ‘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, colours and styles used as before. AVEVA Plant (12 Series) Customisation Upgrade CHAPTER 2 2.4 Overview PML is PDMS' programmable macro language which provides the opportunity for customisation of the product. New customised forms, objects or functions can be defined and used within PDMS. The standard PMLLIB environment variable is still used to point to PML 2 files. The files can be organised to user requirements, but standard product stil follows the three folder system: pmilib functions forms objects xxx.pmifne Xxx. pmifrm Xxx, pmlobj 22 New modification of the PMLLIB search path ‘The PMLLIB searchpath is defined by: Set PMLLIB \AVEVA\plant\PDMS12.0\pm11ib It is normal practice to setup a parallel hierarchy to contain any new/modified PML. This is done by including another searchpath before the standard. New to 12, search paths can contain spaces (providing the search paths are separated by a‘ temp\PML Files\pm11ib;C:\AVEVA\plant\PDMS12.0\pm11ib; PML REHASH is still used to update the PML index file (Pi REHASH ALL to refresh from all search paths). Forms and objects are still shown, loaded and reloaded as before. Boone oka) 1 © Copy the provided files into the appropriate folder. For example, C:\temp\, + Update the PMLLIB environment variable in the .bat fle to point at this folder * Load PDMS and enter the Design module * Confirm that the PMLLIB search path is correct by typing q evar pmllib into the ‘command window AVEVA Plant (12 Series) Customisation Upgrade CHAPTER 3 3.4___New PML form gadgets ‘There are some new gadgets that are available for use with AVEVA Plant (12 series) For further information on these gadgets and the associated methods, please refer to the Software Customisation Reference Manual. 3.1.1 ComboBox ‘A combo box is a combination of an option gadget and an editable text display. When the drop-down list is closed, the user can search for the required value by typing in the first couple of letters and then clicking the down arrow. The list will then open on the first matching option. This is very useful for large lists ‘A combo box does not support pixmaps, but does support text entry scroll width and open callbacks. If an open callback is defined, the validate event from the text entry can be identified and the .displayText() method can be used to read the users entered text. 3.4.2 Line The line gadget is a cosmetic gadget that can be used to divide up a form. It can be defined as horizontal or vertical with a style that reflects the current Windows colour scheme. The of the line defines the space the gadget occupies on the form, not how thick the line is. The line will always be the same thickness. 3.4.3 _Numeric input ‘A numeric input allows numerical input within a specified range with a given granularity. Users can either type in the number they require (this will be rounded = © to the nearest in the range) or use the Up/Down arrow controls to change the value by the increment. ‘The range and decimal places on the values are specified a t gadget definition. The range can be set after definition, while the decimal places cannot. ‘An open callback can be used to identify modified events (use of the Up/Down arrows), provided that the modifiedEvents member is set. 3.1.4 Container ‘A container gadget allows the hosting of external controls (e.g. PML.NET) within a PML defined form. It allows raised events to be passed to PML and shows the popup menu is popup event is raised by the .Net control. Container gadgets are not included within the New Gadget Example and will be in the PML .Net example. "1 ‘AVEVA Plant (12 Series) Customisation Upgrade 3.2__Changes to existing PML form gadgets ‘There have been some changes to existing gadgets to extend their functionality 3.2.4_Button A button can still be defined as a standard or toggle, but now it can also be defined as a linklabel. After specifying the gadget name, if the keyword LINKLABEL is used, the button will be displayed as if it was hyperlink. Show Gadgets 3.2.2 List Lists no longer need to be declared as a multicolumn list, columns are now implied by the applied data or headings. Zeroselection implies a single choice list and deletion of fields is now supported. 3.2.3 Option Zeroselection and popup menus are now supported 3.2.4 Form There are now callbacks for firstshown (the method will only run when the form is first shown) and kill events (when a form is unloaded or ‘killed") A form will provide scoll bars if it becomes too small to display the gadgets (Autoscrolling) The new .setOpacity() can make the form appear transparent. This can be useful to divert attention when a sub form is shown. 3.3__ Other There are also a number of other changes: + RGroup elements are no longer supported — use Rtoggle * ID @ syntax is be deprecated — use EDG Alpha view command channel is now within the window (now a command window rather than a command line) © IHfilebrowser is now a PML .Net form ~ although it can still be called from the !filebrowser function 12 AVEVA Plant (12 Series) Customisation Upgrade You have been provided with a file that displays some of the new gadgets and their functionality. Type the following into the command window: show |! InewGadgetExample Unfortunately the file which has been provided contains 10 syntax and functionality errors. Using the new Software Customisation Reference Guide, review the file and fix the errors. Check the functionality against the below description. ‘An example of fixed code is provided in Appendix B. 2 @ (47.15) CP: Syntax eo. Cea 3 4 counter & {6} stow Gadgets canter) Show Guts The first gadget is a new Combobox. It contains a list of colours. When a colour is choosen, the pixmap on the paragraph gadget changes. ‘The Combobox has an open Callback ‘on it, allowing the Validate event to be identified. When the user presses Return, the text the user enters is compared against the list and first match is selected. The numeric input has a range of 0 ~ 10. (steps of 1) If the value goes above 5, the link label button becomes active. The user can type in a value or use the upidown arrows. An open Callback has been used to capture the modified event (caused by using the arrows). 13 AVEVA Plant (12 Series) Customisation Upgrade ‘The Show Gadgets linklabel makes the foldup panel visible. Once visible, the panel can be folded up by either clicking the Foldup the Frame link label or by clicking on the arrow in the top right of the frame. 14 CHAPTER 4 mere 4.1__NewlRevised Objects and Methods Two examples of new objects which are available in 12 are an ElementType object and an Attribute object. These objects can be used to query directly properties of the items they represent IAver4bXLEN = object attribute ('XLEN') ITypeEQUI = object elementtype(*EQUI') q var !AttribxbEN q var |TypeEQUr To find out what methods are available on these objects (and others), there is a new global method called .methods(). This method retums an array of strings which list the available methods on the objects. There are no descriptions of the methods provided, but the names and arguments should initial information. The best way to find out it to test them var JAttribXLEN.methods () var ITypeEQUI.methods () var IAttribXLEN. ispseudo() var | TypeEQUI.menbertypes () aaa 4.2 FMSYS object The FMSYS object (Forms and Menus System object) was available previously, but has been ‘extended for 12. It provides methods which are not specific to standard objects and are intended to perform system-orientated tasks. The definition of the object is stored as the global variable MFMSYS. q var IIFMSYS FMSYS The method .FMinfo() returns information about all the current forms and menus. The return is a array displaying the Module's name, Module’s version, Appware version, unused, Help file alias, unused, Help about callback. q var !!PNSYS.FMinfo() [0] 'AVEVA PDMS Design’ [1] ‘unset? [2] 12.0.0" [3] ‘unset! [4] 'PDUv' [5] ‘unset’ [6] ‘$m "%PDMSUI%/MON/ADMIN/HELPABOUT"* If a callback is takes a long time to execute, then the IIFMSYS object can be used to provide progress feedback by displaying a progress bar in the bottom right of the screen. Type out the following into the command window: 15 AVEVA Plant (12 Series) Customisation Upgrade ! LEMSYS. setProgress (25) | LEMSYS. setProgress (50) as I LEMSYS.setProgress (75) LIFMSYS. setProgress (0) You will see that as the method is passed different values, the progress bar changes. This means that user-defined methods can use this method to display progress. If the method is passed an argument of 0, then the progress bar is not displayed. The !IFMSYS object can inform users of what forms are loaded within PDMS and which forms are currently shown. q var 1 1FMSYS. forms () q var !!FMSYS.shownForms () The !IFMSYS object can be used to interrupt a process while a callback is being executed. This ‘can be used to cancel can process which is not required or break out of a perpetual loop. At the start of the method, the gadget that will interrupt the process has to be declared using the .Setinterrupt(gadget) method. During the callback, a check can be made against .Interrupt(). If ‘a boolean True is returned, it means the gadget has been pressed and the code should stop. 16 AVEVA Plant (12 Series) Customisation Upgrade Exercise 3 — Progr 1 and Interrupt Methods Type the following on the PDMS Command line: show 11FMinterruptExample Press the GO button. Notice how the value in the numeric input increases and how the pixmap on the button has changed. As the counter increases, so does the progress bar on the bottom right of the soreen. If you let the counter reach 10000, the picture will return to GO If you press the STOP button, the method will be interrupted and a popup message will return progress information. After this the form will reset. Review the Example code (to be found within the provided files) Have a look how the .setinterrupt() and .interrupt() methods are used Notice the .addPixmap() method can be used after a gadget has been defined Try altering the range of the numeric gadget. Does the method need to be updated? 7 AVEVA Plant (12 Series) Customisation Upgrade 4.3 Global Drawlist object In Aveva Plant (12 series) it is possible to have multiple drawlists. The advantage of this is that different volume view gadgets can display different elements. Drawlists are now managed by a global object lgphDrawlists. Type the following into the command window: q var !!gphDrawlists GPHDRAWLISTS DRAWLISTS 1 Elements q var | !gphDrawlists.drawlists [1] DRAWLIST @ var !lgphDrawlists.methods () The following are some examples of the methods which are available on !!gphDrawiists: To find out information about all the drawli in the global object, use: Hgphoravlists.1istallO. To create a drawiist in the global object, use: !gphbrawlists.createDrawlist() To associate a drawiist from the global object with a view, use: !!gphprawlists.attachview(DRAWLIST, GADGET) Drawiists can only be attached to a view that has been registered with the !lgphViews object. There are also other methods associated with this object which help with displaying information correctly. Type the following into the command window then query the available methods: q var I lgphViews GPHVIEWS ACTIVEVIEW Unset SELECTEDVIEWS 0 Elements VIEWS 1 Elements To add a view to the global object, use: !1gphviews .add (GADGET) To set the limits of a view based on a DBREF object, use: !gphviews.1imits (GADGET, DBREF) 18 \aphranfts IO | rena | bl rae ow WGPRRDDESTON EW AVEVA Plant (12 Series) Customisation Upgrade * Type the following into the POMS Command Window: 1 igphDrawlists.1istall() ‘* Notice how there is only one drawlist object currently defined. How many view elements are defined in the IgphViews object? ‘© Type the following into the PDMS Command Window: show | !volumeViewExample ‘* On showing the form, the drawlist is set to the current element. Check the following after showing the form: !igphDrawlists.1istall() q var !!gphViews * The contents of the view can be updated to the current element b either pressing the Update Drawiist button or by using the popup menu in the volume view. Change the ‘contents of the view and type: !igphDrawlists.1istall() ‘+ The Drawlist objects have their own methods which can apply specific settings to the view gadgets. Investgate the available methods in the command window. * Add an extra line to the form definition so that the graphics show the holes turned on. * Think about which of the available methods are the most suitable and when to use it. 19 AVEVA Plant (12 Series) Customisation Upgrade The form defines the drawlist during its constructor method (when the form is loaded) The form associates the view with !gphViews and attaches the drawlist to the view during the firstShownCall (this method is only called once, when the form is first shown, As the drawlist is created during the constructor method, if the form is reloaded additional unwanted drawiists will be created. To avoid this, the drawlist is removed duing the forms KillingCall (this method is called if the form is unloaded). Type Kill !tvolumeViewxample and confirm that only one Drawilist object remains 20 CHAPTER 5 Eas Using AVEVA Plant 12, it is now possible to customise the product using .NET through NET controls and objects. PML .NET allows you to instantiate and invoke methods on .NET objects from PML proxy objects. PML proxy class definitions are created from .NET class definitions at run time. These proxy classes present the same methods as the .NET class which are described using custom attributes. The PML proxy objects behave just like any other PML object. PML callable assemblies are loaded by PDMS using the IMPORT syntax. Assemblies may be defined in potentially any .NET language (for example managed C++, Ci or VB.NET). The PML.Net Engine loads a given assembly and once loaded instances of PMLNetCallable clas: may be created, No additional code to interface between PML and .NET is necessary. This is provided by the PMLNetEngine. Pos ‘Customization ome [naw : It is possible to add container objects to a conventional PML form creating @ hybrid of PML & .NET. The container is treated as a normal form gadget (i.e syntax graph) but can be filled with a -NET object 5.1__ Import an Assembly into PDMS Before a NET control can be used in a form, it first has to be importe .dll fle has to be loaded and the namespace specified. For example: into PDMS. The required import ‘Gridcontrol" using namespace ‘Aveva.Pdms.Presentation’ @ Trying to import a dll file which has already loaded or cannot be found will result in an error. Error handling should be considered to prevent the error messages being displayed to users. 2 AVEVA Plant (12 Series) Customisation Upgrade 5.11 Syntax To define your first NET object, type out the following into the Command Window: import 'Gridcontrol! using namespace 'Aveva.Pdms.Presentation' InetObj = object NETGRIDCONTROL () q var Inetobj @ var InetObj.methods () ® Notice the .methods() method. This is a new global method available on all objects. It returns all of the methods Etech iene ces 4 On the command line create a import 'PMLFileBrowser' "i using namespace ‘Aveva.Pdms.Presentation' Led Rasta! object. ‘The options Ibrowser = object PMLFileBrowser ('OPEN') are: Open or Save. (if no argument is given then it will default to “Open”) 2 Query the object and the De ieeiiresnees reece) methods on the PMLFileBrowser q var !browser.file() instance 3 browser. show('C:\', 'abe.doc', "Example eno te) ley eed Browser', true, ‘Word Documents |*.doc',1) war directory (string) var Ibrowser. file @ var Ibrowser.£ile() seed (String) - file which is shown by default title (string) —title of form exists (Boolean) — check if specified file exists filter (string) - type of files to open. A description, followed by “{’ and then the file types — for example: Word Documents|*.00C Text files Ce. txt)|*.txtlall files CTR Index (integer) - for multiple strings, the index of the filter currently selected AVEVA Plant (12 Series) Customisation Upgrade 5.2__ Creating a PML form containing the .NET Control Once the .dll file has been loaded and the namespace specified the object is available for use. For example a user may specify a CONTAINER within a form definition to hold the .NET control and a form member to define it: container .netFrame PMLNETCONTROL ‘NET’ dock fi11 member .netControl is NETGRIDCONTROL, After this, the constructor method would define the .NET object and apply it to the container gadget using namespace_'Aveva.Pdms.Presentation' |this.netcontrol = object NETGRIDCONTROLO) IthisinetFrame.control = !this.netcontrol.handle() ‘The user is now able to specify event methods to control the .NET gadget: Ithis.netcontrol.addeventhandler(*onPopup", !this, 'rightclickexplorer') This example allows the forms .rightClickExplorer() method to be run when the .NET object is right clicked. PML Frame SIE SANBLEADIAN SITE STABLZER PML Container for 4 @ Site Soa Teopie NET Comma | fm APPLOW Samoe_Pp_ Assembles ‘Tew quent Appleain-Tenltos ¢ (G] Tew sto auPMeNT-TEMPLATES p(B Tei ove QUPMENT-TEMPLATES, | fas ASSOW Equant Assocation |ASSOWL He Nanipenent_ Js ‘ASSOWL AVASSOCATIONS .NET Control ‘SYGPHL PROCESS, SYSTEMS k ASOPWL HMLASSDE ASOPHL AVEVA Sts Aoseiaon Deters [APPLDW CABLEIVANTIAPPLOW 23 AVEVA Plant (12 Series) Customisation Upgrade Pane nk Sas ‘TPUML Defaut_TPWL © @ SITE SAMPLE-ADMIN eq SITE STABLZER [2] TPWL Ast Tenplete_Workd & [B] TPWL Wotearoors_Terpete World | (B) TPWL Penetration Temelte_Workt & [B] TPWL Concrete. Template, Work! \GN-SAMPLE-TEMPLATE 8. SITE Stee Terpste_ste & Ba APPLOW Sarpe_Ppe_Assombles & [G) TPW Eaapmert-tppliation-Templates | [B TPw STOPEQUIPMENT-TEMPLATES ¢ [@) TPwt ADvEQUIPNENT-TEMPLATES & fa ASSOME Ensen Joss (Ea, ASSOWL Hole_Managemert_Associstons ZONE PIPES. ‘TPWL Deteut_TPw SITE SAMPLE-ADMIN ® ® & ‘TPWL Asi Te ‘Type the following on the PDMS Command line: show | InetExplorerExample You will see a form which uses a container gadget to display a .NET explorer control The example code for this form can be found in Appendix A. Type the name of an existing database item in the text entry field and press retum. The item is selected in the tree. Remember that PDMS names begin with ar Note: The PML gadgets are invoking methods on the C# control. If you press the button, the current element will be highlighted in the explorer. ‘A popup menu has been programmed on the explorer control. The current method prints the name of the element to the command window. define method .popup() q var Ithis.element .name endmethod Extend this method to increase the functionality of the form. For example set the current element, show attributes, provide member information 24 AVEVA Plant (12 Series) Customisation Upgrade 5.3 Grid Control Another example of an available NET object is the Grid Control gadget. Despite appearing similar to a LIST gadget, the Grid Control gadget has a large number of methods available to it allowing it to behave more like a spreadsheet. Some of the advantages are as follows: ‘* Data in the grid can be selected, sorted and filtered. * Dal the grid can be exported toli ported from a Microsoft Excel file ‘* Grid contents can be previewed and printed directly ‘* The colour of rows, columns or cells can be set (including icons) + The values of entire rows/columns can be extracted/set © The contents of the grid can be filled based on DB elements and their attributes. 5.3.1_Applying Data to the Grid Data is applied to a Grid Control gadget through the use of a NETDATASOURCE object. While defining this object, the required data is collected and formatted for the grid. The data is applied to the grid by using its .BindToDataSource() method. For example: var !coll collect all EQUI Jattribs = |NAME TYPE OWNER AREA| Idata = object Netbatasource( ‘example Grid, lattribs.splitO, !col1) Ithis.exampleGrid.BindToDataSource(!data) CD inthis example, the NetDataSource abject is collecting information from the database. There are other ‘methods availabl. Refer to the .NET Cutomisaton User Guide, available within the 12.0 manual 5.3.2 Events and Callbacks The following events are available on the grid: © OnPopup(Array) © Array(0]is the x coordinate of the current cursor position ‘© Array(t]is the y coordinate of the current cursor position © Array(2] contains the ID of each of the selected rows ‘© BeforeCellUpdate(Array) Array(0]is the new value the user typed in ‘Array{t] Is the Row Tag of the cell Array(2]is the Column key of the cell Array{3] is @ Boolean. If you set it to “false” then the new value will NOT be allowed + AfterSelectChange(Array) ‘© The array contains the ID of each of the selected rows © AfterCellUpdate © Noarguments are passed. There are a number of AP! calls available. Refer to Appendix A or the NET Cutomisaton User Guide, available within the 12.0 manuals e000 25 AVEVA Plant (12 Series) Customisation Upgrade Cato aad [ema — rr |remrooza [gh Recent [eau [ieceaue fe fePeconn2 [aur |revec-eaur fe [arooes Pie [PES lo [a roosa PPe_[ PES lo areas Pe [PES lo [amas Pe_| PES le amore iPe_| PES fz lamer iPe_| PIPES Fane: a0) janeo Pe [PES pea i = oe Tl tens = 1 Type the following on the PDMS Command line: Show !1GridControlExample Note that the grid has been populated with a set of attributes (the headings), and a set of model items (Equipment and Pipes in this example). The grid control populates itself with the attribute data. & Type : PIPE (42 ems) Grid Behaviour: * Drag and drop the "TYPE" heading into the grouping area (see picture) Drag and Drop selected items into the 3D view (or “My Data") Investigate the filters on each column Investigate the “Summary” feature (the “summation” symbol ‘on the Area attribute column). Pop-up Menu: * Make a selection and open the pop-up menu. The menu doesn't do anything yet! + You need to edit the PML form to enable the Popup menu to run a callback function, @ The code you need is commented out in GridControlExample. pmitrm 26 AVEVA Plant (12 Series) Customisation Upgrade Save Data to an Excel file: © Add @ popup menu to save the gtid data to an Excel spreadsheet. © Make use of the File Browser object to enable the user to specify the Excel file on the file system. @ The code you need is commented out in GridControlExample.pmifrm: 5 Import Data from an Excel file: © Add a popup menu to import data from an excel spreadsheet into the grid. * Note that the imported data will replace the data which is already there (not append to it) and the data is completely defined by the spreadsheet. © The first row in the Excel file will represent the column headings. ee Sa tian = The other rows will be data, ‘+ Make use of the File Browser object to enable the user to specify which Excel file to use for the import. @ The code you need is commented out in GridControléxample.pmifrm 6 Event: afterSelectChange * Add an “afterSelectChange” event ‘* Add a method to print out the name of the new selection whenever you change the selection in the grid. ® Some of the code you need is commented out in GridControlExample.pmlfrm 7 Grid Control API: © Try out some of the other events and methods available on the Grid Control. 2 For details of the methads available on a grid contro! gadget, refer to Appendix A or the .NET Cutomisaton User Guide, available within the 12.0 manual. 27 AVEVA Plant (12 Series) Customisation Upgrade Bmoeee Create a new form which will provide users with nozzle information about a chosen piece of equipment. Provide a NET explorer which displays the ZONE /EQUIP and below from the example Stabilizer plant. Provide a .NET Grid Control gadget. This gadget will display the names of the nozzles owned by the chosen, as well as their size and connection information. The contents of the Grid should refresh every time a piece of equipment is chosen. When displaying the connections of the NOZZ elements, make it more obvious to the user which ‘ones are connected. This could be done by changing colours, display text or displaying icons. CD) Refer to the INET customisation Guide for suitable methods. (AlEquipment Viewer Joes] © @ ZONEEQUP @P EQUI E1301 ef EQUIDIO @@P Eauictior & @P EQUIENSO28 gp EauiEss028 6 @P EQUIPISOIA EQuipreo18. GP EQUIPIS02 & @P EQUIPI6028 @ @P EQUI VENTILATION. UNITY Nozzle |Size| _Comection 0 1201-Ns | 40. |e Check i i20i-ne [0 | Creat po 701201-NE [65 | Checkt ya 701201-N7 [85 | Check ya 101201-wi | 460 | Chest fa Oracr-Ni [60 | 10-67-51 a 1201-N2 [60 |p RO-B46-BT RIAL) al ORAS, ney ‘Total tems = 8 28 AVEVA Plant (12 Series) Customisation Upgrade Bronce een unre ‘Add a volume view gadget to the form created in Exercise 8(a) Give the volume view its own drawlist. Consider the management of this drawlist (when should it be created, modified, removed) There are many methods available on a drawlist object. Increase the functionality of the form by allowing users to see the results of the connection check within the view. (Equipment Viewer ZONE EQUIP 1 @f EQUI EQuIDIZ01 @ eQuictton @ GP EQUEO“ GP EQUIEISO28 EQUIPISOIA, & @ Equi Pteote GP equPisi7n » @P EQUIEIEI2E) @P EQUIVENTLATION uni ToT 1 ___] }) Nozzle | Sze connection a is02e-Nt | 100 |i 60-47-62 hyo Pis0ze-Na [RO | Aoo-eA-8S a 7P¥6028-N3 [60 | check M) PV6026-Na | 160 |e cheat Toa tens 24 29 AVEVA Plant (12 Series) Customisation Upgrade CHAPTER 6 In addition to using Addins to create user-defined menus and toolbars, it is now possible to create an XML based toolbar These toolbars are created within PDMS and are saved to XML files. The toolbars can be shared across the module, project or made specific for a user. Sto eon crn ikcmnnn ses 1 era marnUTGEWE"eNN® Open the Customisation Form. Do this by right clicking on an empty part of the toolbar and choose Customize... * On the Active Customization File, choose User. * This will save an changes to a specific user file (file path given on the right hand side of the form) ‘* Right click on the Command Bars heading in bottom window, and click on New CommandBar 31 © Conmand Bat 88 Shanti Mol Vawer AVEVA Plant (12 Series) Customisation Upgrade You will now see a preview of the command bar in the top left of the form (when the new CommandBar is selected) Right click in the middle window in the form Create a new button object in the tools window With the new button selected, look Teatt eee to the right window on the form Sy Select the line titled Comm: leon Notngeoteuce i secied s wand andl Be canaacisiasme lick the small *..." button which Nare “Tost appears on the right. This will let us Stat ine set the command. Toate SSE A command can be a core ee) ~] command or a PML command. Carma type Choose Macro, and type show NexBa. Close the form by pressing OK. Cepion Testi ] Cateooy Macro: show HexBa Go lean [ Nolmagecrresouce id specie (B MeruToaUpdateOpins None Name Test Shateut None Tootip The associated command _ is nowdisplayed in the properties window 32 AVEVA Plant (12 Series) Customisation Upgrade ‘* Select the line titled Icon, Click the *...” button that appears to the right. * Browse for the file nozz.png (a supplied file) * Click Open © The icon is now displayed in the right hand window. © Set the tooltip to ‘Show Nozzle [B MenuTookpdateOptons None Checker’ Nase Test Shotcsk Nore Toot Show Nozzle Checker © Select the new button in the middle window. |ias * Drag and Drop the new button s beneath the new CommandBar |Active Customization File User |v] object to make the association. ‘Asve Custonzaion Fle * Select the CommandBar object and © Command Bas notice the button is displayed in the | Ba Schematic Mode! Vener preview. ee Test [Use] [Bi Menubar Context Menus & Resource Files ‘+ Apply and OK the form and the new ‘Command Bar will be displayed in the main application. ‘© Test the button AVEVA Plant (12 Series) Customisation Upgrade Appendix A eeu keno a The following table shows all the current API calls to the grid. These can be used in a PML form or ‘on the PDMS command line. NetDataSource(String TableName, Array Attributes, Array Items) Name ‘Type Purpose f2ae eu Data Source constructor for database Attributes and database items. The Grid will populate itself with database attribute values. NetDataSource(String TableName, Array Attributes, Array AttributeTitles, Array Items) _| tiles can be added. Data Source constructor for database Attributes and database items. The Grid will populate itself with database attribute values. The attribute NetDataSource(String TableName, ‘Array columns, Array of Array of rows) Data Source constructor for column headings, and a set of rows. In this case the grid does NetDataSource(String TableName, Array Attributes, Array Items, String Tooltips) _| attribute values. NOT populate itself — with database attribute values. Data Source constructor for database Attributes and database items. The Grid will populate itself with database NetDataSource(String TableName, Array columns, Array of Array of rows, String Tooltips) Data Source constructor for column headings, and a set of tows. In this case the grid does NOT populate itself with databases attribute values. NetDataSource(String TableName, string PathName) Data Source constructor for import of an Excel XLS or CSV File indToDataSourcet ee ind Grid to NetDataSource getDataSource() NetDataSource Returns the data source that has —_ _| been set in the grid SaveGridToExcel(String) | Save All Data to Excel File. Note that this will retain all grid groupings and layout of data. The String should specify the full pathname, eg: ‘C:tempiiile x's’. 35 AVEVA Plant (12 Series) Customisation Upgrade SaveGridToExcel(String, Worksheet) Save All Data to a Worksheet in an Excel File. Note that this will retain all grid groupings and layout of data, FixedHeaders(Boolean) Allow/disallow fixed headers. (Used when scrolling). FixedRows(Boolean) Allow/disallow fixing of rows. (Used when scrolling). ‘OutlookGroupStyle(Boolean) Allow/disallow Outlook group facility HideGroupByBox(Boolean) setGroupByColumn(colNum, Boolean) ColumnExcel (Boolean) ColumnSummaries(Boolean) Hide the groupBy box....this. will leave the Outlook style grouping in place and hence disallow the _user from changing the grouping ‘Setlunset column in OutlookGroupStyle Allowidisallow Excel style fiter on columns: Allow/disallow Average, Count, | etc... on numeric columns HeaderSort(Boolean) Allow alphabetic column sorting _| Errorlcon(Boolean) Allowidisallow the display of the red icon in the cell if a data value is not available SingleRowSelection(Boolean) Set grid to single row selection _allGridEvents(Boolean) ClearGrid) setAltemateRowColor(String) setAlternateRowColor(Red Num, Green Num, Blue Num) EditableGrid(t (Boolean) ‘Switch Grid Events On or Off Remove data & headings. column Set alternate rows to a different color Set alternate rows to a different Color. The default is: (251, 251, 255) Allowldisallow cells to be editable. Note that if the user is allowed to write data to the grid, then this data does not get written back to the database. The calling code is in control as to whether to either allow or disallow the change. This does not enable the user to add/remove rows, just to edit the content of the existing rows. 36 AVEVA Plant (12 Series) Customisation Upgrade setLabelVisibility(Boolean) ‘Show/Hide label CreateValueList(Name, Array for Create a value list for the grid | List) — — ResetColumnProperties() - Reset column layout SaveLayoutToXmi(String) Save the grid layout (not data) to _ a a file on the file system. loadGridFromxmiString) Load a stored layout on the file system (not data) into a grid instance. PrintPreview() so Opens an Infragistics style Print Preview Form (which allows GetSelectedRows() __| Array of Array (rows) | Returns array of selected rows GetSelectedRowTags() _ Array of row tags Get the selected row tags GetRows() _Array of Array (rows) | Returns array of rows. GetRow(NUM) Array Get the cells in the Row number=NUM GetRow(row tag) Array Get the cells in the Row with the specified row tag -GetRowTag(NUM) String Get the Tag ID of the row setEditableRow(Integer, Boolean) Allow/disallow a designated row | 7 to be editable setRowColor(NUM, String) Set row color to a string (eg aa = ‘red') - ‘setSelectedRowTags(Array rows) Programmatically select the | m - a given rowtags selectRow(NUM) Programmatically select the L oo — row=NUM_ getNumberRows() Real Get the number of rows in the a —_— ord clearRowSelection() __| Clear row selection - addRow(Array data) Add a single row of data. If DB Element grid then only first array data is read. If not, then the Array data represents the data _ ae in each coll of the row, deleteSelectedRows() - Delete selected rows deleteRows(Array data) Delete one or more rows given 37 AVEVA Plant (12 Series) Customisation Upgrade by the “Tags” in the array deleteRows(Array data) Delete one or more rows given by the “Tags” in the array. scroliSelectedRowToView! ae Scroll the selected row into view ‘SetColumnMask(NUM, Set the Mask on column STRING(MASK)) number=NUM. (See valid masks in table below) getColumnMask(NUM) STRING Get the mask on the specified column eee setEditableColumn(Integer, Boolean) Allowidisallow a designated column to be editable GetNumberColumns() _ REAL Return the number of columns AssignValueListToColumn(Name, Column NUM) Assign the value list to a column GetColumns( Array of STRING __| Get the columns in the grid_ GetColumn(NUM) Array Get the cells in the Column number=NUM setColumnColor(NUM, String) Set column color to a string (eg Sereda es setColumnimage(NUM, String) Set all cell images in column to the pathname of the specified icon 7 a setColumnVisibility(colNum, Bool) Show/Hide column getColumnKey(NUM) String Get the Key of the column ‘setNameColumnimage() lays standard icons in a “NAME” attribute column when database items are used. ResizeAliColumns() GetCell(ROW, COL) STRING AutoFitColumns() Resize columns to fit widest text SetColumnWidth(Column NUM, Sey column number to a set Column Width) width ExtendLastColumn(Bool) Extend the last column, or not Resize columns to fit in available ‘width of form Get the content of cell(ROW,COL) by row and column number 38 AVEVA Plant (12 Series) Customisation Upgrade GetCell(row tag, column tag) STRING Get the content of cell(ROW,COL) by row tag and column tag setCellColor(row, col, String) Set cell color to a string (eg ‘red’) setEditableCel(Row NUM, Col Allow/disallow a designated cell NUM, Boolean) a tobe editable setCelllmage(row, col, String) Set cell image to the pathname of the specified icon setCellValue(rowNum, —ColNum, Programmatically set a cell value STRING) toa string AssignValueListToCell(Name, Row Assign the value list to a cell NUM, Column NUM) Input masks can consist of the following characters: ico preecals ca Decimal placeholder. The actual character used is the one specified as the decimal placeholder by the system's international settings. This character is ‘Thousands separator. The actual character used is the one specified as the thousands separator by the system's international settings. This character is treated as a literal for masking purposes. Time separator. The actual character used is the one specified as the time separator by the system's international settings. This character is treated as a literal for masking purposes Date separator. The actual character used is the one specified as the date ‘separator by the system's international settings. This character is treated as a literal for masking purposes. Treat the next character in the mask string as a literal. This allows you to include the '#', '&’, ‘A’, and '?' characters in the mask. This character is treated Character placeholder. Valid values for this placeholder are ANSI characters in the following ranges: 32-126 and 128-255 (keyboard and foreign symbol characters). Convert all the characters that follow to upper oo Convert all the characters that follow to lowercase. 39 AVEVA Plant (12 Series) Customisation Upgrade Character Pree Alphanumeric character placeholder. For example: a-z, A-Z, or 0-9. Character Alphanumeric character placeholder. For example: a-z, A-Z, or 0-9. Character entry is not required. [9 _——_| Digit placeholder. Character must be numeric (0-9) but entry is not required. Optional minus sign to indicate negative numbers. Must appear at the of the mask string. Character or space placeholder. Character entry is not required. This operates exactly like the '&' placeholder, and ensures compatibility with Microsoft Access. Lotter placeholder. For example: a-2 or A-Z. Character entry is not required. Ail other symbols are dsplayed as Iiterals; thats, they appear as themselves. Digit placeholder. A group of n's can be used to create a numeric section Combination of these three special strings can be used to define a date mask, mm for month, dd for day, yy for two digit year and yyy for four digit Combination of these three special strings can be used to define a time mask. hh for hour, mm for minute, ss for second, and tt for AP/PM. Examples: bh:mm, hh:mm tt, hh:mm:ss. Appendix B eee Appendix B1 - Example code for Exercise 2 This example code has already be fixed. The 10 fixes have been highlighted: setup form Lineycadoetexanple = Error 4: Syntax order error i5-Formti tte = [New Gadgets example conbo'-conbo | colours! wid Error 2: Incorrect step ara” “eoTourbock pixmap wid 16 het 16 ine ‘Vinel. at xnin.combo.ymax.conbo horiz wid-97 hei 0.5 numeric “num: Tcounterl at xminel inet ynax range 0 10 step iyhdp 0 val 0 wid 3 Button” “bue1 inklabet: [show acetal ‘at xmaxsnun + 0-8. yninfum rane” | “foldup'Fotdup |roldup Franel at xin. fun yeax-rum 6-5 wid 27 Button’ cbute Tinklabel’|roldup the Frame] dock exit exit define etiod nwcadptsnanpleo ea Error 3: Open Callback lefine method .newcadget e Ithisvconbo.caltback = |1this.combocheck()| Error 4: Unwanted character Ithis-nun. callback = |!this.nunbercheck(} Ithis-buti. cal Tback his. showGadgets() | os 6 leat lees De Wthis:but2-caTIback = |ithis.foldrrane(| ldtext, =" [Red yellow green cyan wlue Purple Pinkl is-conbo.dtext = Idtext.splitO his coloursleck.addPixnapc tpn! .getpathNane('2.png" his num.nodifiedevents = TRUE his-buti.active = FALSE —____ ithistbut2.visible = FALSE Ithis.foldup.visible = FALSE cendnethod Error 6: Needs to be TRUE 1e method .conbocheck(!gad is gadget, !event is STRING) svent.eq(' VALIDATE"), then << jusertnput = this, conbo-displayréxtO Error 7: Spelling mistake fo In index !this.conbo.dtext chee | kgeriapue’ iengehO Error 8: Incorrect argument value IfestString’= Ithis.conbo.dtext tn] .upcase() .substriAg(1, !Nochar) 4 Filuseranput.upease(feeststring) ea0). then this.combo.va ithis:colourelock.addPxnap(! !PML.getPathNane Ct this.conbo.val & |.png1) break endif enddo Error 9: Incorrect gadget elgeif tevent ca('seLect') then iehis.coloursteck-addPixmap(! Pm.getPathwane(!this.conbo.val & | pngl)) endif endinethod define method, .nunbercheck(lgad is gadget, levent 1s STRING) Ithis.num.val.gt(s) then T [Enisibueivactive © Toe else Tthis.buti.active = FALSE Ithis.foldup.visible = FALSE endif endmethod define method , shoucadgets() Ithis.but2.visible = TRUE Lthis.foldup.visible = TRUE endnethod define method .foldrrameO | “ror 10: Neads tobe FALSE xhissfoldup. expanded = FALSE endnethor a AVEVA Plant (12 Series) Customisation Upgrade Appendix B2 - Example code for Exercise 3 setup form !fmtnterruptexample dialog NoAlign, button -bl at xin ymax call. |!this. counter | 4 Bizmap wid 100 hej 100 numeric’ .num at xmax'- size ynax + 0.1 range 0 10000 step 1 ndp 0 val 0 wid 4 exit define method, .fnanterruptexanple( Ithis.b1.addpixmap(! !pnl .getpathname(' go.png')) endnethod define method counter) iS¥5s, setrhterrupt(! !fnrnterruptexanple.b1) \2ms.i-addplapap(!tpmt-getpathnane (stop. ag")? itmis:bi:rerresh( do In'Fron 1 to 10000 ithiscnun.val = In Iehisinum: refresh() Ipereent =. In / 100 AP’ GPisrs.InterrupeO? then fialert.messageCin & 1 Toops were completed - | & Ipercent.string(loLI) & 1X1) real endif TENSYS. setProgress(!percent) enddo Ithis.b1.addpixmap(! !pml .getpathname(' go. png')) IMhusvs.seterogress (0) Endnethod Appendix B3 - Example code for Exercise 4 setup form | !voluneviewexample Ithis.formritle =" lVolume view example] Ithis-firstshomcall = |Ithis.firstshownd) | ithis:killingcall. = | Ithis-closeQ! Ithis.initcaly = [ithis:initol this pop! 5 a this CALLBACK", "Update Drawlist', '!this.initO") view" -volumeview volune width 41 height 15 Timits auto isometric 3 exit button -but |update prawlist| at xmax form - size ymax call |!this.initQ| member ‘drawlist 4s REAL exit define method .voluneviewexampleQ Ithis:volumeView.borders = FALSE Ithis:volumeview-backaround = Idarkslate| [this volumeview: shaded = TRUE 42 AVEVA Plant (12 Series) Customisation Upgrade -voluneView. projection = [PARALLEL Volumeview.radius = 100 VoluneView.range = 500.0 VoluneView.eyenode = FALSE VoluneView.step = 25 this: volumeView, setpopup(! this. pop) | “"create local dranlist. within the global object iehis-drawltst = ! 1gphbrawlists.createDramtistO) endnethod define method. .firstshoun( define method .ightclickexplorer(Idata is ARRAY) this explorarerane.popup = this explorerPopup, + datal |uhis:explorerrrame:showpopupC gael], idat ithis-elenent = teatal2]-cbrefO endnethod define method .popup( ver ithes. clench name endmethod Appendix B5 - Example code for Exercise 7 import. 'Gridcontrol handle aNy endhandie using namespace 'Aveva.Pdns. Presentation’ setup form | !gridcontrolexanple resize Tthis:fornrittle = fExanpie .Net Grid Control | ng his. initO| gridPopup popup Ith Sede toatteack', ‘add to 30 View’ "Ithis.addrothreepview()" "this. saveToexcel” ) +t Ithis, ToadFroniexcel()* ) th’ 40 height 20 Ithis.gridpopup.add¢ "CALUBack" | ‘Save to Excel Ithis.gridpopup.add¢ "CALLBACK" } "Import from 6 container .gridFrame PnlNetcontro} €1 tgrid' dock Fill wi member .gri 4s netaridcontral ember ‘elements 1s ARRAY exit define method .gridcontrolexample() using namespace. ‘Aveva,Pdns Presentation’ o Create an instance of the control Shis.orid ~ abject NecGridcortrol this gridrrame control = Ithis.grid.handleO) Apph, the” event handters ran . ehis.ord.addeventhandler(‘onpopup).ithis,_irigheclickcrid’) andi hts.aridcaddeventhandler afverseléctchange’, Tahis, "aFterselectchange") ended define method .initQ) ‘using namespace "Aveva.Pdms.Presentation’ <- Create headings theadings = INane Type Owner Areal == Create model itens for population of grid var tdata collect al] EQUIP. var idata append collect all prPes <- Bind data to grid . . . nds = object Netbatasource¢‘crid control Exanple', Iheadings.split(), Idata) lthis.grid,sindropatasource(inds) <~ set grid parameters Ithis.grid.colunnexceiril ter (TRUE) Ithis.grid: setNamecolumntmageQ), AVEVA Plant (12 Series) Customisation Upgrade Ithis.grid out ookcroupstyleCTRUED lihis grid. Fixediieaders FALSE) this grid. FixedRows CFALSE) Jeg. grid: columsunnar ies (rave) endnethai define method .rightClickGrid(!data is ARRAY) Tehis-gridrrane:pepup = {ehis.gr4dPopup ithis.gridrrane, shonPopupt'daea(0l, tdsta(2]) Ithiscelements = tdata[2) endnethod define method .addrothreeDview() do lelenent values !this.elements ‘add Stelenent endo ‘endnethod define method . saveToexce] () jmport. "PML leBrowser’ handle ANY enghandie using namespace ‘Aveva, dns. presentation’ Tbrowser = object, PNLFi leBrowser(' SAVE") Ibrowser.show('c:\", Example.xis",'Save Grid to Excel',false, "Excel bocuments|*:x1s" »1) . this grid. saveGridToExcel (!browser. File) endnethod define method .loadrromexcel() ‘import. 'PNLFiTeBronser” handle any enghandle using namespace 'Aveva,Pdns.Presentation’ Ybrovser = object. PMLF leBrowserC OPEN") Ibronser,shont'c:\","", ‘Load Grid from Excel',true, "excel Documents|*.x1s" ,1) Ithis.grid.clearcridQ tng avabjéct NetbatasourceC!crid control Exanple', Ibrovser. £160) ghahis;ertd.Sindropatasource¢inds) endmata’ define method .afterselectchange(!data is ARRAY) var Idatalo] endnethod 45 AVEVA Plant (12 Series) Customisation Upgrade Appendix B6 - Example code for Exercise 8(a) import 'cridcontrol* S* Ensure that the .d11 file is loaded handle any endhandle import 'Exploreraddin' S* Ensure that the .d11 file is loaded handle any endhandle using namespace ‘aveva.Pdns.Presentation' $* specify Namespace for .Net setup form !lex8a resize Ithis. formritie Ithis. iconritle Ithis:cal Iback Ithis. FormRevi sion [Nozzle checker] |VTEWeR| [Hehis-AnitOl menu. .cridPopup popup Ithis.cridPopup.add( "CALLwack", ‘Navigate To Nozzle.", 'Ithis.navigatenozz' ) container .explorerFrame PMLNETCONTROL ‘NET’ anchor t+lir width 35 height 10 container ‘attributerrame PMLNETCONTROL |Attributes:| at xmin.explorerFrame ymaxexplorerFrame anchor all width 35 height 10 menber .attributesrid is NETGREDCONTROL menber :designexplorer is PMLEXPLORERCONTROL menber schosenelement. is DeREF exit define method .ex8a() =~ Specify Namespace for .Net using namespace 'Aveva.Pdiis. Presentation’ <- setup the .Net controls ithis.designexplorer = object PMLEXPLORERCONTROL() $* Add instances of .Net controls Ithis:attributecrid = object NETGRIDCONTROLO Ithis-explorerFrame.control = Ithis.designexplorer.handle() $* add to PML containers Ithis-attributerrame. control = !this.attributecrid.handle() ~~ add PML event handlers to .Net contro] Ithis.designexplorer.addeventhandler("onSeectionchanged' Ithis-designexplorer. initialise( /equrP’,'') tis-attributecrid.addeventhandler(onropup", !this, ‘rightclickerid’) endnetho this, ‘updatesystenata") define method .initQ == Setup the Grid Control Gadget Ithis.attributecrid.columexcelrilter(ralse) $* Turn off the filters Ithis.attributecrid-outlookcroupstyle(FALSE) —$* Turn off outlook style grouping Ithis.attributecrid. fixedHeaders (FALSE) S* Turn off fixed headers Ithis.attributecrid. fi xedRows (FALSE) S* Turn off fixed rons Ithis-attributecrid.columnsumiaries (FALSE) S* Turn off summaries Ithis-attributecrid.setLabelVisibility(TRUE) $* Show Label == collect al]. the equipment as strings, and pick the first on in the explorer Yapycequig coltect, oft kau for Zegurr | this.destgnexplorer selectelement( equi lens: FillaceributesO. aol endnethod define method, .updatesystenbataCidata is ARRAY) saEstablish'the chosen element in the explorer Ithis-chosenclenent.= Idata(o] -dorefO == loop to find an equr. rf it's an Equr, Fill the Grid control Gadget AVEVA Plant (12 Series) Customisation Upgrade do ‘if \this, chosenelement.type.eq(|EQUT|) or !this.chosenelement.type-eqCIWoRLI) then if Ithis.chosenelenent, type-eqC|eQuT|) then ithis, FillattributesO) endif break else . Tepis.chosenelenent = !this.chosenelenent cer enddo endethod define method .rightClickcrid(!data is ARRAY) <-"Apply the’ popup to the container Ithis.attributerrame.popup = Ithis.cridPopup <= show the popup menu {ehis-aetributeFrane. showropup(!data(0], !dataL1]) endneth define method. .navigatenozz [noses Tehsaraeeriputegria. getseleccedrows0 (1 [1 Hiee=" inozzsdbre ithis,destgnéxplorer. selectelenent(inozz) endnethod define method .fillattributes() =-"'Specify Namespace for .Net using namespace" 'Aveva. Pdns. Presentation’ -- FAT] in the Grid control cadget . collect all the Nozzs. PML1 syntax used as array of strings needed var data collect all NOzz for SIthis.chosenElenent =~ attributes required for each nozzle to be filled in lattributes = [NAME CPART1] CREF] == the titles of the columns for the attributes lattribritles = [Nozzle Size connection! =~ Required information passed to a NetDatasource object to compile the info Inds + object Netbatasource(' attribute Grid’, lattributes.splitQ, lattribritles.splitO, Idata) Ithis.attributecrid. sindtobatasource(!nds) == set the name column to hold icons of 06 elements and autofit the columns Ithis.attributecrid. setNamecolumntnage() Ithis attributecrid.autoFi tcolumns() Alter the information in the third column (connected) (Define the icons for use in the column Imissing = !1PML.GetPathNane('ad_t_019.png") lattached = !1PML.GetPathName(' ad_t_018.png") == collect the current values in colunn three and Toop through then Iconnected = Ithis.attributecrid.Getcolunn(3) do. In index Iconnected : Itestvalue = Ithis.attributesrid.getcell(!n, 3) . . if Itestvalue.eq¢INull Element|) then $* if Null], element is found ythis-ateributserid.setcel limage(in, 3, Imissing) $2 apply the misting icon ¢ jieiscattributesrid.setcel alueCin, 3, Icheck!1) $* change the cel! value Tepis.aveributesrid.setceTtmage(in, 3, lattached) $* apply the attached icon ‘enddo endnethod Appendix B7 - Example code for Exercise 8(b) 47 AVEVA Plant (12 Series) Customisation Upgrade ‘import ‘cridcontrol! S* Ensure that the .d11 file is loaded handle axy endhandTe . ‘import. 'Exploreraddin’ S* Ensure that the .d11 file is loaded handle anv endhandte using namespace 'Aveva.Pdns. Presentation’ $* Specify Namespace for .Net setup form ‘text resize Ithis. fommritle [this iconritle Ithis:calIback Ithis: Firstshowncal] Ithis:kiTTingcalT Ithis! formevision Equipment viewer] VIEWER | ithis:FirstshownO| IthisicloseQT 1.0] van nae FOSSEISSER PSB -cusancr', unvigate oz", “ee + venf SP Spt EEE “eaeng’ ay tga, To nar} container .explorerFrame PMLNETCONTROL "NET" anchor t+1_ width 35 height 10 Container \attributerrame PMLNETCONTROL, [Attributes:| at xmin.explorerFrane ymax. explorerFrame anchor t+l+b width 35 height 10, view .volumeview at_xmax + 0.5 ymin.explorerFrame VOLUME width 50 height 15 border off shading on isometric 3 exit menber .attributesrid is NETGREDCONTROL menber “designexplorer | is PHLEXPLORERCONTROL member ldranfist is REAL member “chosenElenent 1 DBREF exit define method .ex8b0 ~="specify Namespace for .Net using namespace 'Aveva,Pdis. Presentation’ s-, Setup the .Net controls this -designexplorer = object PHLEXPLORERCONTROL O S* add instances of .wet controls 'this.attributesrid = object NETGRIDCONTROLO. ithis.explorerrrane.control = !this.designExplorer-handle() S* add controls to PML containers Ithis.attributerrame.control = !this.attributesrid.handleQ, =~ add PML event handlers to .Net control |this.destgnéxplorer.addevenchandler(’onPopup' ehis, ‘righeclickexplorer') ithis designexplorer-addeventhandler¢'onselectionchanged' ,Ithis, ‘updatesystebata') ithis designexplorer. initialise(' /eQUrP™,"'") Ithis attributecrid. addeventhandlerC onPopup", !this, 'rightclickcrid') create a local drawlist within the global object lahis-dravtise = !gphOraw1ists-createbrant ist endnethod define method, .Firstshoun =-"hdd. 30 view to view system (this shows the form Naphviews. add¢!this.votunevien) ~ add local drawlist to 30 view Hgphbrawlists.attachvien(!this.drawlist,, this. volumeview) Hophbrawlists.drawlists{!this.dranlist) .holes (TRUE) endnethod define method .rightClickexplorer(!data is ARRAY) ~ Apply the’ popup to the container 48 AVEVA Plant (12 Series) Customisation Upgrade !this.explorerFrame. popup this. explorerpopup — show the popup menu ehis-explorerrrane, shouropup(!data[0], !data(1]) endmetho define method .fillattributes() =="Specity Namespace for Net using namespace 'Aveva.Pdns. Presentation’ =~ set. the Views limits based on the chosen element HgphViews. limits(!this.volumeView, !this.chosenElenent) =~ update the drawlist by removing the previous and adding the chosen dranlist = [!gphbrawlists.drawlistC!this.drawlist) Idrawl ist. renoveallQ, Idrawlist-add(!this.choseneTement) =~ active the volume view Ithis.volumeview.active = TRUE = FiT] in the Grid control Gadget

You might also like