четверг, 3 января 2019 г.

Implant text (pml, c#) part 2


In previous post I create NetHelper and get as result PmlNetHelper.dll
Now I need use it in pml language.
Go! Step by step.

1. Copy PmlNetHelper.dll to program folder.
2. Create text file implanttext.pmlfnc and put print next code

define function !!implanttext(!text is string, !addLine is string, !position is real) is string
    using namespace 'PmlNetHelper'
    !o = object StringHelper()
    return !o.ImplantText(!text, !addLine, !position )
endfunction

3.Create folder MyLib inside PMLLIB folder in program directory. And create there folders "common\functions"
4. Save implanttext.pmlfnc file there.
5. In PDMS/E3D in command line print: pml rehash all
For example let create simple report.

!outreport = object array()
!pipes = !!collectallfor('pipe', '', !!ce )
!names = !pipes.Evaluate(object Block(|!pipes[!evalIndex].Name|))
!specs = !pipes.Evaluate(object Block(|!pipes[!evalIndex].Pspe.Name|))

!outreport.Append(!!implanttext('NAME OF PIPE', 'SPEC', 30))
do !i index !names
    !line = !!implanttext(!names[!i], !specs[!i], 30)
    !outreport.Append(!line )
enddo

!file = object File(!!evar('pdmsuser') & '\report.txt')
!file.WriteFile('over', !outreport)
syscom ' "$!file" & '


 6. Paste as macro and voila





 P.S. because there was a pause in the publication the original class was changed. Now it is called PmlNetHelper. See in sources.

 fix in bold text  (05/01/2019 )

Комментариев нет:

Отправить комментарий

comments?