Presenting "Streamlining Batch Link" at XCON 2019, Bluebeam annual user conference

I was lucky enough to be selected as a presenter at Bluebeam's annual user conference, XCON, in 2019.  My presentation was titled "Streamlining Batch Link" and described a way to take advantage of the way Batch Link works in Bluebeam Revu to greatly speed things up.  If you are not familiar with Batch Link, then I suggest you watch Bluebeam's video about it below, otherwise you can skip it.


In my presentation, I showed some screenshots of some scripts I used in Powershell.  I want to make those scripts available to everyone with this post.

You can download the presentation slide deck from this link, but most of the explanation was verbal so you will probably want to read the short synopsis below or watch the video on YouTube.  Most of the presentation is about exactly how to make the concept work.



If you are a text junky like me, here is the basic concept: You can use a 1-page blank pdf file to stand-in for a real document or drawing for the purposes of batch link.    The reason for doing this is to include that placeholder file in the Batch Link search path so that Revu does not spend time searching through its empty content but will allow it to be the destination of a link in another file.

Why would you want to do this?  Think about customer standards or project specifications.  These documents will typically not have links to design drawings, but lots of design drawings will have links to the customer standards or project specifications.  You can run batch link on the standards or specifications at the beginning of the project before the design drawings are done.  Later, when the design drawings are done, you can include placeholder files instead of the standards or specifications to greatly shorten the time it takes to run Batch Link on the design files.

After Batch Link is done processing the design files, you can overwrite the placeholders with the real standards and specifications and all the links will work perfectly.

make-empty-tree.ps1

This script is a variant of one posted by Adam Bertrand. This script will traverse a file tree of PDF files and create a duplicate file tree of blank PDFs.  The new files will have the same names and the same relative paths from the starting folder, but they will all be copies of a single blank page.  It is used when you want to run Batch Link on a subset of drawings or documents, but need the rest of the files to be present because they are the targets of links in the drawings with content.  The source is presented below:

## make-empty-tree.ps1 usage
# make-empty-tree source destination
#  source is the path to the source directory
#  destination is the path the destination directory
#
param ([Parameter(Mandatory)]$sourcedir, $destdir=$sourcedir+"-empty")

xcopy /e /t /i "$sourcedir" "$destdir"
  Get-ChildItem "$sourcedir" -Filter "*.pdf" -Recurse |  foreach {

  ## Remove the original  root folder

  $split = $_.Fullname  -split '\\'

  ## the destination file path assumes that the sourcedir is
  ## on the desktop, i.e. c:\username\Desktop
  ## if not, adjust the number 5 in the line below to account
  ## for more/fewer folders in the path.

  $DestFile =  $split[5..($split.Length - 1)] -join '\' 

  ## Build the new  destination file path

  $DestFile =  "$destdir\$DestFile"


  ## Copy-Item won't  create the folder structure so we have to 

  ## create a blank file  and then overwrite it

  echo $DestFile

  Copy-Item -Path .\empty.pdf -Destination $DestFile
}

makeIndexAndRelinkList.ps1

At the end of my presentation, I mentioned that it would be useful to have a link map for all the files to know all the files that need to be included when running Batch Link because drawing(s) were revised. The script below will convert all the PDF text files in the file tree into text files, parse them to make an index of all the references, then read a file called newfiles.txt and generate a file called relink-list.csv that lists all the files that need to be relinked based on the contents of newlist.txt.  The source is shown below.  Please note that the patterns are regular expressions that describe the numbering convention of the documents in my package.  You will need to adjust them to match your file naming convention.

## Convert PDF to text so we can make an index.  Depends on pdftotext from XPDF or Poppler

echo "Converting PDF files to text files. This may take a long time..."
$sourcedir = '.\'

  Get-ChildItem "$sourcedir" -Filter "*.pdf" -Recurse |  foreach {

  ## convert to text

  pdftotext -q -nopgbrk $_.Fullname
}

echo "Text files created."

## Loop through all the text files and normalize the drawing references

echo "Normalizing drawing references in text files. This may take a long time..."

Get-ChildItem $sourcedir -Filter "*.txt" -Recurse | foreach { 
   $filename = $_.Fullname
  (Get-Content $filename) -replace "(..-\d{6}).(\d{3})",'$1-$2' `
  -replace "(..-\d{6}) ?SHT\.? ?(\d{3})",'$1-$2' `
  -replace "(..-\d{6})(\d{3})",'$1-$2' `
  -replace "(..-\d{6})([^-.0-9])",'$1-001$2' | Set-Content $filename }

echo "Drawing references normalized."

## Build index of references from text files
echo "Building index of references from text files..."

Get-ChildItem $sourcedir -Filter "*.txt" -Recurse | foreach {
 $filename = $_.Fullname
 select-string -Path $filename -Pattern '..-\d{6}([-.]?\d{3})?' -AllMatches | % { $_.Matches } | % { $_.Value + "," + (Split-Path -Path $filename -leaf) + "," + (Split-Path -Path $filename -Parent)} | Sort-Object -Unique >> text.csv }

echo "Index created."

## build relink-list from newfiles list
echo "Building re-link list from newfiles list..."

Get-Content -Path './newfiles.txt' | foreach {
(select-string -Path './text.csv' -Raw -Pattern "$_") -replace "(^.*),(.*),/Volumes/SanDisk SSD/15 - PP Package .Final./01-USC-GCPs and WHC/Volume II Preliminary Design Documents/(.*$)",'$3/$2'  | Sort-Object -Unique } > relink-list.csv

echo "Re-link list created."
## done

echo "Program completed."

Comments

Popular posts from this blog

iChat IRC transport with OpenFire and Kraken

Save kerberos password in keychain for use with kinit on MacOS (was OS X) for use with network drives

Recording the iPhone screen and Mac screen at the same time in one video