10/30/2018 AVEVA. PML BASICS.
Read file | 3D Software Customization
3D Software Customization
ADMIN, PDMS, PML, TUTORIAL
AVEVA. PML [Link] file
JUNE 1, 2017 | ME_HUNGRY | LEAVE A COMMENT
Today I will briefly explain the basic principles of working with file, using PML code.
The main tasks for PML Developers, when they work with files are:
-Process directories and filter certain file extensions
-Open and read file(line by line or fully)
-Search through file and process data
-Add info to file or overwrite its content
Here are some techniques for working with files.
Open certain files with name ‘[Link]’, read line by line to Pdms console window and output line content, if line content matches
string:
Method 1 (For files with lines number less then 10 000)
[Link] 1/3
10/30/2018 AVEVA. PML [Link] file | 3D Software Customization
–create string variable with file path
!fileName = ‘C:\[Link]’
–create object variable of type FILE
!fileObj = OBJECT FILE(!fileName)
–create array variable and fill all content of that file into it using method ReadFile
!fileContent = !fi[Link]file()
–Loop through the array of file content using line numbers variable !x
do !x from 1 to !fi[Link]()
–Check line content for matching of criteria, should contain ‘*Valve*’
if (!fileContent[!x].Matchwild(‘*Valve*’)) then
–if matches print line content in Pdms\E3D command line
$P Line number is $!x and the value is $!fileContent[$!x]
endif
enddo
Method 2 (for files with line number greater then 10 000)
–create string variable with file path
!fileName = ‘C:\[Link]’
–create object variable of type FILE
!oFileName= OBJECT FILE(!fileName)
–Open file for read

–Loop through the lines of file
do !recordInd
–Save the value of line
!line = ![Link]()
–Check if it is exists, if not stop reading
if ![Link]() then
–Check line content for matching of criteria, should contain ‘*Valve*’
if()then
–if matches print line content in Pdms\E3D command line
$P Line number is $!recordInd and the value is $!line
endif
else
break
endif
[Link] 2/3
10/30/2018 AVEVA. PML [Link] file | 3D Software Customization
enddo
–Close file
![Link]()
Read more : pmlinpdms (h p://[Link])
Advertisements
REPORT THIS AD
REPORT THIS AD
This site uses Akismet to reduce spam. Learn how your comment data is processed.
[Link] 3/3