Recently when I was scouring the Dynamo blog for a question that would be remotely useful I came across a request that I could sink my teeth into pretty quickly. One of the users was asking about the new Revit 2020 functionality regarding the ability to import PDF files. Now, as much as we appreciate this newfound functionality, there are things that are missing about it. One such thing is the fact that it doesn’t allow to import multiple pages at the same time. Yes, PDFs might have multiple pages. Who would have thought? Anyways, the process of importing them one by one is exactly the kind of stuff that we should not be doing. Below is a quick script for Dynamo that will allow you to import multiple pages from a single PDF, and then place them in a view.
First importing. It’s rather simple process:
What I did here, was add a node called PDF.PageCount to make the process of getting number of pages from a PDF document a little easier. Then we are creating something called Image Type Options. This tells Revit which page we want to import, and at what resolution. The default resolution is 72dpi. This usually matters most for how images embedded inside of the PDF are processed, or rather to what quality.
In the case above we want to process all pages in that PDF, so we simply make a list from 1 to X which creates a list [1,2,3…] and that returns multiple Image Type Options. One for each page. Then we simply feed that into the ImageTypes.Create node, and out comes imported PDF pages.
For the sake of the exercise here, I am importing a few pages from my old BILT presentation I did when I was at HOK. It was about Mission Control. Anyways, next up is placing the actual images/pdfs in a view:
For this one I am creating something called Image Placement Options. This is a class that tells Revit where to place the image, and what to use as a reference. So Location input is an actual point in a View, while Box Placement Type is a reference of that point to the PDF page. For example in the above image I am using Center, which means center of the PDF page will be placed at the specified point. That’s why if I am trying to place them in a single column one above another, I am offsetting the Y location of the point, by what I am guessing is the page height. I think I am in a file that has units set to mm, so my offset is 1500. The result is something like this:
That’s it! There is nothing else to it, it’s not magical, but just makes it a little easier for placing multi page documents. This can be useful if you got a spec written in a Word Document, exported to PDF, and then want to place it on a sheet. Just use the above method to get it imported into a Drafting View, layout the pages in a neat row, and add to Sheet. Nice and easy.
This solution required a few custom nodes. These will be published to archi-lab.net package under the following version:
As always you can download the sample file by becoming a Patron on the Patreon page for archi-lab.net. Please see the link below.