Parents
  • --Remember the current item
    !BackCE = !!CE.Name

    --Request file name to display
    !FileName = !!Alert.Input ('Enter the file name for the output of information', 'c:\temp\welds.txt')

    !OutputA = OBJECT ARRAY ()
    !FinalOutput = OBJECT ARRAY ()
    !FinalOutput[1] = 'count welded elements for' + !!CE.Type + ' ' + !!CE.Name
    --1.Blok-1. Piping components separately from WELD
    --Collect all piping components, eliminating welds
    VAR !Branmem COLL ALL BRAN MEM WITH (TYPE NEQ 'WELD' AND TYPE NEQ 'TUBI') FOR CE
    do !x from 1 to!branmem.Size ()
     $!Branmem[$!X]

     --Collect information about the connection points of each component
     VAR !P1con P1 CONN
     VAR !P1bor P1 BORE
     VAR !P2con P2 CONN
     VAR !P2bor P2 BORE
     if (!!Ce.Type EQ 'TEE' OR !!CE.Type EQ 'OLET') then
       VAR !P3con P3 CONN
       VAR !P3bor P3 BORE
     else
       !P3con = 'NULL'
       !P3bor = 'NULL'
     endif
     if (!!Ce.Type EQ 'CROS') then
       VAR !P4con P3 CONN
       VAR !P4bor P3 BORE
     else
       !P4con = 'NULL'
       !P4bor = 'NULL'
     endif

     --If welding  add
     if (!p1con EQ 'BWD') then
       !OutputA.Append (!P1bor + ',' + !P1con)
     endif
     if (!p2con EQ 'BWD') then
       !OutputA.Append (!P2bor + ',' + !P2con)
     endif
     if (!p3con EQ 'BWD') then
       !OutputA.Append (!P3bor + ',' + !P3con)
     endif
     if (!p4con EQ 'BWD') then
       !OutputA.Append (!P4bor + ',' + !P4con)
     endif

    enddo

    --Introduce a second array and sort it unique
    !NewOutputA = !OutputA
    !NewOutputA.SortUnique ()

    --Final array output – looking for the number of diameters
    do !x from 1 to !newOutputA.Size ()
      !Findwhat = !NewOutputA[!X]
      !Howmuch = !OutputA.Find(!Findwhat).Size ()
      !FinalOutput.Append('component DN =' + !NewOutputA[!X].Split (',')[1] + ', welds =' + !Howmuch.String ())
    enddo

    --Back to the element
    $!BackCE
    --2.Blok-2. Separately welds WELD
    --Clear the previous auxiliary array
    !OutputA.Clear ()
    VAR !Welds COLL ALL WELD FOR CE
    do !x from 1 to !welds.Size ()
      $!Welds[$!X]

      --Collect information about the connection points of each WELD only two points!
      VAR !P1con P1 CONN
      VAR !P1bor P1 BORE

      !OutputA.Append(!P1bor + ',' + !P1con)

    enddo

    --Clear the second-unique array
    !NewOutputA.Clear ()
    --Introduce array and sort it unique
    !NewOutputA = !OutputA
    !NewOutputA.SortUnique()

    --Add the data to the final array are looking for the number of diameters
    do !x from 1 to !newOutputA.Size ()
      !Findwhat = !NewOutputA[!X]
      !Howmuch = !OutputA.Find(!Findwhat).Size()
      !FinalOutput.Append('separate welds on pipe DN = ' + !NewOutputA[!X].Split(',')[1] + ',' + !Howmuch.String ())
    enddo

    --Output to file
    !FO = OBJECT FILE(!FileName)
    !FO.Writefile('OVERWRITE', !FinalOutput)
    SYSCOM | EXPLORER $!FileName & |



    ----------------------------------------------------------

    Result

    count welded elements forPIPE /150-A-3
    component DN =100, welds =5
    component DN =150, welds =5
    component DN =80, welds =1
