Print to combined PDF based on specific string of text

I’m attempting to create a script that will print a view set within Revit to a single PDF, but the ordering of those sheets based on a string of text contained within the filename.

So far I’m having no issue in the creation of the PDFs, but the sorting is where I’m having issues.

Within my Revit file I have sheets that are like this:
S-1001
S-1002
S-5003
S-3004

What I would like to do is have the final PDF be combined based on the last three digits. Is this possible with Dynamo?

Hi @eseanq,

You can find the MergePdfs node in Genius Loci package version 2018.12.10 (and previous versions)

Is it possible to have them combined like the example? Where it would sort/combine them based on the last three digits?

You could try sorting the files based on the substring you’re after, and see if it works.

Happen to have an example of what that would look like? I came across this: http://dynamobim.org/forums/topic/sort-list-by-part-of-sublist-value/ but I’m having trouble trying to switch it from a list based on a Code block to a list based on Directory Contents that are *.pdf.

another option…
do you by any chance have a list order somewhere else? it could be an excel sheet. If so, then use the excel list as the filter.

What I did to solve this problem is use a script that renames the files in order of their sheet number and with an extra number like 100, 101, 102 etc. I do this when they are plotted and in one folder so the computer puts them in the right order. Then I combine in Acrobat. It’s an extra step but works perfectly fine.

I would do as @d.jansenMM3LJ, merging inside dynamo for files there is printed seams odd…
If I should do it, then I would do everything from inside Revit (using Dynamo) and make a printset, then I would print this directly to a merged pdf file. In other words do everything in one process. Like the example I have shown at my blog.

@erfajo, Within my Revit project file I do have a schedule that sorts the drawings based on a parameter within the file.

In response to your other post, Id prefer to be able to do it all from inside Revit/Dynamo. The sorting, printing, combining, everything.

@d.jansenMM3LJ, is that script sorting them based on the starting number or trailing numbers? In my example in the first post, the “true” sheet number is the last three digits. The starting digit indicates what type of drawing it is (Plans, Elevations, Sections, etc.). If I combine in Adobe, just using their combine tool, bookmarks can be automatically created based on the original filename.If I throw in a few extra digits just for the sorting, those would also get tacked on to the bookmark name.

I don’t know exactly what you mean but this is the script.

Then build a graph for doing it all in one process… You should be able to use the graph i showed in the blog as a starting point. you can get the dynamo file for both 1.3 and 2.0 versions at my github samples

1 Like