ImageVerifierCode 换一换
格式:DOCX , 页数:24 ,大小:24.68KB ,
资源ID:29279551      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/29279551.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(Trainer Notes.docx)为本站会员(b****8)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

Trainer Notes.docx

1、Trainer NotesPML2 Training NotesWhats New in PML2Objects and Object methodsForm names are now preceded with !i.e. setup form _fredfollowed by : setup form !fredresults in an error because !fred was already defined in the previous assignmentForms are now loaded dynamicallyreturn error noalert allows

2、an error to be returned without any messagesWhat to avoid in PML2Commands with dollars in $m- $m+ $W25Numbered variables $v1-120The var command var !x name var !x readSynonymsGlobal variablesWhat to avoid in forms and menusDots in gadget namesselector gadgetsUserdataPixmap viewsAlert gadgetsRadiogro

3、upsSimple Textin gadgetsNumbers at the beginning of gadget namesWaiton to show formsDo list/pane/selWhats not changed in PML2In theory, all old PML should work in PDMS11.1. Very little of the old appware has been converted because this would be a waste of resources. Cadcentre policy on converting ap

4、pware to use new facilities is to only upgrade appware when modifications are being made in that area.The only exception to this, is where new facilities in core code supersede or improve functionality and it is necessary to write new code to use the extra functionality.New Environment VariablesPMLL

5、IB /DIRECTORYNAMEThis is a directory which is searched when the system looks for functions and forms PMLTRACE ON/OFFWhen set to ON, PMLTRACE will display a trace of all macros called in the unix command shell. This can also be switched on or off on the command line, so it is probably better to set t

6、he variable to off and use commands to control trace as before.The command in PDMS is - PML TRACE ON/OFFPMLCOMPILE ON/OFFEnvironment variable PMLDEBUG ON will write a trace fileAvailable variable types$v1 old style not recommended!a Named variables both global and local !global !localNOTE: !a is eva

7、luated as text automatically by using $!A (early evaluation)Named variables are now typed variables as one of the followingSTRING Text in quotes or vertical bars up to a Max of 254? charREAL Any numberBOOLEAN TRUE,FALSE These are not text i.e. TRUE,FALSEARRAY Any type including arrays of arrays of a

8、nythingOBJECTS A collection of different variables under a user defined typeVariables can be predefined as a particular type or revert to type when they are setThere are two ways of setting variablesVar !a (25) !a is a string!a = 25 !a is a real!a = xyz !a is a string!a1 = 75 !a1 is a real element o

9、f array !a Note: other elements in the same array can be of any type!a = TRUE !a is BOOLEANBeware Pre version 11 the var command was used to set all variables and it produced a string. Now we dont use var apart from collections.Variables may also be created before they are used using Methods!Answer

