No. of sheets report in isometric

 
Parents
  •  

    https://aveva.dev-verintcommunity.com/cfs-file/__key/communityserver-discussions-components-files/1643/303108aphPipeIsometric.pmlmac

  • hI friend the link is not available can you share it again thank you

  • --
    -- File:    aphPipeIsometric.pmlmac
    -- Author:  Aurelio Peros Hinampas
    -- Created: September 15, 2020
    -- Email:   hinrey12@gmail.com
    -- Module:  Design / Isodraft
    --
    -- Description: Macro to extract piping isometric and get the number of isometric drawings (no. of sheets).
    --            : Rename output drawings (DXF, PDF, PLT) to the desired naming format - Strip out file auto sheet number -001, -002 & so on..
    --            : This macro will extract Isometric for All PIPE within CE.
    --
    --     Callout: Drag & Drop to your command window or use the run macro method $M file.
    --
    
    
    -- Collect All Pipes within CE
    var !allPipes collect all (PIPE) for CE
    
    if (!allPipes.size().eq(0)) then
      return error 1 'No Pipe to be process, CE & Below does not have any PIPE.'
    endif
    
    !currProject = CURRENT PROJECT
    !projectCode = !currProject.code()
    
    -- Replace path of the isometric option file as with your requirements
    !isdOptFile  = object FILE(!!evar('$!<projectCode>ISO') & '\STD\previewisostd.txt')
    
    if (!isdOptFile.exists().not()) then
      -- Project option file is not define, look for the Aveva default Iso option file.
      !isdOptFile = object FILE(!!evar('PDMSDFLTS') & '\STD\previewisostd.txt')
    endif
    
    if (!!module().appkey.eq('des')) then
      ISODRAFTMODE
    endif
    
    -- Loop through to !allPipes and Generate Iso
    do !pipeRefe values !allPipes
      -- Set CE to PIPE
      $!pipeRefe
      
      $M "$!isdOptFile"
      handle any
        if (!!module().appkey.eq('des')) then
          EXIT
        endif
        return error 1 '$!!error.text'
      endhandle
    
      File SET PDF NoView Nocomp BW Bindpages
      
      DETAIL CE
      handle any
        -- Handles any failed iso extraction
        $P $!!<ce.name> - $!!error.text
      endhandle
      
      -- Get the list of extracted drawings
      var !isoSheetCount ISODRAW NUMBER
      handle any
        !isoSheetCount = '0'
      endhandle
      
      do !plot to !isoSheetCount.real()
        var !plotFile ISODRAW PLOTFILE $!<plot> FILENAME
        var !pipeName ISODRAW PLOTFILE $!<plot> DRAWING 1 TITLE
        var !sheetNum ISODRAW PLOTFILE $!<plot> DRAWING 1 SHEET
        
        -- Output Filename as per PIPE name
        !outFileName = !pipeName.replace(|"|, '').replace('/', '').replace('\', '')
        
        -- 2-digits sheet numbering format
        if (!sheetNum.real().lt(10)) then
          !sheetSeq = '-0' & !sheetNum
        else
          !sheetSeq = '-' & !sheetNum
        endif
        
        !fileTypes = split('dxf,hit,pdf,plt', ',')
        
        do !fileType values !fileTypes
          !outPlotFile = object FILE(!plotFile.after('/') & '.$!<fileType>')
          !autoSheetNo = !outPlotFile.entry().before('.$!<fileType>').split('-').last()
          
          -- -- Output New Filename as per PIPE name
          -- !newFileName = object FILE(!outPlotFile.directory() & '\' & !outFileName & !sheetSeq & '.$!<fileType>')
          
          -- Strip out file auto sheet number 001, 002 & so on
          !newFileName = object FILE(!outPlotFile.directory() & '\' & !outPlotFile.entry().before('-$!<autoSheetNo>') & '.$!<fileType>')
          
          if (!newFileName.exists()) then
            -- Delete previous filename if does exists
            !newFileName.deletefile()
            handle any
              $P Unable to delete $!newFileName - $!!error.text
            endhandle
          endif
          
          if (!outPlotFile.exists()) then
            -- Copy output drawing and rename to the new filename then delete after
            !outPlotFile.copy(!newFileName)
            PAUSE 1
            !outPlotFile.deletefile()
            handle any
              -- Unable to delete file, maybe file is currently used as isometric preview
            endhandle
          endif
          -- Plot file without file extension (*.*)
          !pltFileNoExt = object FILE(!plotFile.after('/'))
          if (!pltFileNoExt.exists()) then
            !pltFileNoExt.deletefile()
            handle any
              $P Unable to delete $!pltFileNoExt - $!!error.text
            endhandle
          endif
        enddo
      enddo
    enddo
    
    if (!!module().appkey.eq('des')) then
      EXIT
    endif
    
    

    Please see the attached requested file for the macro to extract piping isometrics at CE Level and will strip out the file auto sheet number -001, -002 & so on.

Reply Children
No Data