• Dear all PDMS Guru,

    I have found this macro at http://pdmsmacro.wordpress.com and I tried at spooler module. But it comes out a lot of error at every lines when I run the macro. At this bold and underline place, it comes out like (47,50)   CP: Meaningless symbol(s) in command line. Could all PDMS guru correct all these error as I only have a little knowledge for PML. Thanks in advance.

    -Counting the number of Welds


    Objective: to count the number of welds in the current element and display the file. Should be considered separately welded components and welds on the pipe and display the result in a file.



    The solution:
    -Remember the current item
    !BackCE = !!CE.Name

    Request file name to display
    !FileName = !!Alert.Input (‘Enter the file name for the output of information’, ‘d:\welds.txt’)

    !OutputA = OBJECT ARRAY ()
    !FinalOutput = OBJECT ARRAY ()
    !FinalOutput [1] = ‘count welded elements for’ + !!CE.Type + ” + !!CE.Name[/U]
    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 & |
  • --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
  • Dear prashantuparkar,

    Thank you so much for your help. Now It comes out successfully. Very good of you.





    [QUOTE=prashantuparkar;83497]--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

  • --Author:S.Lebedev
    --Date:August 2003
    --Purpose:get welds
     --get ce
     !backCE = !!CE.Name
     --requesr for a file name
     --!fileName = !!Alert.Input('Enter file name for weld output','d:\welds.txt')
     --!fileName = !!Alert.Input('Имя файла для отчета','c:\temp\welds.txt')
     
          VAR !pdmsuser EVAR PDMSUSER
          !firstPDMSUSER = !pdmsuser.Split()[1]
          !fileName = !firstPDMSUSER + '\arwelcalc.csv'
     !outputA = OBJECT ARRAY()
     !finalOutput = OBJECT ARRAY()
     
     --!finalOutput[1] = 'Welds calculation for ' + !!CE.Type + ' ' + !!CE.Name
     !finalOutput[1] = 'Weldings inside: ' + !!CE.Type + ' ' + !!CE.Name
     !finalOutput[2] = 'DN, mm;Quantity'
     !finalOutput[3] = 'Components welds'
       
     ---1.Block 1. Piping components separately from WELD excluding
     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]
       
       --get info of ppoint connection
       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 BWD - 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
     
     --enter second array and sort it
     !newOutputA = !outputA
     !newOutputA.SortUnique()
     
     --final array for output - find quantity fy bore
     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())
     !finalOutput.Append(!newOutputA[!x].Split(',')[1].Before('mm') + ';' + !howmuch.String())
     enddo
     
     --back to ce
     $!backCE
     ---2.Block 2. WELDS separate
       !outputA.Clear()  
       VAR !welds COLL ALL WELD FOR CE
     do !x from 1 to !welds.Size()
       $!welds[$!x]
       
       --collect info about ppoint of each WELD - only 2 points!
       VAR !p1con P1 CONN
       VAR !p1bor P1 BORE
          !outputA.Append(!p1bor + ',' + !p1con)
     
      enddo
     
     --clean second array
     !newOutputA.Clear()
     --enter second array and sort it unique
     !newOutputA = !outputA
     !newOutputA.SortUnique()
     
    !finalOutput.Append('Separate welds')
     --add data into final array
     do !x from 1 to !newOutputA.Size()
       !findwhat = !newOutputA[!x]
       !howmuch = !outputA.Find(!findwhat).Size()
       
     --!finalOutput.Append('WELDs separate on pipe Dn=' + !newOutputA[!x].Split(',')[1] + ', ' + !howmuch.String())
     !finalOutput.Append(!newOutputA[!x].Split(',')[1].Before('mm') + ';' + !howmuch.String())
     enddo
     
     $!backCE
     
     --output to filoe
     !FO = OBJECT FILE(!fileName)
     !FO.Writefile('OVERWRITE',!finalOutput)
       HANDLE (41,319)
       !!Alert.Message('Probably file is open. Close and run again')
         RETURN
    ENDHANDLE

    SYSCOM | $!fileName & |  
     


    [ATTACH=CONFIG]7233[/ATTACH]
  • Dear Mr. Prashantuparkar,
    I have just a question; Can we have in the final report the welds of the tees (pipe to pipe), in separate instance?
    You know the pipe to pipe weldings are little bit differents
    many thanks in advance and compliments for your jobs.
  • [QUOTE=me_hungry;84055]@RUAR
    And if we have huge BRAN with only ATTAs and we didnt use WELD. We should calculate every 6m welding also. Is it possible to add this welds to main part? ))
    Sure it is possible.
    Just get straigt piece of tube, divide its length by 6, round and add result to total number if you don't use WELD as items.
    But actually I believe you have to create welds otherwise your isometric might be look wrong not showing welds in right places which could lead to confusion on shop or site
    So it might be better to macro some PML that can create them automatically on each 6 meter lengthh
  • ATTA should not split TUBI on two TUBI if this is a piping support. So I don't understand your picture.
    For me it should be one long tubi and support on each predefined point of support like each 6 meters.
    But as far as length of tube piece is defined then we have to iclude WELD to split TUBI.
  • Be careful or you can get something i call "pipenstein" ;)
  • If atta has no atty set it will be treated as piping support anyway by isodraft. Actually there is no need to set spkbrk to solve this because as you see it can give you another problem. Although it might be that your designers think different but tubis  should be split by weld but not piping supports

    i think the problem with atta place in hierarchy is known and under development but until it solved it is better to reorder hierarchy probably with macro help