Exporting Dump Attributes Macro file shared...

 
Parents
  • Hi Russel, I know this post is a bit old. your macro is useful, but Have you ever thought about how to export pipe (TUBI) attributes?

    I tried do do that  my self but the result it's not encouraging.

    The problem is that the TUBE doesn't start any time as NEW TUBE 1 when the branch change.

    Please, could you have a look to help me?

    Thanx in advance.

    Below my modification

    $:debug$:
    $* modificato 12-04-2022
    $* Initialise Variables
    var !FILE |C:\Temp\DesReviewUda.txt|
    var !DILM |:=|
    var !SEPR |&end&|
    var !IGNORE |,NAME,OWNER,|
    var !AIGNORE |,unset,=0/0,nulref,|
    var !ODEPTH DDEPTH
    var !PDEPTH -99
    var !REFE REFE
    var !count 1

    $* Open file
    openfile /$!FILE write !FUNIT
    handle ANY
    openfile /$!FILE overwrite !FUNIT
    endhandle

    $* Write Header
    var !DATE clock date
    var !TIME clock time
    writefile $!FUNIT |CADC_Attributes_File v1.0 , start: NEW , end: END , name_end: $!DILM , sep: $!SEPR|
    writefile $!FUNIT |NEW Header Information|

    var !DPRT compose | Source$!DILM PDMS Data $!SEPR Date$!DILM $!DATE$n $!SEPR Time$!DILM $!TIME|
    writefile $!FUNIT |$!DPRT[1]|
    var !MDB MDB
    var !PROJECT PROJECT CODE
    var !NAME (FULLNAME)
    var !DPRT compose | Project$!DILM $!PROJECT $!SEPR MDB$!DILM $!MDB $!SEPR Element$!DILM $!NAME|
    writefile $!FUNIT |$!DPRT[1]|
    writefile $!FUNIT |END|

    !list = 'SITE ZONE PIPE BRAN ELBOW TEE FLAN$
    OLET INST VALVE PCOMP GASK TUBI REDU$
    CAP COUP PLUG UNION ATTA FTUBE FILT$
    STRU FRMW SCTN'

    $* Get element

    Var !COLL collect all ($!list) with (name of zone eq'/PIPES')

    $* Loop through the list of elements
    do !INDX indices !COLL

    $!COLL[$!INDX]

    $* Hierarchy level
    var !DEPTH DDEPTH
    var !TAB $!DEPTH * 2 - $!ODEPTH * 2
    var !ITAB $!TAB + 2

    $* End(s)
    if($!DEPTH eq $!PDEPTH and $!PDEPTH neq -99) then
    var !DPRT compose space $!TAB |END|
    writefile $!FUNIT |$!DPRT[1]|
    elseif ($!DEPTH lt $!PDEPTH) then

    do !INDXA from $!PDEPTH to $!DEPTH by -1
    var !DPRT compose space $!INDXA |END|
    writefile $!FUNIT |$!DPRT[1]|
    enddo
    endif

    var !PDEPTH $!DEPTH

    $* Attributes of element  (this is new)
    var !ATTL delete
    IF (TYPE eq |TUBI|) THEN
    var !ATTL append |Itlength|
    var !ATTL append |Lbore|
    var !ATTL append |DTXR|
    ELSE
    var !ATTL attlist
    ENDIF

    -- initialise progress and interrupt system
    !progress = 0
    !progStep = 5 $* % progress report step
    $*!this.enableInterrupt()

    $*onerror golabel /interrupted

    $* Check it item is owned by a branch
    if(TYPE neq |WORL|) then
    if(TYPE of OWNER eq |BRAN| and NOT BADREF(SPREF)) then
    if (TYPE neq |TUBI|) then
    var !ATTL append |APOS|
    var !ATTL append |LPOS|
    var !ATTL append |DTXR|
    var !ATTL append |CWEI OF CMPREF OF SPREF|
    var !ATTL append |AFTER(NAME OF PSPEC OF PIPE, '/')|
    $* var !ATTL append |:PNUM of spco of spref|
    $* var !ATTL append |:ENI_CODE of spco of spref|
    var !ATTL append |P1BOR|
    var !ATTL append |P2BOR|
    if(type eq |TEE|) or (type eq|OLET|)then
    var !ATTL append |P3BOR|
    endif
    endif
    endif
    endif

    $* Get name
    var !NAME (FULLNAME)
    if (type eq |BRANCH|)then
    $!count 1
    endif
    if (TYPE eq |TUBI|)then
    var !NAME REPLACE (|$!NAME|,|ileave tube of |,||)
    if match(|$!NAME|,|of |)gt 0 then
    var !NAME AFTER(|$!NAME|,|of |)
    endif
    var !DPRT compose space $!TAB |NEW TUBE $!count of $!NAME|

    var !count $!count + 1
    else
    var !DPRT compose space $!TAB |NEW $!NAME|
    endif
    writefile $!FUNIT |$!DPRT[1]|
    var !ASIZE (arraywidth(!ATTL)) + 3

    $* Loop through attribute array
    do !ATTR values !ATTL

    skip if(match(|$!IGNORE|,|,$!ATTR$n,|) gt 0)
    var !ATTRIB (ATTRIB $!ATTR)
    handle ANY

    var !ATTRIB $!ATTR
    $* replased text to have the best readible in Navis (this is new)
    endhandle
    var !ATTRIB (trim(|$!ATTRIB|))
    if(|$!ATTRIB| neq || and match(|$!AIGNORE|,|,$!ATTRIB$n,|) eq 0) then
    var !new REPLACE (|$!ATTR$n|,|Itlength|,|Lenght|)
    var !new REPLACE (|$!new$n|,|CWEI OF CMPREF OF SPREF|,|weight|)
    var !new REPLACE (|$!new$n|,|DTXR|,|Descr.|)
    var !new REPLACE (|$!new$n|,|P2BOR|,|Red. Size|)
    var !new REPLACE (|$!new$n|,|P3BOR|,|Branch Conn. Size|)
    var !new REPLACE (|$!new$n|,|AFTER(NAME OF PSPEC OF PIPE, '/')|,|Pipe Spec|)
    var !new REPLACE (|$!new$n|,|:ENI_CODE of spco of spref|,|ENI Code|)
    var !new REPLACE (|$!new$n|,|:PNUM of spco of spref|,|PUMA Code|)
    var !new REPLACE (|$!new$n|,|P1BOR|,|Main Size|)
    var !new REPLACE (|$!new$n|,|Lbore|,|Pipe Size|)
    if(|$!new$n| eq |Lenght|)then
    var !ATTRIB $!ATTRIB / 1000
    var !ATTRIB STRING ( $!ATTRIB, 'D2' )
    var !ATTRIB |$!ATTRIB Mt.|
    endif



    var !DPRT compose space $!ITAB |$!new$!DILM| width $!ASIZE R space 2 |$!ATTRIB|

    !size = !COLL.size()
    -- Update progress if required
    !percentDone = int( (!INDX * 100 ) / $!size )
    --$P index = $!indx, %done is $!percentDone, step $!progStep%
    if( !percentDone - !progress ge !progStep ) then
    !progress = !percentDone
    --$P $!progress%
    !!fmsys.setProgress( !progress )
    endif


    writefile $!FUNIT |$!DPRT[1]|
    endif
    enddo

    enddo

    if($!DEPTH gt $!ODEPTH) then
    do !INDXA from $!DEPTH to $!ODEPTH by -1
    var !TAB $!INDXA * 2 - $!ODEPTH * 2
    var !DPRT compose space $!TAB |END|
    writefile $!FUNIT |$!DPRT[1]|
    enddo
    endif

    $!REFE

    closefile $!FUNIT


    $* Hide the from
    $* hide _CDXATTDUMP
    !!fmsys.setProgress( 0 )
    $P finish
    return $* >>>>>>>>>> End of Code DesignReview <<<<<<<<<<
    $.

  • Hey Walmic have you got any solution for this? if yes please share.

  • Dear Harender,

    I didn't have a look anymore, I'm involved in another tasks right-now. I'm planed to check it, next month. Regards

Reply Children
No Data