PDMS学习笔记材料_第1页
PDMS学习笔记材料_第2页
PDMS学习笔记材料_第3页
PDMS学习笔记材料_第4页
PDMS学习笔记材料_第5页
免费预览已结束,剩余1页可下载查看

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、一、PDMS 安装:pdms win71、setup2、win7 miPDMSI2SP6.253、Project Sample4、Username Sample5、Password sample6、MDB SAMPLE7 Module Design8、ok二、PDMS常用命令:1、命令行清屏Alpha request clear2、记录Fl志Alpha log /C:/log3、输出详细命令$r102/$r4、查询命令Q var5、自动移动到屏幕中央Auto CE6、添加/移除Add/remove CE7、执行宏程序$m C:log.lxt8、显示关联Add all bran within v

2、olume ce9、PML窗口开发位置说明:xmin - xmaxyminIymax10、将字母转换成大写! str. U Pease三、PDMS命令事例:1、AID CYLinder NUM 5 ATE 13113N 8972 D 1150 ORI Z IS UP DIA 400 HEI 200 FILL ON 画出一个圆柱AID CLEAR CYLinder 5删除圆柱详见代码总结附录:PDMS文档翻译:一、导论:a) PMLAVEVA Programmable Macro Language二、变量对象函数方法:PML Variables:PML 里,Variables 是个ObjectO

3、bject 类型:StringReal (no separate integer type)Hi. Booleaniv. Array(hold many values of any type)Members and Attributes :User-defined Object Types:define an object:define object FACTORYmember .Name is STRINGmember. Workers is REALmember .Output is REAL endobjectdefine another object: define object PR

4、ODUCT member .Code is STRING member .Total is REAL member.Site is FACTORY endobjectIt is a good idea to use upper case(大 写)for object-type namesObject type definitions should normally he stored in a file with a .pmlohj suffix(后缀)in a directory specified(指定的)in the PMLL1B seavch-path(路径) e) Creating

5、Variables (Objects):Local and Global Variable(变量)Names:! Surface Area(local variable)!Are a(global variable)字母和数字组合,字母开头,最大16位,同意使用dot(.),但是现在strongly discourage(强烈反对)Notes on Naming C(mventions(约定):you are res pons ible for a voiding name-clashes(命名冲突)give it a meaningful namelimit your use of glob

6、al variablespossible use PML Functions rather than macros (make use of function return values and output cwguments to return results)Hi. Creating a Variable with a Build-in(内置)Type:!Answer = 42a Global Real variable (因为赋值为 42 是实数,所以系统会识别出Answer是Real型变量,下同)!Natne = Freda Local String variable!Ghd = T

7、RUEa Local Boolean variable以下是没有初始化的情况:!Answer = REAL Warne = STRING /Grid = BOOLEAN /Lengths = ARRAY iv. Creating Other Type of Variable : /NewPlant = object FACTORYv. Using the Member Values of an Object: Use the dot notation (符号) /NewPlant = object FACTORY !NewPlanl.Name = ProcessA !NewPlant. Wor

8、kers = 451 !NewP!ant. Output = 2022 /People = INewPlant. Workers f) PML Functions and Methods:函数和方法可以带有参数,可以是内置变量,内置对象,用户自定义对象或者ANY 类型i.定义了一个函数,返回值是REAL,参数是两个REALdefine function !Area( /Length is REAL, /Width is REAL) is REAL ii.函数内部define fund ion !Area( Length is REAL, /Width is REAL) is REAL/Area

9、 = /Length x !Width return /Areaendfunction函数调用前,参数必须存在 m.参数可以是一个常数define function !LengthOJName( /Name is STRING) is REALUldyName = !Name, trim return /TidyName. Length endfuriction 调用函数 /Length = !LengthOJNanie( FRED) 修改程序 define function !LenthOfName( /Name is STRING, /Length is REAL) is REAL/Nam

10、e = ! Name, trim! Length = !Name.Length endfunction 调用函数 /Name = FRED Length = REAL!LengthAndTrim( FRED !Length)函数中Length会发生变化,函数外的Length也跟着变化,以下调用方法是不 对的,因为函数不能修改常量HLengthAndTrimt FRED 4) $x WRONG当一个PML函数运行时,不能跳到别的PDMS模块:如果函数无法成功结束, 你可以用EXIT退出Storing and Loading PML Functions夕卜部文件必须小写,后缀.pmlfnc。调用!