10、= real()!textline = String()!test = boolean()!squares = array()All of the above have the value unset There are various ways of testing whether a variable exists or is set:If(undefined(!x)thenIf(defined(!x)thenIf(unset(!x)thenIf(!x.unset()thenIf(set(!x)thenIf(!x.set()thenTo make a variable undefined

11、i.e. empty it.!x.delete()var !x delete Arraysarrays may be sparse i.e. you can set in index order Negative subscripts are not permittedA subscript of zero can be used but is not adviseddo loop from and to variables can now include expressions and even functionsArray methods!arraysize = !arraything.s

12、ize() Replaces var !arraysisze (arraysize(!arraything)Sets the variable arraysize to the number of elements in the array!testarray.clear() Deletes all elements from !testarray!test.removefrom(5, 20) Removes 20 elements from element number 5!new = !test.removefrom(5,20) Removes 20 elements as above a

13、nd creates a new array with the 20 elements inside.!myarray.append(!newdata) acts like var !array append fhjffj!myarray.27.delete() Deletes element 27 of the array the array still exists!myarray.delete() Deletes the array entirely!line = this is a line of text with some funny spaces !line = !line.tr

14、im(lrm) trims the spaces from the variable called !line!line = this is a line of text with some funny spaces !lines = !line.split(!line) Splits the string !line into an array of strings called !lines.Note: we could not use the same variable name because it is a different type!a = !lines.size() gives

15、 the number of elements in the array!a = !lines.width() gives the number of characters in the longest word of the arrayNo result methods.!lines.sort() sorts the array !lines and returns the array in its sorted form!lines.invert() inverts the array order first to last etc. These methods work only on

16、the original array. Attempts to set another array results in an error.i.e. !new = !lines.sort() Gives an error The old method.!ind = !lines.sortedindices() Produces a sorted index without changing the original array. This can be used to sort parallel arrays in the same way as before.!lines = !lines.

17、relindex(!ind) Re-orders an array according to the order of array !indIf applied to the original array, it would have the same effect as a simple sort, its use is to sort parallel arrays.The Current Element variableThere is one global variable which is always set by the system to be the element you

18、are positioned at in the database - this is called !CE. !CE is an object of type DBREF. Its attributes are described as members of the object. e.g.!tem = !ce $* creates a variable which is a copy of !ce1q var !tem $* Queries the attributes of the DBREF pointed to by !item =8196/8 NAME - DA/2000 TYPE

19、 - SITE LOCK - FALSE OWNER - =8196/0 DESC - MAIN REACTOR AREA FUNC - PURP - NUMB - 0 AREA - 0 POS - E 0mm N 0mm U 0mm WRT /* ORI - Y is N AND Z is U WRT /* MODU - ORRF - Unset STMF - Unset :MATERIAL - Carbon Steelq var !item $* gives/DA/2000 $* without all of the other stuff!item $* as a command, do

20、es nothing$!item $* navigates to /DA/2000Querying attributes q var !item.pos $* gives E 0mm N 0mm U 0mm WRT /* ORIGIN =8196/0 UP 0 EAST 0 NORTH 0q var !item.e $*query the east position 0q var !item.pos.origin $* gives all of the attributes of =8196/0 q var !item.pos.origin.lock $* gives the lock of

21、=8196/0q var !item.pos.wrt(=8196/32) $* uses the method WRT(DBREF) to extract a $*position relative to some other database $*referenceMETHODS/FUNCTIONSDifferent data types in pml have associated built in methods which may be used to convert or read data in a particular way. Some methods are similar

22、to the built in functions pre version 11.1 as in the example below:!NCHARS = !MYSTRING.LENGTH() $* THIS IS A METHOD!NCHARS = LENGTH(!MYSTRING) $* THIS IS A FUNCTION CALLThe pre version 11.1 syntax for the function call would have been as follows:VAR !NCHARS LENGTH(|$!MYSTRING|) $* THIS IS A 10.5 FUN

23、CTION CALLThe difference between the 10.5 example and the 11.1 example is that version 11 now returns a typed variable (REAL) where version 10.5 would have returned a string.Methods are built in for various data types and are listed in appendix A of the Customisation guide.Block evaluation of arrays

24、Block evaluation is a method of stepping through each element of an array and performing some action. In effect, it is like a single command do loop.To perform block evaluation, there are two stages:First you need to define the expression which will operate on the array elements Second, you need to

25、apply the expression to an arrayThe expression is stored in a variable and is defined as follows:!EXPRESSIONVAR = OBJECT BLOCK (!ARRAYNAME!EVALINDEX * 2)the !arrayname!evalindex bit is effectively the name of the variable being operated on by the expression. In the example above, the result would be

26、 to multiply all of the numbers in the input array by 2. The variable !evalindex is a special variable used in block evaluation. Any other variable name will not work! To apply the expression is as follows:!newarray = !arrayname.evaluate(!expressionvar)This creates an array called !newarray containi

27、ng the numbers of the original array multiplied by 2. The original array can also be modified using this method:!arrayname = !arrayname.evaluate(!expressionvar)Here are some simple examples !text = this is a line of text!myarray = !text.split()This creates an array called !myarray with six elements!

28、myarray1 = this!myarray2 = is!myarray3 = a!myarray4 = line!myarray5 = of!myarray6 = textNow we can define some blocks!extractchar1 = object block (subs(!myarray!evalindex,1,1)!new = !myarray.evaluate(!extractchar1)This extracts the first character of each word into and array called !newgiving the fo

29、llowing:!new1 = t!new2 = i!new3 = a!new4 = l!new5 = o!new6 = t!extractchar1 = object block (upcase(subs(!myarray!evalindex,1,1)!new = ! myarray.evaluate(!extractchar1)This does the same as before, but also changes the letters to upper case!new1 = T!new2 = I!new3 = A !new4 = L!new5 = O!new6 = T!extra

30、ctchar1 = object block (upcase(subs(!myarray!evalindex,1,1) & |fred|)!new = !myarray.evaluate(!extractchar1)This does as before, but uses the & character to append the string fred to the result!new1 = Tfred!new2 = Ifred!new3 = Afred!new4 = Lfred!new5 = Ofred!new6 = Tfred!extractchar1 = object block (!t

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1