||
NEW EQUIP /FRED
NEW BOX
XLEN 300
YLEN 400 ZLEN 600
NEW CYL DIA
400 HEI 600
CONN P1 TO
P2 OF PREV
NEW EQUIP /$1
NEW BOX
XLEN $2
YLEN $3 ZLEN $4
NEW CYL DIA
$3 HEI $4
CONN P1 TO
P2 OF PREV
New Pipe
Desc 'My
Description'
Temp 100
Pspec /A3B
Purp PIPI
!desc =
desc
!temp =
temp
!pspec =
pspec
!purp =
purp
New Pipe
Desc
'$!desc'
Temp $!temp
!pspec
$!pspec
!purp
$!purp
!line =
'hello how are you'
!newline =
!line.after('hello').trim().upcase()
q var
!newline
!newline =
!newline.replace('how', 'where').replace('you', 'you?')
define
function !!Area( !Length is REAL, !Width is REAL ) is REAL
!Area = !Length * !Width
return !Area $*函数!!Area有两个参数一个返回值
Endfunction
define
function !!circleArea( !radius is REAL) is REAL
!Area = PI * pow(!radius,2)
return !Area
Endfunction
!Type =
Type
!OwnType =
Type of Owner
IF (!Type
eq 'BRAN') THEN
$P CE is Branch.
ELSEIF
(!OwnType eq 'BRAN') THEN
$P
CE is Branch member.
ELSE
$P
CE is $!Type,Pls select Branch.
ENDIF
!n = 0
!type =
type
if(!type eq
'BRAN') then
!href = href
!tref = tref
if(!href.set()) then
!n = !n + 1
add href
endif
if(!tref.set()) then
!n = !n + 1
add tref
endif
endif
if(!type eq
'NOZZ') then
!cref = cref
if(!cref.set()) then
!n = !n + 1
add cref
endif
endif
$p Total
$!n reference
!Total = 0
Do !x From
1 To 100 By 1
!Total = !Total + !x
Enddo
!Total = 0
Do !x From
1 To 100
!Total = !Total + !x
If(!Total gt 500) then
Break $*或者Break if(!Total gt 500)
Endif
Enddo
Do !x From
1 To 100
If(Int(!x / 2) NE (!x / 2)) then
Skip $*或者Skip If(Int(!x / 2) NE (!x / 2))
Endif
!Total = !Total + !x
Enddo
!n = 0
label
/start
!type =
type
if(!type eq
'BRAN') then
!href = href
!tref = tref
if(!href.set()) then
!n = !n + 1
add href
endif
if(!tref.set()) then
!n = !n + 1
add tref
endif
endif
if(!type eq
'NOZZ') then
!cref = cref
if(!cref.set()) then
!n = !n + 1
add cref
goto cref
golabel /start
endif
endif
$p Total
$!n reference
Next
$p OK
Next
Handle
(2,113)
$p Last element.
EndHandle
$p OK
!Str = 'Benz,Bmw,Audi'
!BestCar =
!Str.Split(',')
Q var !
BestCar
!BestCar[4] = 'Cadillac'
!BestCar.Append('Lincoln')
do !Name
values !BestCar
$p Array element is $!Name
Enddo
do !n
indices !BestCar
!Car = !BestCar[!n]
$p Array element $!n is $!Car
Enddo
Var !Pipes
Coll all Pipe for ce
Var !Names
Eval name for all from !Pipes
!Name.sort().invert()
Do !n
indices !Names
reorder $!names[$!n] before $!n
EndDo
Var
!nozzles Coll all nozzle for ce
Do !nozzle
value !nozzles
Add cref of $!nozzle
EndDo
!Input =
object FILE('%pdmsexe%abc.txt')
!Lines =
!Input.ReadFile() $* ReadFile将文件内容写到字符串数组中
!ResultArray
= ARRAY() $* 声明新数组
do !Line
VALUES !Lines
!Column1 = !Line.Part(1)
!ResultArray.Append( !Column1)
Enddo
!Output =
object FILE('%pdmsexe%def.txt')
!Output.WriteFile('WRITE',
!ResultArray) $* WriteFile将数组写到文件
!Input =
object FILE('%pdmsexe%abc.txt')
!Lines =
!Input.ReadFile()
do !Line
VALUES !Lines
$p $!line
Enddo
var
!isshown form _CADCBTH display
if(!isshown
eq 'Off') then
show _CADCREQ
endif
var !date
clock date
var !time
clock time
$p Begin
report at $!date $!time
setup form
!!hello
Title 'Hello'
paragraph .Message text 'Hello world'
button .bye 'Goodbye' OK
exit
setup form
!!hello
Title 'Hello'
paragraph .Message text 'Hello world'
text .input 'Enter text' width 10 is
string $*字符串类型的编辑框
button .bye 'Goodbye' OK
exit
Define method .hello() $*缺省构造方法,与Form同名,不带参数
!this.input.callback =
‘!this.doinput()’ $*Callback指明响应操作
endmethod
Define method .doinput() $*响应操作
!this.message.val = !this.input.val $*!this = !!hello, val 表示value
endmethod
setup form
!!hello
Title 'Hello'
paragraph .Message text 'Hello world'
text .input 'Enter text' at x0 ymax width
10 is string
button .bye 'Goodbye' at x0 ymax OK
exit
setup form
!!addvolumn
title 'Add volumn'
button .ce 'CE' at x0 ymax tooltip 'Select
pipe'
paragraph .cename text 'no name' width 15
text .input 'Enter text' at x0 ymax width 10
is string
Frame .frame1 'Include' at x0 ymax
toggle .bran 'Branch'
toggle .equi 'Equipment'
Exit
list .list 'Drawlist' at x0 ymax+0.3 width
18 height 5
button .ok 'OK' at x0 ymax OK
path right
button .apply 'Apply' apply
button .cancel 'Cancel' Cancel
!modifyOnIcon =
!!pml.getpathname('modmodeon16.png')
button .pick pixmap /$!modifyonicon at x0
ymax
exit
setup form
!!addvolumn
title 'Add volumn'
button .ce 'CE' at x0 ymax tooltip 'Select
pipe'
paragraph .cename text 'no name' width 15
text .input 'Enter text' at x0 ymax width 10
is string
Frame .frame1 'Include' at x0 ymax
toggle .bran 'Branch'
toggle .equi 'Equipment'
Exit
list .list 'Drawlist' at x0 ymax+0.3 width
18 height 5
button .ok 'OK' at x0 ymax OK
path right
button .apply 'Apply' apply
button .cancel 'Cancel' Cancel
!modifyOnIcon = !!pml.getpathname('modmodeon16.png')
button .pick pixmap /$!modifyonicon at x0
ymax
exit
define
method .addvolumn()
!this.bran.val = true
!this.input.val = '1500'
endmethod
setup form
!!addvolumn
title 'Add volumn'
button .ce 'CE' at x0 ymax tooltip 'Select
pipe'
paragraph .cename text 'no name' width 15
text .input 'Enter text' at x0 ymax width 10
is string
Frame .frame1 'Include' at x0 ymax
toggle .bran 'Branch'
toggle .equi 'Equipment'
Exit
list .list 'Drawlist' at x0 ymax+0.3 width
18 height 5
button .ok 'OK' at x0 ymax OK
path right
button .apply 'Apply' apply
button .cancel 'Cancel' Cancel
!modifyOnIcon = !!pml.getpathname('modmodeon16.png')
button .pick pixmap /$!modifyonicon at x0
ymax
exit
define
method .addvolumn()
!this.bran.val = true
!this.input.val = '1500'
!this.ce.callback = '!this.ce()'
endmethod
define
method .ce()
!this.cename.val = fullname
endmethod
setup form
!!addvolumn
title 'Add volumn'
button .ce 'CE' at x0 ymax tooltip 'Select
pipe'
paragraph .cename text 'no name' width 15
text .input 'Enter text' at x0 ymax width 10
is string
Frame .frame1 'Include' at x0 ymax
toggle .bran 'Branch'
toggle .equi 'Equipment'
Exit
list .list 'Drawlist' at x0 ymax+0.3 width
18 height 5
button .ok 'OK' at x0 ymax OK
path right
button .apply 'Apply' apply
button .cancel 'Cancel' Cancel
!modifyOnIcon = !!pml.getpathname('modmodeon16.png')
button .pick pixmap /$!modifyonicon at x0
ymax
exit
define
method .addvolumn()
!this.bran.val = true
!this.input.val = '1500'
!this.ce.callback = '!this.ce()'
!this.apply.callback = '!this.apply()' $*不关闭对话框
endmethod
define
method .ce()
!this.cename.val = fullname
endmethod
define
method .apply()
!dist = !this.input.val
!name = !this.cename.val
$p CE is $!name ,Dist = $!dist
endmethod
setup form
!!addvolumn
title 'Add volumn'
button .ce 'CE' at x0 ymax tooltip 'Select
pipe'
paragraph .cename text 'no name' width 15
text .input 'Enter text' at x0 ymax width 10
is string
Frame .frame1 'Include' at x0 ymax
toggle .bran 'Branch'
toggle .equi 'Equipment'
Exit
list .list 'Drawlist' at x0 ymax+0.3 width
18 height 5
button .ok 'OK' at x0 ymax OK
path right
button .apply 'Apply' apply
button .cancel 'Cancel' Cancel
!modifyOnIcon =
!!pml.getpathname('modmodeon16.png')
button .pick pixmap /$!modifyonicon at x0
ymax
exit
define
method .addvolumn()
!this.bran.val = true
!this.input.val = '1500'
!this.ce.callback = '!this.ce()'
!this.apply.callback =
'!this.apply()' $*不关闭对话框
endmethod
define
method .ce()
!this.cename.val = fullname
endmethod
define
method .apply()
!name = !this.cename.val
!dist = !this.input.val
!elements = array()
if(!this.bran.val) then
var !elements append coll all bran
Within Volume $!name $!dist
endif
if(!this.equi.val) then
var !elements append coll all equip
Within Volume $!name $!dist
endif
var !names eval name for all from
!elements
do !element value !elements
add $!element
enddo
endmethod
setup form
!!addvolumn
title 'Add volumn'
button .ce 'CE' at x0 ymax tooltip 'Select
pipe'
paragraph .cename text 'no name' width 15
text .input 'Enter text' at x0 ymax width 10
is string
Frame .frame1 'Include' at x0 ymax
toggle .bran 'Branch'
toggle .equi 'Equipment'
Exit
list .list 'Drawlist' at x0 ymax+0.3 width
18 height 5
button .ok 'OK' at x0 ymax OK
path right
button .apply 'Apply' apply
button .cancel 'Cancel' Cancel
!modifyOnIcon =
!!pml.getpathname('modmodeon16.png')
button .pick pixmap /$!modifyonicon at x0
ymax
exit
define
method .addvolumn()
!this.bran.val = true
!this.input.val = '1500'
!this.ce.callback = '!this.ce()'
!this.apply.callback =
'!this.apply()' $*不关闭对话框
!this.list.callback = '!this.doselection()'
endmethod
define
method .ce()
!this.cename.val = fullname
endmethod
define
method .apply()
!name = !this.cename.val
!dist = !this.input.val
!elements = array()
if(!this.bran.val) then
var !elements append coll all bran
Within Volume $!name $!dist
endif
if(!this.equi.val) then
var !elements append coll all equip
Within Volume $!name $!dist
endif
var !names eval name for all from
!elements
!this.list.dtext = !names
do !element value !elements
add $!element
enddo
endmethod
define method .doselection()
!name = !this.list.selection()
$!name
endmethod
Setup Form
!!alphaview
title ' Input & Output'
view .Input ALPHA hei 10 width 40
channel REQUESTS
channel COMMANDS
Exit
button .apply 'Apply' at x0 ymax Apply
button .Dismiss 'Cancel' at Xmax form-size
Cancel
Exit
setup form !!poptest
view .vol volume width 50 hei 9
exit
path down
button .press 'swap popup' call
'!this.popswap()'
menu .popmenu
add 'hello' ' '
add 'world' ' '
exit
exit
define
method .popswap()
!this.vol.popup = !this.popmenu
endmethod