11、ARE A or Harea or !Area都对应area.pmlfnCoThe define function必须在文件的第一行,并且函数名和文件名一致。PML程序不返回结果的PML函数define function !Area(! Length is REAL, /Width is REAL, /Result is REAL)/Result = /Length x /Widthendfunction使用方法!SurfaceArea = REAL/PariLength = 7!Part Width = 6call !Area(!PariLength, /PartWidth, Surface

12、Area)因为程序没有返回值,所以不能直接赋值,使用方法/Answer = !SurfaceArea()是必须的,即使没有参数define function UhutialiseHbtaI Weight = 0! MaxWeight = 0endfunctioncall initialise关键字call是可选的,但是推举使用注意:cal/也可以调用Fimctkm,但是在这种情况下,Function的返回值将丧 失。A rguments of type A NY:可以指定ANY类型为参数或者返回值类型使用ANY启用了参数类型检查-PML的一个特性,来保证正常的运行define function

13、 UPrintf /Argument is ANY)$P $!Argumentendfunction当使用了ANY,需要先确定类型才能使用它,可以使用ObjeciType函数define function !AnyType( /Argument is ANY)Type = !Argument.pmlobjectTypeifi /Type EQ STRING1) then-do something with a STRINGelseiff /Type EQ REAL) then-do something with a REALelseift !Type EQ DBREF) then-do som

14、ething with a DBREF else-do something with all other types or give an error endif endfunctionUsing the Methods of an Object 方法就是一个指定对象的函数一个方法或一个成员的说明包含以下局部:Name:Result or Type:返回值或者类型没有的话用NO RESULTStatus:其他信息方法是否修改对象状态;成员是可修改或者只读的Purpose :成员或者方法做什么EXAMPLEthis section(向 using a STRING variable as an

15、example.如果你对STRING的长度感兴趣,你通过查看手册可以找到一个Length方法, 返回一个REAL类型的值!Nchars = IMyString. length$xA method call是必须的!Methods on User-Defined Object Typesobject和method定义在一个文件里,!This表示object本身,下面是一个例子: define object LIFEmember .Answer is REALendobjectdefine method .Life/This.Answer = 42endmethod说明:.Life 被称为 def

16、ault constructor method另一个例子:define method .Answer is REALreturn !This.Answerendmethoddefine method .Answer( /Value is REAL)!This.Ansver = !Valueendmethod这些method在下面使用:/Marvin = object LIFEThe method .Lisfe wcis called automatically! Number = /Marvin.Answer/Number is set to the value 42/Marvin. Answ

17、erf40)/Number = ! Marvin. Answerlimber now has the value 40注意:当你创立了一个新的对象,或者改变了一个存在的定义,必需要载入定义通过这个命令:pml reload object _name_Method Overloading:方法重载,两个或者更多的方法使用同一个名字但是参数不同Constructor Methods with Arguments带参数的初始化方法:!Marvin = object LIFE(40)This would invoke a method:define method .Life(!Value is REA

18、L)Overloading with ANYExplicitly-typed(特定的)argument in preference to(优先于)ANYInvoking a Method from Another Methoddefine method .Life( !Value is REAL)!This.Answer(!Value)endmethodDeveloping a PML Object with Methods当你增加一个新的方法,PML需要重新读取一下对象的定义:pml reload object lifeUnset Variable Representations支持Siri

19、ng方法:!X = 2.5!S = !X. St ringbuild-in data tpye!X = REAL!S = !X.String 空字符串!X = BOOLEAN!S = /X.String 空字符串!X = STRING!S = !X.S!ring 字符串UNSET !X = ARRAY!S = /X.String 字符串 fARRAY其他的系统自定义变量,返回的值多数是VNSETf!X = DIRECTION !S = !X.Strinfi 字符串 VNSET用户自定义的变量返回的值也是INSET,Unset values and Undefined Variablesust

20、of an UNSET value where a valid item of data is required will always result in a PML error测试变量值Unset的函数和方法:Functionsif( Unsef( !X) thenif( Set( !X) thenMethodsif( !X. Unset) thenif( !X.set) then测试变量是否Undefined:if( Undefined !/Y) then if( Defined( !Y) then注意:没有等效的方法Deleting PML VariablesHY.Delete注意:不

21、能删除对象或者Forms的元素tn) Forms as Global Variables在PML 2里,Forms是全局变量,同时也是一个对象的定义,所以不能有同名的全局变量或者对象三PML的通用属性Functions Macros and Object DefinitionsPML File can be created using a text editor.PML Macros存在PDMSU1路径上PML Functions 存在 PMLLIB 路径上注释:一行的使用一一或者$x, $x可以加到命令后面多行的使用$(和)$,可以用于注释掉命令而不用从PML File中删除$(skipif

22、(!XEQ!Y)$)RETURN返回命令,可以作为PMLMacros的结尾Case Independence不区分大小写,包含keyword如if, do, else有例外的情况Abbreviations许多命令可以使用缩写替代但是推举使用完整的命令,有利于阅读Special Character$ 是一个 escape character(转义字符)$P This text will be output to the screen$P是一个输出到屏幕的指令当程序中需要使用$自身时,需要用$当一行命令后面有一个$时,表示下一行紧跟这行$P This is an example of a much longer message that will be $ output

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论