Reply
  • --Remember the current item
    !BackCE = !!CE.Name

    --Request file name to display
    !FileName = !!Alert.Input ('Enter the file name for the output of information', 'c:\temp\welds.txt')

    !OutputA = OBJECT ARRAY ()
    !FinalOutput = OBJECT ARRAY ()
    !FinalOutput[1] = 'count welded elements for' + !!CE.Type + ' ' + !!CE.Name
    --1.Blok-1. Piping components separately from WELD
    --Collect all piping components, eliminating welds
    VAR !Branmem COLL ALL BRAN MEM WITH (TYPE NEQ 'WELD' AND TYPE NEQ 'TUBI') FOR CE
    do !x from 1 to!branmem.Size ()
     $!Branmem[$!X]

     --Collect information about the connection points of each component
     VAR !P1con P1 CONN
     VAR !P1bor P1 BORE
     VAR !P2con P2 CONN
     VAR !P2bor P2 BORE
     if (!!Ce.Type EQ 'TEE' OR !!CE.Type EQ 'OLET') then
       VAR !P3con P3 CONN
       VAR !P3bor P3 BORE
     else
       !P3con = 'NULL'
       !P3bor = 'NULL'
     endif
     if (!!Ce.Type EQ 'CROS') then
       VAR !P4con P3 CONN
       VAR !P4bor P3 BORE
     else
       !P4con = 'NULL'
       !P4bor = 'NULL'
     endif

     --If welding  add
     if (!p1con EQ 'BWD') then
       !OutputA.Append (!P1bor + ',' + !P1con)
     endif
     if (!p2con EQ 'BWD') then
       !OutputA.Append (!P2bor + ',' + !P2con)
     endif
     if (!p3con EQ 'BWD') then
       !OutputA.Append (!P3bor + ',' + !P3con)
     endif
     if (!p4con EQ 'BWD') then
       !OutputA.Append (!P4bor + ',' + !P4con)
     endif

    enddo

    --Introduce a second array and sort it unique
    !NewOutputA = !OutputA
    !NewOutputA.SortUnique ()

    --Final array output – looking for the number of diameters
    do !x from 1 to !newOutputA.Size ()
      !Findwhat = !NewOutputA[!X]
      !Howmuch = !OutputA.Find(!Findwhat).Size ()
      !FinalOutput.Append('component DN =' + !NewOutputA[!X].Split (',')[1] + ', welds =' + !Howmuch.String ())
    enddo

    --Back to the element
    $!BackCE
    --2.Blok-2. Separately welds WELD
    --Clear the previous auxiliary array
    !OutputA.Clear ()
    VAR !Welds COLL ALL WELD FOR CE
    do !x from 1 to !welds.Size ()
      $!Welds[$!X]

      --Collect information about the connection points of each WELD only two points!
      VAR !P1con P1 CONN
      VAR !P1bor P1 BORE

      !OutputA.Append(!P1bor + ',' + !P1con)

    enddo

    --Clear the second-unique array
    !NewOutputA.Clear ()
    --Introduce array and sort it unique
    !NewOutputA = !OutputA
    !NewOutputA.SortUnique()

    --Add the data to the final array are looking for the number of diameters
    do !x from 1 to !newOutputA.Size ()
      !Findwhat = !NewOutputA[!X]
      !Howmuch = !OutputA.Find(!Findwhat).Size()
      !FinalOutput.Append('separate welds on pipe DN = ' + !NewOutputA[!X].Split(',')[1] + ',' + !Howmuch.String ())
    enddo

    --Output to file
    !FO = OBJECT FILE(!FileName)
    !FO.Writefile('OVERWRITE', !FinalOutput)
    SYSCOM | EXPLORER $!FileName & |



    ----------------------------------------------------------

    Result

    count welded elements forPIPE /150-A-3
    component DN =100, welds =5
    component DN =150, welds =5
    component DN =80, welds =1
Children
No Data