欢迎来到天天文库
浏览记录
ID:49199976
大小:91.00 KB
页数:10页
时间:2020-03-01
《PDMS中文教程 PML基础练习.doc》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、一个简单的MacroNEWEQUIP/FREDNEWBOXXLEN300YLEN400ZLEN600NEWCYLDIA400HEI600CONNP1TOP2OFPREV参数化宏ParameterizedMacroNEWEQUIP/$1NEWBOXXLEN$2YLEN$3ZLEN$4NEWCYLDIA$3HEI$4CONNP1TOP2OFPREV变量给属性赋值NewPipeDescfMyDescription9Temp100Pspec/A3BPurpPIPI!desc=descitemp=temp!pspec=psp
2、ec!purp=purpNewPipeDesc'$!desc'Temp$!tempipspec$!pspec!purp$!purp字符串方法实例!line=•hellohowareyou1inewline=!line.after(9hello9).trim().upcase()qvarInewlineInewline=!newline.replace(fhowf3vwherev).replace(vyoufyou?f)定义函数definefunction!!Area(iLengthisREAL,!WidthisR
3、EAL)isREAL$汝函数!!Area有两个参数一个返回值!Area=iLength*!Widthreturn!AreaEndfunction练习•新建函数计算园的面积,测试函数definefunction!!circleArea(iradiusisREAL)isREAL!Area=PI*pow(!radius,2)return!AreaEndfunction条件判断语句(IfConstruct)!Type=Type!OwnType=TypeofOwnerIF(!Typeeq「BRAN')THEN$PCEisBr
4、anch.ELSEIF(JOwnTypeeq'BRAN')THEN$PCEisBranchmember.ELSE$PCEis$!Type,PlsselectBranch.ENDIF练习•条件判断!n=0!type=typeif(!typeeq'BRAN1)then!href=href!tref=tretif(!href.set())then!n=!n+1addhrefendifif(!tref.set())then!n=!n+1addtrefendifendifif(!typeeqfNOZZf)then!cref=
5、crefif(!cref.set())then!n=!n+1addcrefendifendif$pTotal$!nreference循环赋值!Total=0Do!xFrom1To100By1!Total=!Total+!xEnddo中断循环Break!Total=0Do!xFrom1To100!Total=!Total+!xlf(!Totalgt500)thenBreak$*或者Breakif(!Totalgt500)EndifEnddo用skip跳过奇数Do!xFrom1To100lf(lnt(!x/2)NE(!
6、x/2))thenSkip$★或者Skiplf(lnt(!x/2)NE(!x/2))Endif!Total=!Total+!xEnddo练习•跳转!n=0label/start!type=typeif(!typeeq'BRAN')then!href=href!tref=tretif(!href.set())then!n=!n+1addhrefendifif(!tref.set())then!n=!n+1addtrefendifendifif(!typeeq*NOZZ*)then!cref=crefif(!cref.
7、set())then!n=!n+1addcrefgotocrefgolabel/startendifendif$pTotal$!nreference错误提示Next$pOK错误处理(EitofHandling)NextHandle(2,113)$pLastelementEndHandle$pOK数组(Array)!Str='Benz,Bmw,Audi'!BestCar=!Str.Split(*;)Qvar!BestCar!BestCar[4]='Cadillac・!BestCar.Append('Lincoln')
8、赋值循环Dovaluedo!NamevaluesJBestCar$pArrayelementis$!NameEnddo索引循环Doindicesdo!nindices!BestCar!Car=!BestCar[!n]$pArrayelement$!nis$!CarEnddo管道排序Var!PipesCollallPipeforceVar!NamesEvaln
此文档下载收益归作者所有