You are on page 1of 50
AVEVA Plant (12 Series) PML Upgrade ou i a Oo Oo z z < = AVEVA Plant (12 Series) Customisation Upgrade AVEVA Piant (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 by law. 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.. 14 Aim. 1.2 Objectives 1.3. Prerequisites 1.4 Course Structure. 1.5 Using this guid 2 Updates to PML 2A OVERVIEW anne 2.2 New modification of the PNILLIB search path Exercise 1 ~ Update PMLLIB 3 PML form gadgets... 3.4 New PML form gadgets... 3.4.41 ComboBox, BAZ Linen 3.4.3. Numeric input 9.4.4 — Container... 32 Changes to existing PML form gadgets... 9.2.4 Button 322 List 32.3 Option... 324 Fon 3.3 Other... Exercise 2 - Using the new PML gadgets... 4 PML Objects. 4.4 NewiRevised Objects and Methods 4.2 FMSYS object Exercise 3 - Progress and Interrupt Methods. 4.3 Global Drawlist object 4-~ Individual Drawlists 5 PML.NET Exerc 5.1 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 Calibacks.... Exercise 7 - A Grid Control on a PML Form.. Exercise 8 (a) - Nozzle Checker Exercise 8 (b) ~ Nozzle Checker and Equipment Viewer... 6 Menu Customisation... Exercise 9 - Greate a new CommandBai Appendix A - Grid Control API Appendix B - Example Code. Appendix B1 - Example code for Exercise 2 Appendix B2 - Example code for Exercise 3 Appendix BS - Example code for Exercise 4 ‘Appendix B4 - Example code for Exercise 6 Appendix BS - Example code for Exercise 7 Appendix BG - Example code for Exercise 8(e) Appendix B7 - Example code for Exercise 8(b).. CHAPTER 1 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 Ci or Visual Basic, 44 Aim To provide a basic understanding into the new features available now available to PML, the course wil be limited to PML and all references to other software for example Cif net or Visual Basic .net are purely for completeness and are not covered by this course, 4.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 @ 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 toxt styles are used to indicate special situations throughout this document, here is 2 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 willbe red and bold. Annotation for trainees benefit: @ Additional information EL) 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 eco 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 still follows the three folder system: pmllib functions forms objects Xxx, pmifne Xxx.pmifrm Xxx. pmlobj 2.2 New modification of the PMLLIB search path The PMLLIB searchpath is defined by: Set PMLLIB=C:\AVEVA\plant\PDMS12.0\pm11ib Its normal practice to setup a parallel hierarchy to contain any newimodified 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” Set PNLLIB=C:\temp\PML Files\pm11ib;C:\AVEVA\plant\PDMS12.0\pmlib; PML REHASH is still used to update the PML index file (PM REHASH ALL to refresh from all search paths). Forms and objects are still shown, loaded and reloaded as before. Urner) 1 # Copy the provided files into the appropriate folder. For example, C:\temp\ + Update the PMLLIB environment variable in the .bat file fo point al this folder 2 © Load PDMS and enter the Design module 3 «Confirm that the PMLLIB search path is correct by typing ¢ evar pmil1b into the ‘command window AVEVA Plant (12 Series) Customisation Upgrade 10 CHAPTER 3 oe eee 3.1___New PML form gadgets ‘There are some new gadgets that are available for use with AVEVA Plant (12 serles) 2) For further information on these gadgets and the associated methods, please refer to the Software Customisation Reference Manual 3.1.4 ComboBox ‘A combo box Is @ 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 {combo y down artow. 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 isplayText() 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 grenularity. 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. (ea) 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. 11 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 naw it can also be defined as a linklabel, After specifying the gadget name, if the keyword LINKLABEL is used, the bution will be displayed as if it was hyperlink. Show Gadgets: 3.2.2 List Lists no longer need to be declared as @ 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 bo depracated — use EDG * Alpha view command channel is now within the window (now a command window rather than a command line) « Iiflebrowser is now a PML .Net form — although it can still be called from the !iflebrowser function 2 Bene foes counter [8 {5} show Gaayete FFoiup Freme 8 Fottuptre Frame 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 syntex 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 r 8 (47.18) CP: Syntan eto Cza 3 4 Show Gaages © show Gages 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 @ range of 0 — 40. (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 up/down 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 44d New/Revised 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 IAttribxLEN = object attribute('XLEN') !TypeEQUI = object elementtype('EQUI') q var !AttribxLEN q var ITypezQUI To find out what methods are available on these objects (and others), there is a new global method called .methods(). This method returns an array of strings which list the available methods on the objects. There are no desetiptions of the methods provided, but the names and arguments should initial information. The best way to find out it to test them var IAttribxLEN.methods () var !TypeEQUT methods () var \AttribXLEN.ispseudo() var !TypeHQUI.membertypes () aaaa 4.2__FMSYS object ‘The FMSYS object (Forms and Menus System object) wes 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 NFMSYS. q var 11FMsys FMSYS The method .FMinfo() returns information about all the current forms and menus. The retum is a array displaying the Module's name, Module’s version, Appware version, unused, Help file alias, unused, Help about callback, q var | IFMSYS. FMinfo() [0] "AVEVA PDMS Design’ [1] ‘unset' [2] '12.0.0" [31 ‘unset! (41 ‘Ppuv' [5] ‘unset’ [6] '§m *&PDMSUI%/MON/ADMIN/HELPABOUT"* If a callback is takes a long time to execute, thon 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: 18 AVEVA Plant (12 Series) Customisation Upgrade 1 1PMSYS..setProgress (25) ITFMSYS..setProgress (50) wl IIFNSYS .sotProgress (75) IIFMSYSsetProgress (0) Be 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 !FMSYS object can inform users of what forms are loaded within PDMS and which forms are currently shown. q var !1FMSYS. forms () q ver !1FMSYS.shownForns () The IIFMSYS 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 .setlnterrupt(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 * Type the following on the POMS Command line: show |1¥Minterruptexample * 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 screen. sz) «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 @ popup message will return progress Information. After this the form will reset. 4 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 ‘+ Tryaltering 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's possible to have multiple drawists. 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 !igphprawlists GPEDRAWLISTS DRAWLISTS 1 Elemente q var !gphDrawlists.drawlists [1] DRAWLIST q var ! !gphDrawlists.methods() The following are some examples of the methods which are available on l!gphDrawiists: To find out information about all the drawlists in the global object, use: | lgphoraw1ists.1istat] © To create a drawiist in the global object, use: !1gphoraw1i sts.createpraw1ist ©) To associate a drawlist from the global object with a view, use: !1gphorawlists.attachview(ORAWLIST, GADGET) Drawlists can only be attached to a view that has been registered with the !!gphViews 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 1 igphviews GPEVIEWS ACTIVEVIEW Unset SELECTEDVIEWS 0 Elements VIEWS 1 Elements To add @ view to the global object, use: I 1gphviens .add (GADGET) To set the limits of a view based on a DBREF object, use Hgphviens.1imits(Gapcer, BREF) 18 AVEVA Plant (12 Series) Customisation Upgrade Etech 1 + Type the following into the PDMS ‘Command Window: rave 0 Bont guage) | igphDrawlists.14stall () "ow IGPrEDDESTON EW * Notice how there is only one draviist object currently defined. How many view elements are defined in the HgphViews 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: !gphDrawlists.1istall() q var !igphviews * The contents of the view can be updated to the current element by either pressing the Update Drawiist button or by using the popup menu in the volume view. — Change the contents of the view and type: I tgphDrawlists.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 tumed 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 ce CHAPTER 5 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++, C# or VB.NET). The PML.Net Engine loads a given assembly and once loaded instances of PMLNetCallable classes may be created. No additional code to interface between PML and .NET is necessary. This is provided by the PMLNetEngine. Poms ‘Customization ce mim [ra It is possible to add container objects to @ conventional PML form creating a hybrid of PML & NET. The container is treated as a normal form gadget (/.¢ syntax graph) but can be filled with a -NET object i t 1 t t 5.1__ Import an Assembly into PDMS Before a NET control can be used in a form, it first has to be imported into PDMS. The required .ll file has to be loaded and the namespace specified. For example: import ‘Gridcontrol" | using namespace ‘Aveva.Pdns Presentation" ® Trying to import a .ail fle which has already loaded or cannot be found will result in an error. Efror handling should be considered o prevent the error messages being displayed to users. 2 AVEVA Plant (12 Series) Customisation Upgrade 5.1.1 Syntax To define your first .NET object, type out the following into the Command Windows import '@ridcontrol! using namespace 'Aveva.Pdms.Presentation' InetObj = object NETGRIDCOWTROL () q var Inetob} q var InetObj methods () @ Notice the .methods() method. This is 2 new global method available on all objects. It returns all of the methods Bao ences 43 + On the command line create a import 'PMLFileBrowser’ using namespace 'Aveva.Pdas.Presentation' Fil Browser object. The options Ibrowser = object PMLFileBrowser (*OPEN') arat: Open of Save. (If no argument is given then it will default to "Open") 2 aw Query the object and the ac ee \ethods () methods on the PMLFileBrowser q var Ibrowser-file() instance 3 iprowser.ehow('C:\!,"abe.doc', "Example a the File browser Dialog Browser!,true, 'Word Documents|*.doc', 1) ‘orm: directory (string) seed (String) — file which is shown by default fitle (string) ~ tile of form exists (Boolean) — check if specified file exists filter (string) - type of files to open. A description, followed by “P and then the file types — for ‘example: Word Documents|*.DOC. Text files Seen gseie lan Files q var tbrowser.file() Index (integer) — for multiple strings, the index of the. filter currently selected 22 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 Afier this, the constructor method would define the .NET object and apply it to the cont gadget using namespace. 'Aveya.Pdns.Presentation® Ithis.netcontrol = object NETGRTOCONTROLO Ithis:netFrame.control = Ithis.netcontrol -handleQ ‘The user is now able to specify event methods to control the .NET gadget: !this-netcontroladdeventhandlerC'onPopup', !this, 'rightclickexplorer') This example allows the forms .ightClickExplorer() method to be run when the NET object is right clicked. PML Frame PML Container for $+ mucroomorsionsamiereneiate] € NET Control ® . SITE Stel Ters_Sto srrw Srp, feeren Tre sore Trees {G rrwc stercauonersteneuares By iret acura tenruaTes 2SS0M egg peatoe {2SSOML Hak, rape Setom avassouumone Ar. See, Po pemremeaee texiresty sonowas-comgna-8 Apr. 14S cng AED vara process feTEMS E sort assoc? .NET Control [ASDFWL AVEVA-St deszenen-DtrRns eseorrresseesss 23 AVEVA Plant (12 Series) Customisation Upgrade SiTEt (TW stout Tat &@ sive saveLesonin © @ sire stasuzen “Pi As Tete Wort | [] TPWL Walearoare_Templte_Wort 4 [3] TW Penarter_ Tepito “PW Concrete Tepe Word 4 [G] TPwL ROOM-DESIGN-SANPLE-TEMPLATE 9. SITE Seal Tenpll She 4 By APPLOW Serie Ppe_Assenntes 49 [G] TAL Eadovert:tepteter-Torstos {9 (@] TAL storequiewenrr-TewevaTes ‘9 (@] TPAL ADWEQUEWENT-TEMPLATES fg ASSOML Eairmont_Assoctons AASSOML Hole_ Manageme Assos ML Frame See Benet) fear | ‘Design WORT™ @@ sitet & (&) TPart Deraa_TPwL & @ SITE SANPLE-ADMIN © @ sire stasizer ofeeen, ONE PIPES © Type the folowing 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 one @ Note: The PML gadgets are invoking methods on the Ci control. * If you press the button, the current element will be highlighted in the explorer. a PHL Frane: { = lesen worl 1 @ sitet [9] TP WL Defeat TPL & @ sme saNPLEADNN ® aE 6 Bh Tat At tor * 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 fitered. «Data in the grid can be exported tolimported 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. Whilo 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 al] EQUT Jattribs = [NAME TYPE OWNER AREAI Idata = object NetDataSource(‘Example Grid, lattribs.split(), !coll) Ithis.exanpleGrid.BindTobatasource(!data) Din this example, the NetDataSource object is collecting information from the database. Thoro are other ‘methods availabl. Refor to tho .NET Cutomiseton User Guide, available within the 12.0 marwal 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{1] is the y coordinate of the current cursor position ‘© Array{2j contains the ID of each of the selected rows + BeforeCellUpdate(Array) © Array(01 is the new value the user typed in © Arrayf}is the Row Tag of the cell © Array(2]is the Column key of the oeil © Array(3] is a Boolean. If you setit to “false” then the new value will NOT be allowed + AfterSelectChange(Array) © Thearray contains the ID of each of the selected rows 0 AfterCellUpdate © Noarguments are passed. 2 There are a number of API calls available. Refer to Appendix A or the NET Cutomisaton User Guide, aveilable within tho 12.0 manuals 25 AVEVA Plant (12 Series) Customisation Upgrade a eet a ‘Type the following on the PDMS Command line: Show !!GridControlexample Toe mee las] as] El Note that the grid has been populated jefomacc [rau |ancensnommeave|o | with a set of attributes (the headings), | F Gaceaat [eau feieceour fo 1]] and a set of model items (Equipment "Receaist [eau RLEC-EQUF fo and Pipes in this example). The grid ances Pe [IFES o control populates itself with the attribute [ane Gs io data. [qiwoas [vee ves a [ganea [ree ries a es [ere res a a7 Pre [ines ree [eS 2 Grid Behaviour: * Drag and crop 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 © ‘Type : PIPE (12 toms) ‘+ Investigate tho "Summary" feature (the “summation” symbol ‘on the Area attribute column), 3 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 GriciControlExample.pmitim 26 AVEVA Plant (12 Series) Customisation Upgrade 4 Save Data to an Excel file: * Add 2 popup menu to save the grid 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 arid. © 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 53 represent the column headings. aa tEAn 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 GridControlExample.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.pmifrm 7 Grid Control API * Try out some of the other events and methods available on the Grid Control (2 For details of the methods availablo on a grid control gadget, refer to Appendix A or the NET Cutomisaton User Guide, available within the 12.0 rranual ar AVEVA Plant (12 Series) Customisation Upgrade Eto) Bence 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 @ .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. (22 Referto the NET customisation Guide for suitable methods. fj @ Eauicrto1 eg equietsaan og equieioos gh EQUIPisnA, w @P EQUIPIEOD EQUI Pi6028 © @P EQUIPiso2s @ @P EQUIVENTILATION. UNITY | nozzle |size| ——Comection 0 11201-Na [40] Cheok! i, yp Tian NS [BO | Cheer 30 101201-NS [65 |e Shook! 0 (ra0i-n7 [65 [eq check }a (Ora01-M [450 | Check ya O1201-N [80 [@ BOBT-E ya 701201-n2 [00 |e 0-9-4-61 TDI2O1-N | 100 lem A00-B-8-64 we i>) aD) otel Rens = 8 28 AVEVA Plant (12 Series) Customisation Upgrade BOrer nce ncn i imenars 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. Al Equipment Views TS @ Zone EGU Gf EQUIENSOI & @P equi pian fegP Eau ctiot & @P Eauietso2n EQUIEt3020 be EQUPredIA EQuiPicoto EQUIPIE02A Gp eaurvenrtznion uw Nezele —|Size) Connect jn isoze-ti [100 |p Aeo-as7-62 id PISDRONE [EO |e AWO-E-BT a 16028-19 |60 |G Checkt rel isne-ne [160 [q Cree 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 toolvars are created within PDMS and are saved to XML files. The toolbars can be shared across the modiule, project or made specific for a user. Stren cnkkccunrneers ee ‘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 News CommandBar 34 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 Tent oO ee 1 Nolasco enced] le Neutepsanopas Rove New “Test Bott ite Testo With the new button selected, look to the right window on the form Select the line titled Command and Glick the small *...” button which appears on the right. This will lat us set the command. A command can be a core command or a PML command Choose Macro, and type show NexBa. Close the form by pressing OK. d Caption Tostt a leon ( Niotmagecrescuce i speci fe aensteapdondpon How | Nene Test Shona Hone Toskp | The associated command is nowdisplayed in the properties window 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 Checker’ Select the new button in the middle window. Drag and Drop the new button beneath the new CommandBar abject to make the association. Select the CommandBar object and notice the button is displayed in the preview. ‘Apply and OK the form and the new ‘Command Bar will be displayed in the main application. Test the button 33 AVEVA Plant (12 Series) Customisation Upgrade Appendix A Rhein keane) 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. Name NetDataSource(String TableName, Array Attributes, Array Items) Purpose Data Source constructor for database Attributes and database items, The Grid will populate itself with database attribute values. NotDataSourca(String TableName, Array Attributes, Array AitributeTitles, Array Items) Data Source constructor for database Attributes: and database items, The Grid will populate itself with database atirioute values. The attribute titles can be added. NetDateSource(String TabieName, Array columns, Array of Array of rows) Data Source constructor for column headings, and a set of rows. In this case the grid does NOT populate itself with database attribute values. NetDataSource(String TableName, Array Attributes, Array Items, String Tooltips) Data Source constructor for database Attributes. and database items. The Grid will populate itself with database attribute values. NetDataSource(String TableName, Array columns, Array of Atray of rows, String Toottips) Data Source constructor for column headings, and a set of rows. 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 BindToDataSource| Cos | 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:\tempifile.xls 35 AVEVA Plant (12 Series) Customisation Upgrade SaveGrid ToExcel(String, Worksheet) Save Alll Data to a Worksheet in ‘an Excel File. Note that this will retain all grid groupings and layout of data. ColumnExcelFilter(Boolean) FixedHeaders(Boolean) Allow/disallow fixed headers. (Used when scrolling). FixedRows(Boolean) Allow/disallow fixing of rows. (Used when scrolling). OutlookGroupStyle(Boolean) Allowidisallow Outlook group > faciity HideGroupByBox(Boolean) | Hide the groupBy box....this will leave the Outlook style grouping in place and hence disallow the - _ i user from changing the grouping setGroupByColumn(colNum, Sotunset column in Boolean) - OutlookGroupstyle Allowidisallow Excel style filter ‘on columns ColumnSummaries(Boolean) Allowidisallow Average, Count, etc... on numeric columns HeaderSort(Boolean) Allow alphabetic column sorting Erroricon(Boolean) Allowidisallow the display of the Ted icon in the cell if a data value is not available ‘SingleRowSelection(Boolean) Set grid to single row selection allGridEvents(Boolean) ClearGrid() setAlternateRowColor(String) Switch Grid Events On or Off Romove data & — column headings. Set alternate rows to a different color setAlternateRowColor(Red Num, Green Num, Blue Num) Set alternate rows to a different color. The default is: (251, 254, 255) EditableGrid(Boolean) 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 elther 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 SaveLayoutToxmil String) Save the grid layout (not data) to ___ | afile on the file system. loadGridFromXmi(String) Load a stored layout on the file system (not data) into a grid instance. PrintPreview() Opens an Infragistics style Print Preview Form (which allows rinting GetSelectedRows() Avray of 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 GotRow{row tag) “Arey Get the cells in the Row with the specified row tag GetRowTag(NUM) String Get the Tag ID of the row sett:ditableRow(Integer, Boolean) Allowldisallow a designated row — tobe editable setRowColor(NUM, String) Set row color to a string (eg - — ‘red’) setSelectedRowTags(Array rows) Programmatically select the given row tags selectRow(NUM) Programmatically select the row=NUM = getNumberRows() Real Get the number of rows in the arid clearRowSolection() : 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 - in each cell of the row, deleteSelectedRows() Dolete selected rows _ i 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 arra scrollSelectedRowToView( ao ‘Scroll the selected row into view ‘SotColumnMask(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 setEditableColumn(Integer, Boolean) Allowdisallow 2 designated C column to be editable GotNumberColumns() REAL Return the number of columns AssignValueListToColumn(Name, Column NUM) Assign the value list to a column | GetColumns() GetColumn(NUM) Get the columns in the grid Get the cells in the Column number=NUM ‘setColumnColor(NUM, String) setColumnimage(NUM, String) setColumnVisibility(colNum, Boo!) ‘Sot column color to a string (eg ‘red’) Set all cell images in column to the pathname of the specified loon | Show/Hide column ResizeAliColumns() GetCel(ROW, COL) STRING getColumnkey(NUM) Sting Get the Key of the column sotNameColumnimage() Displays standard icons in a | “NAME” attribute column when | eens database items are used. AutoFitColumns() Resize columns to fit widest text SetColumnWidth(Column NUM, Sey column number to a set Column Width) width ExtendLastColumn(Boo!) | Extend the last column, of not ‘width of form Resize columns to fit in available Get the content of cel(ROW,COL) by row and column number 38 AVEVA Plant (12 Series) Customisation Upgrade GetCelKrow tag, column tag) STRING Get the content of cell(ROW,COL) by row tag and column tag setCeliColor(row, col, String) Set cell color to a string (eg red’) setEcitableCell(Row NUM, Col Allowidisallow a designated cell NUM, Boolean) 10 be editable Set cell image to the pathname of the specified icon setCellValue(rowNum, Colum, Programmatically set a cell value STRING) a toa string AssignValueListToCel(Name, Row Assign the value list to a cell NUM, Column NUM) setCelllmage(row, col, String) Input masks can consist of the following characters: Precision Cenc Decimal placeholder. The actual character used is the one specified as the decimal placeholder by the system's international settings. This character is treated as a literal for masking purposes. 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 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 p 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) 2 Convert all the characters that follow to uppercase. Convert all the characters that follow to lowercase. 39 AVEVA Plant (12 Series) Customisation Upgrade Charact breed tan ‘Alphanumeric character placeholder. For example: a-z, A-Z, or 0-9. Character entry is required. Alphanumeric character placeholder. For example: a-z, A-Z, or 0-9, Character entry is not required. Digit placeholder. Character must be numeric (0-9) but entry is not required. Cpiinal minus sign to indicate negative numbers. Must appear at the ining of the mask string Character or space placehokier. Character entry is not required. This operates exactly like the '8' placeholder, and ensures compatiblity with Microsoft Access. Letter placeholder. For example: -z or AZ. Character entry is not requirad. [Literat__| All other symbols ate displayed as iterals; thats, they appear as themselves Digit placeholder. A group of n's can be used to create a numeric section where numbers are entered from right to left, Character must be numeric (0- mm, dd, yy | Combination of these three special strings can be used to define a dale mask. mm for month, dd for day, yy for two digit year and yyy for four digit hh, mm, ss, tt | 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: hh:mm, hh:mm tt, hh:mm:ss. Appendix B feseor Appendix B1 - Example code for Exercise 2 This example code has already be fixed. The 10 fixes have been highlighted: setup fom | newsadoettxanple Error 1: Syntex order error Ichis-Forntitte =" [New Cacgets, exanpTe| conbo' -conbo |colours| wid 10 Error 2: Incorrect step fara ‘eolourslock pixnap wid 16 hei 16 ‘ine ‘Tinel._atxmin,conbo. ynax.conbo horiz wid? hei 0.5 nureric nun. [counter] st-xninTinel ymax range 0 10 step iyhdp 0 val 0 wid 3 Button” “buts Tinklabel, [show Gadgets] "at xmax-nun + 0.5 ymfn.nun rane’ foldup foldup, Lkot dup Framed at xin un ynax-num > 627 i Button” sbut? Tinklabel’ |rotdup the Frane| dock exit exit oe razwatoapwcasgeremanni wn Error 3: Open Callback lofine method .nexcadgetexanple |gfbsteonbo, catback +, LERIS Senbachege0 | Error 4: Unwanted cherecter iehissnun.ea/Toack = |!this.nunoerchec : i |stpuelcalfback ~ | eat nshoneadgess0 | Error 5: ncerrectinidal plture ithis:but? callback = | !this.foleFrane() |aext's" [aed velTow, green cjan blue Purple rink isecombordvext =" dtext.spiitO) 1 3:colourBlack.add>ixnaac! 'pvl .getPathane(" L.pna" ithisinun;nodi fiedevents = TRUE Ithis:buti-active = FALSE Se Ithis:bur?ivistbie =" FALSE Error 6: Needs to be TRUE ithisifoldup. visible © False cendne the de 12 method .conbocheck(igad is gadget, !event is STRING) fent.eq¢' VALLOATE"), then if & 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 'Gridcontrol! $* ensure that the .d11 file is loaded handle Ny endhand] 2 import 'Exploreraddin' S* Ensure that the .dI1 file is loaded handle ANY endhandle . using namespace ‘Aveva.Pdns. Presentation’ $* Specify Namespace for .Net setup form !lex8a resize Ithis. foraritie Ithis:ieonritle Ithis:callback this! Formeevi sion Nozzle checker! YEEWER| Ithis.initOL 1.01 nenu .cridPopup popup !this.GridPopup.add( *catsack", ‘Navigate To Nozzle.", ‘!this.navigatenozz' ) container .explorarrrame PMLNETCONTROL 'NET' anchor csr width 35 height 10 container ‘attributerrane PMLNETCONTROL |attributes:| at. xmin.explorerrrane ynaxcexplorertrane anchor all width 35. height 10 nonber .attributeGrid is NETGRIOCONTROL ember ‘designExplorer_ is PNLEXPLORERCONTROL Homber :chosenclenent is DeREF exit define method .exBa() Specify Namespace for .Net . using namespace ‘Aveva.Pdis.Presentation! <= setup the .Net controls ithis.designexplorer = object PMLEXPLORERCOVTROLO $* Add instances of .Net controls Ithiscattributecrid = object NeTGRIOCONTROLO. Ithis-explorerrrame.control = Ithis.designexplorer.handle@ $* add to PML containers Ithislattributerrane. contro) = !this.ateributesrid handleQ, =~ add PuL event handlers to Net, control ithis.designexplorer.addeventhandler( onselectionchanged’ , this, ‘updatesystenpata') Ithis.designexplorer.initialisac'/equie",'') Ithis-attributecrid.addeventhandlerC'onpopup", Ithis, ‘rightClickerid’) endrethod deFing method init) ="Setup the Grid Control Gadget |thisvattributear id. col umexce] Fi Iter Cease) ithis attri puter id. ovtlookaroupsty |eCFALSE ithis attributecrid. Fixedieaders (FALSE) ithis attributecr id, FixedRows (FALSE) this-attributesr td, colunnsummaries (FALSE) ithis attributesrid. secLabelvisibi ii ty (TRUE) Turn off the filters . Turn off gutlook style grouping Turn off fixed headers Turn off fixed rows Turn off sunnaries show Label Sz Cgllegt all the equignent 2s strings, and pick the First on in the explorer var lequip coltect all Gaur for /equtr ‘this. designexplorer selectelement (! equi pf1]) ithis:FiilAatterbutesO, cendne thed define method .updatesystemoataCIdata is ARRAY) ss "Establish'the chosen element. in the explorer Tthis-chosenclenant = Idata[0] -dbrefO) == loop to find an EQur. If it’s an EQUI, Fill the Grid Control Gadget 46 AVEVA Plant (12 Series) Customisation Upgrade iF, Lthis, choseneenent. type.caClEQUE|) or, {his.chosenElenent.type-eq(|WonLI) then if Tthis:chosenElenent, type-eqCTEQUT|) then ldhis. FillattributesO) endif break this. chosenelenent = Ithis. choseneTenent.cwner endif, endo ‘encnethod define nethod .rightclickcrid(idata is ARRAY) ~ "Apply ‘the’ popup to the container fthig.attributerrane,popup = Ithis.cridPopup ==, show the popup menu Ithis.attributerrame. shonPopup(!dataf0], !datal1]) endnethod define method .navigatenozzQ tnozz"= Ithisvattrs putegrid .getselectedrows [1] [10 Nee = inorzdbrefQ nn Ithis. desi gnéxplorer.selectelenent(!nozz) endnethod define method .fi1Tattributes( =-"spacify Namespace for .Net using namespace 'Aveva.Pdns. Presentation’ -- Fil] in the Grid control cadget collect all the Nozzs. PL1 syntax used as array of strings needed var Idata collect all NOzz for $!this. chosenElement => Attributes required for each nozzle to be filled in lattributes = [NAME CPARTL] CREFI -- the titles of the colunns for the attributes lattribritles = |Nozzie Size connection! =~ Required information passed to a Netoatasource object to conpile the info Inds = object Netoatasqurca('attribute Grid’, lattributes. split), lattribritles splitO, !data) Tthis.attributecrid. eindrobatasource(! nds) <= Set the name column to hold icons of p8 elements and autofit the columns [this attributecrid, setNanecol umntnageQ) lthislateributecrid. Autori tcolunnsQ Alger the inforwation in the third column (connected) Define the icons for use 9 the colunn missing = 1 PML. cetPathNane "ad, t_029.png") attached = I TpHi,cetPathNane(*ad_t_018.png") collect the current yalues in column three and Toop through then Iconnected = Ithis.actributeGrid.Getcolum@) do tn. index connected : Htestvalue = Ithis.attributecrid.getcel1(!n, 3) . | if Testvalue. eq] aulT Element |)" then | $2 if Mul] element is. found tthis.areributecrid.setcellinage(in, 3, Inissing) $° apply the missing icon yiuns-ateributecrid:sevcetivaluetin, 3, icheck#T) $* change the cel value else Lenis.aceributeorid,setceTInmageCin, 3, tattached) $* apply the attached icon endi endo endmethod Appendix B7 - Example code for Exercise 8(b) a7 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 Piant (12 Series) Customisation Upgrade Ithis.explorerrrane.popup = !this.ExplorerPopup <= show the popup menu Ithis.explorerFrame, showPopup(Idatafo], !data[1}) endnethod define method .fillattributes() w= "Specify Nanespace for Net . using namespace ‘Aveva. Panis. Presentation’ == set the Views linits based on the chosen element Hgphviens.limits(! this. volumeView, !this.chosenElement) =~ update the drawlist by renoving the, previous and adding the chosen idrawlist = |!gphbranlists.drewlist(!this.dranlist) Sdrawist.renoveallO, Idrawlist.add() this. choseneTenent) == active the volume view ithis,volunaview.active = TRUE -- Fal] in the Grid control Gadget . = collect al! the Nozzs.. pei syntax used as array of strings needed var Idata collect all NO2z for $!this.chosenelement =- attributes required for each nozzle to be filled in lattributes = INAME CPAR[1] CREFI == the titles of the colunns for the attributes Jactribritles = Iiozzle size Connectionl =z,tequired information passed toa Netoatasource object to conpile the info Inds: + object NetoatasourceC attribute crid®, !attributes.splitO, lactribritlas.splitG, 'data) Tehis. ateributecrid:sindTopatasource¢ !nds) = Set the name column to hold icons of ps elements and avtofit the colums Tthis.attributecrid. satwamacol unnimage() [this lattributecrid, AutoFitcolumnsO, Alter the information in the third colum (connected) Define the icons for use in the column rissing = |{PML.GetPathName(' ad_t_019.png") attached = |!PML.GetPathName('ad_t_018.png") collect the current yalues in column three and loop through then Tconnected = Ithis.attributeGrid, Getcoluan(3) devin index !connected Itestvalue = lthis.attributecrid.getcellC!n, 3) . if Teestvalue eq(INulT Element |) ‘then .. $* if Mull element is. found ithis.artribuvecrid. setcelltmage (in, 3, !missing) §° apply the missing icon this-attributecrid. setcellvatueCin. 3, |check!]) $* change the cell value ligphoranli sts,drawi ists[ithis.drawl ist] .highlightC! this att ributecrid -gercaditin,i).dbretO, 2) else Tthis.attributesrid.setceTimageCin, 3, lattached) $* apply the attached icon I igpnorantises, drawl ists! ehterdranl ist] -nighitghtc!this-aveributesrid, -oeteel fins DsdbrefO, 5) ends endo endnethod define method .closeO Sn"unioading the form, renove dranlist fron view ané delete it ophorew{ists-detachvien(! thy. vol ureVi en) i hor ai}sts.de) etenreet ise ienesdranl tse) endnetho 49 AVEVA Plant (12 Series) Customisation Upgrade

You might also like