AVEVA Community
AVEVA Community
  • Site
  • User
  • Site
  • Search
  • User
PDMS/E3D Forum
  • AVEVA World
PDMS/E3D Forum
Macros & Tools total pipe length
  • Forums
  • Resources
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Replies 12 replies
  • Subscribers 14 subscribers
  • Views 248 views
  • Users 0 members are here
Options
  • Share
  • More
  • Cancel
Related

total pipe length

Pravin Parvekar
Pravin Parvekar over 5 years ago
 
  • Sign in to reply
  • Cancel
  • Pravin Parvekar
    Pravin Parvekar over 5 years ago
    hi,

    i want to calculate the total pipe length,

    if at branch level i give a command q clle then it gives us the length at branch level,

    if the pipe has n number of branches then the macro should go on every branch get the length and add it then reflect the total length of the pipe,

    can any one help me with it
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Venkata Rao Peta
    Venkata Rao Peta over 5 years ago

     total cutlength of pipe(totalling bran clle) 

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Pravin Parvekar
    Pravin Parvekar over 5 years ago
    thanks deva for providing the link,

    i initially tried to find it before posting didn't found it

    [COLOR="silver"]- - - Updated - - -[/COLOR]

    hi @deva

    define function !!collectAllFor (!types is STRING, !expr is STRING, !item is DBREF) is ARRAY
    Called from line 18 of Macro C:\Users\PravinNamedeo.Parvek\Desktop\first.pmlfrm
       !branches = !!collectallfor(|BRAN|,||,!pipe)

    this is some error that i am getting can you please help
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Venkata Rao Peta
    Venkata Rao Peta over 5 years ago
    [COLOR=silver][SIZE=1]
    [/SIZE][/COLOR]hi you are trying to convert into a function?

    directly copy this macro and create a file .pmlfnc

    no need of arguments?

    there is no diff between function and macro
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Pravin Parvekar
    Pravin Parvekar over 5 years ago
    var !pipes coll all pipe where matchwild(NAME of site,'*PIPE-JLE-ROS*') eq TRUE

    --!pipes = !!collectallfor(|PIPE|,||,!!ce)


    !output = array()


    do !pipe values !pipes


    !len = 0

    !branches = !!collectallfor(|BRAN|,||,!pipes)

    q var !branches

    return


    do !bran values !branches


    !len = !len + !bran.cllen


    enddo


    !output.append(!pipe.name & | Length: | & !len )


    enddo


    q var !output

    i want this as a report in excel

    [COLOR="silver"]- - - Updated - - -[/COLOR]

    [COLOR=#333333]q var !branches[/COLOR]

    [COLOR=#333333]return

    this is to be deleted a just doing trials on it [/COLOR]
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Venkata Rao Peta
    Venkata Rao Peta over 5 years ago
    .csv it will generate not .xls or .xlsx

    if you want excel file use grid function, don't know you are using E3D or PDMS.

    !pipes = !!collectallfor(|PIPE|,||,!!ce)
    !output = array()
    do !pipe values !pipes
    !len = 0
    !branches = !!collectallfor(|BRAN|,||,!pipe)
    do !bran values !branches
    !len = !len + !bran.cllen
    enddo
    !output.append(!pipe.name & | Length: | & !len )
    enddo
    !file = object file(|%PDMSUSER%\length.csv|)
    !file.writefile(|OVERWRITE|,!output)
    !file.close()
    syscom 'start excel.exe $!file&'
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Pravin Parvekar
    Pravin Parvekar over 5 years ago
    thanks for the help

    [COLOR=#333333]!pipes = !!collectallfor(|PIPE|,||,!!ce) is from pml2

    [/COLOR]which i am not used to

    so i converted that into pm1 format

    [COLOR=#333333]var !pipes coll all pipe where matchwild(NAME of site,'*PIPE-JLE-ROS*') eq TRUE

    [/COLOR]and then worked on it

    but got the result as needed

    thanks again for your help

    but can you write the same pml1 in pml2 with matchwild where to place and how to use
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Venkata Rao Peta
    Venkata Rao Peta over 5 years ago
    !pipes = !!COLLECTALLFOR('PIPE',|MATCHWILD(ATTRIB NAME OF SITE,'*PIPE-JLE-ROS*')|,!!CE)
    Q VAR !pipes

    !pipes = !!COLLECTALLFOR('PIPE',|MATCHWILD(ATTRIB NAME OF OWN OF OWN,'*PIPE-JLE-ROS*')|,!!CE)
    Q VAR !pipes
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • me_hungry
    me_hungry over 5 years ago
    @deva
    By the way MATCHWILD can be reduced to MATCH and !!CE to CE
    [COLOR=#333333]!!COLLECTALLFOR('PIPE',|MATCH(ATTRIB NAME OF SITE,'*PIPE-JLE-ROS*')|,CE)[/COLOR]

    :cupcake:
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Venkata Rao Peta
    Venkata Rao Peta over 5 years ago
    [QUOTE=me_hungry;115442]@deva
    By the way MATCHWILD can be reduced to MATCH
    :cupcake:

    Thank you me_hungry
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
>