printing PDFs w/ dynamo

image by archi-lab

Some time ago I have spotted this post by Sol Armor at DynamoBIM forum, asking about printing PDFs out of Dynamo and I was a little sad that we didn’t already have any tools for that. Recently (last Friday) I was also asked by my PA to print some stuff for him, and I was reminded just how limited current printing tools in Revit are. It’s not like I needed any more reasons to look at this issue, but also on Friday a colleague of mine told me they are “issuing a set” and are currently in a process of re-naming of hundreds of PDFs that were printed out of Revit. Why? Because per client wish/requirement they were obliged to name each PDF document with a Sheet Revision in its name…duh! Since every sheet was in a different revision state, we had a little pickle on our hands that couldn’t be solved without custom plug-in or x-amount of man hours. This is what I came up with in Dynamo instead:

So first thing that bothered me when I was printing, was that I couldn’t quickly print sheets that I needed at the moment and creating new sets every time I wanted to print but a new sheet was added to the set and I had to go back and edit the set that I created in a first place. It’s like my “100% CD” view set is good today, but tomorrow it sucks. So I though it would be way easier to use Dynamo to dynamically filter for sheets that I wanted, by any parameter – like Sheet Issue Date. So instead of relying on View Sets I can now dynamically create lists of sheets that I want to print.

Of course view sets are still a viable method of defining what sheets we want to print so I am still supporting that method. As a matter of time here’s how:

image01

This way I can use both ways of defining what sheets I want to print but the final input into the Print PDF node will have to be a list of Sheet View Elements. Speaking of Print PDF node, here’s how it is set up:

 

printPDF

Here’s the code for it:
  We already covered Views, so let’s look at Print Range. In order to use a list of views we have to set Print Range to Select. This aligns with the procedure that you would use while working in the UI. image03 I haven’t really tested other options like Current and Visible, but if someone gives them a try and they fail, let me know how they failed and i will try to fix it. Next thing up is a Combined File boolean input. If you set to to True the printout will be a single file, while if set to False you will print each sheet separately. Now, here’s an Adobe tip: Since I hate being prompted for a file name for every sheet, I guess others too, you can go to Start>Devices and Printers then Right Click on Adobe PDF (that’s the printer that I am using) to set Printer Preferences. Here’s what I set mine to: image04 Unchecking “View Adobe PDF Results” will make sure that Adobe doesn’t open the newly printed file. It should speed things up a bit. Also, unchecking “Ask to replace existing PDF file” will supress any warnings caused by already existing files in the destination folder and they will be overridden by default. Last bit is to set the “Adobe PDF Output Folder”, which is a folder that all PDFs will be printed regardless of your current destination folder setting in Revit. Since these settings take precedent over in Revit settings, get used to seeing all of your prints always get dropped to this folder. It’s not the end of the day, and sure as hell is a decent time saver for me when plotting multiple sheets to a single PDF each. Next is a Printer Name. For this exercise I was using a Adobe PDF printer, but I guess some people prefer to use Bluebeam PDF or PDF995 printers as well. I haven’t tested it with any other printer, but again, feel free to give it a whirl and let me know how it went. To obtain names of all locally installed printers I use a node called Local Printers Names which wouldn’t be possible without great help from Stack Overflow community. I am in all honesty admitting that this kind of use of ctypes library is not in my tool belt. Anyhow, I got some help on this one and its pretty amazing: image05 Next up are Print Settings. For now I was happy to just use one of the pre-defined user Print Settings, but in the future I will make a node where user can define its own settings. I guess ability to define your own settings will come super helpful when plotting PDFs to multiple sheet sizes. We could easily automate print setting assignment based on sheet size and make this tool even better. For now just pre-make one and use this node to select it: Edit 2015/08/08 :  Print Settings now accepts a single item and/or a list. What that means is you can plot (100) sheets and for each one you can define (100) different print settings. Of course this is just one step closer to what I was discussing above where the intent is to be able to plot different sheet sizes in one run. Now, you can. Just supply a Print Setting name for each sheet and they will all be plotted to that setting. So if we have a setting for each sheet size, then we can pair up sheets with proper print settings and problem solved. We no longer have to run multiple plots because we have multiple sheet size that get issued. Below are two examples for each case:  Untitled-1 Next input is a File Path. This is a weird input. You remember that few lines up I said that when we specify a Default Output Folder in Adobe PDF Printing Preferences, then it will override this setting. Yes, it will, but Revit API is still expecting you to set it to something, or you can expect an error. Hence, I am making it an input and you can set it to some random file name but make sure that it ends with a *.pdf format. image06 The final input is a Boolean toggle to make the script execute. I have started to put boolean toggles on most of my nodes, because I don’t want this node to print (it might take a while with a large set of sheets) every time I hit F5. Ok, at this moment we should have printed our drawing set and assuming they were individual sheets, they will all be named with the standard Revit naming convention: FileName – UserName – Sheet – SheetNumber – SheetName.pdf Of course this not the name that I want. If I am only interested in removing all of the stuff before Sheet Number and Name, then I am usually using a tool like Bulk Rename Utility. However, if my goal is to rename each sheet with a more customized name that for example would include a current Sheet Revision Number, then I can use another tool that I have developed for this workflow: image07   Here’s code that I used to create this node:

 

Rename Files is a node that will take a Directory Path input. It will then look for all files contained in that directory and rename only those files that in their full name have an “identifier”. An identifier is a string that is unique to that particular file name. In case of our sheets its usually a Sheet Number value. Since, Revit by default puts a Sheet Number into file name, then we can use that as an identifier to isolate and rename only sheets that contain our identifier.

I can obtain an identifier by extracting a Sheet Number value from each view that I extracted from a View Set:

image08

 

This brings us to another custom node added to archi-lab package: Get Built In Parameter. This is particularly useful when you are extracting Sheet Name and Number parameters, because since there exists multiple parameters in Revit API with the same name, the standard GetParameterByName node fails miserably to obtain the right one and often returns empty or null values. With this node you can get the BuiltIn SHEET_NUMBER or SHEET_NAME parameters and since its an unique name, then you can rest assured that you are getting the right value. Also, ParameterNames input can either be a list or a single string and will either return a list or a nested list.

Back to our Rename File node. Here we are getting a Sheet Number and since that’s a unique part of each file’s name we can use that to identify only files that we want to rename. Next input is a NewNames input. This has to be a matching length list of strings that we want to rename our files to with a proper *.pdf suffix (I usually have known file extensions turned on in my windows settings so I am required to add this to my file name).

image09

 

Ha! This is pretty sweet method to construct a new file name from random strings, and combination of sheet specific parameters. Now, this is pretty much the reason why I did this whole printing exercise in Dynamo, because I knew that I can create custom/sheet specific file names. Awesome!

String From List is a new archi-lab node that just joins all list items into a single string with a separator and then adds a suffix at the end (.pdf).

Once this is complete, we set the Boolean toggle to True for the Rename Files node, and watch our files get renamed. Pretty awesome stuff if you ask me.

image10

10.01.2015 Update 1:

I did make some changes to my package recently. One main change was replacing all Enum based nodes with Dynamo UI nodes and proper drop-downs. Now, I did make a small mistake with those that resulted with some broken functionality. It has just been fixed. Apologies to all users that were posting comments below. Please download latest archi-lab_Grimshaw package. Thank you.

Support archi-lab on Patreon!

167 Comments

  1. Sol Amour says:

    Genius. Many thanks Konrad!

  2. Vincent says:

    Hi,

    I have tested theses nodes, but i can not make them work…
    Could you help me?

    PS: I use REVIT in french.

    thanks.

    Attachment:  Capture.png

    • Vincent,

      Everything looks good on your image except that it doesn’t work. Can you do me a favor and double click the Print PDF node. That will take you inside that node. Copy a Python node that is inside and exit that node. Paste it on your main canvas. Now wire it up like you would Print PDF node and hit run. I want to see what the error is and Custom nodes in Dynamo swallow the error message that gets generated by anything inside that node.

      Thanks!

      • Vincent says:

        Konrad,

        I would like to clarify a point : When i use file path node, i am asked to select a file. Is this normal? Should I create the file before the first impression?
        I send you the items as soon as possible.

        Tanks,

        • Vincent,

          The file doesn’t have to exist. When you use File Path node and click on the “Browse…” button it will let you do either one of the two things:
          1. Select an already existing file.
          2. Navigate to a folder and type in the name.extension of the file that you would like to create/open even if it doesn’t exist.

          Either one of the things should work just fine in this case.

      • Archie Grigsby says:

        When I connect the “String From List” to “New Names” I get an message that says “Your intended file name is not a compatible file name. Make sure that you are not strings like……. How do I fix this issue?

  3. Mamay says:

    Thanks Konrad! Very nice

  4. Jesper Wallaert says:

    Hi

    First off all great work! As usually.
    I seems to have some problems to – getting your print tools to work.
    I did as you descript to Vincent and sending you an image of the error.
    I hope I can help you getting the error solved.

  5. Jesper Wallaert says:

    Here is the pic.

  6. Jesper Wallaert says:

    Ok I give up with the pic.
    Here is the error text:
    Warning:
    IronPythonEvaluator.EvaluatelronPythonScript
    Opration failed.
    Traceback (most recent call last):
    File “”,line45, in
    TypeError: iteration over non-seqence af type NoneType

    • Are you trying to print a single view? Make sure that Views input is a list. I only tested this for the purpose of printing more than one view.

    • Jesper Wallaert says:

      I succeeded getting the def. to work – but then I chance the File Path and got stock with this warning:

      Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
      Traceback (most recent call last):
      File “”, line 94, in
      Exception: Rename of the setting was unsuccessful; this may be because the name is already in use.

      Does the error relate to the File Path?

      • It sounds relatively clear to me. It will not let you “rename” a file to exact same name that is already being used by another/same file in the same directory. That’s exactly the same behavior that regular Windows UI experiences. Please specify a different name.

        • Jesper Wallaert says:

          It’s working now! also with Bluebeam.
          Thank you for your help.
          Jesper

          • you are welcome. i am glad it was helpful for you. let me know if you find any bugs in it. i only tested it for a limited use range and i am sure it will break a lot. Thanks!

          • Jesper Wallaert says:

            HI again
            Have you trough off building a similar tool for renaming DWF files in the future?
            It will be nice to have the same opportunities with both formats.

          • Have you tried using it on a DWF file? It’s not format specific. I was showing it on PDFs but you can rename any file with it. If you want to use it to manage your vacation images then it should be just fine for that too. :-)

  7. THIAGO says:

    The “Local printers names” node is not working, the result is null….
    Do you know what could be the reason?

    Thanks.

    • What is the error message? Please double click on the node, there is a Python node inside of it, copy/paste that into the project canvas and hit run. It should turn yellow, and display a warning message.

      • Dongsoo says:

        Hi Conrad,

        I had a same problem with Thiago, and a warning message displayed like this.

        Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
        Traceback (most recent call last):
        File “”, line 49, in
        File “C:\Program Files (x86)\IronPython 2.7\Lib\ctypes\__init__.py”, line 492, in cast
        TypeError: expected pointer, got int

        I just started to use Dynamo, so please help me how I can solve this problem.

        Thank you for your help.

        Dongsoo

  8. THIAGO says:

    Have you guys tried to run this script in 2016?

    In my machine crashes when I run on revit 2016.

  9. Joseph Peel says:

    Great stuff Konrad,

    Just wondering, can you feed the Print Settings input with a list of names?
    One of the most irritating thing about printing in revit is that you can only do one paper size at once. I would like to associate a Print Setting parameter with every sheet and read this to pdf everything correctly in one run.

    • Yes, that would be possible but would require some tweaks to the current code. I can have a look at this, but I am not sure when i will have a minute to solve this. It surely is possible though.

    • Joseph,

      Ok, I tweaked it a little bit, and now you should be able to print sheets with a different setting for each sheet. You just have to make sure that list of sheets and list of printSettings are the same length (one print setting per one sheet) and you should be fine. You can still print all sheets to a single print setting and in that case print setting input can be a single item. Please download latest archi-lab package to see this new functionality. Good luck!

      Attachment:  Capture1.png

    • Joseph Peel says:

      Excellent, thats one more process that can be automated :)

  10. Janek says:

    Konrad
    Thank You for sharing this excellent work with us!
    Would it be possible to print various page sizes into a single pdf with this tool? You know, I love the active section marks since revit2015r2 which take you to the page of the section… but our detail use A3 while floor plans and sections are A0.
    Best Regards, Janek

    • Not at the moment I am afraid. I will add this request to my backlog and let you know when I have something ready. Sorry.

    • Janek says:

      I do have a way to make this work, but it is definitely a workaround! I just tried printing all sheets into one A0-multipage-pdf. Detail-Marks work just as smoothly as sections and levels. Then I crop all A3 using Acrobat…well workaround as I said!
      Best Regards, Janek

  11. Michal says:

    Hi,

    Great Job, I look at your Print PDF node and how do you change input IN[0] into text?
    I paste code into Python node and all input remained as IN[0]….IN[6], not sure how to modify it
    2. where is code for Print Range, Print Settings, Local Print Names?

  12. Kerry Thompson says:

    This looks very interesting.
    There are range of nodes used in the code above that I do not have any clue on how to get them. Node such as “View Sets”, “Get View form View Set”, “Print Range” and Print Settings. I assume they are Python nodes?
    Where do we get these nodes from, or where is the code?

    Cheers

    Kerry

    • download package called archi-lab_Grimshaw

      • Kerry Thompson says:

        Thanks Konrad
        I had to uninstall installed versions of the archi-lab and Grimshaw packages out of my system and then I reinstalled the archi-lab.net package and the stuff was all there – no mention of Grimshaw in the package manager except a mention in the keywords. I guess the “_Grimshaw” is implicit.
        Cheers

        Kerry

  13. Johannes Lehto says:

    Hi, all these custom nodes look very promising, and I have been testing them, but it seems to me, that the “Print Settings” -parameter in PrintPDF-node just wont work. I tried to point just one setting, list of settings and also just string with the name of a existing print setting to it, but revit seems to always use the settings I have last used in Revit’s own print dialog. I’m using your latest package (2015.08.31)

    It would also be really cool, if I could change the individual settings inside the presets, so that I wouldn’t have to create different presets beforehand in revit, but rather just change the “”-preset with dynamo on the fly.

    Anyway, thanks for all the other (working) nodes. For example the door set handing has been really useful.

    • Can you post an image? Or even better, email me your Dynamo definition and i will try to see what’s wrong. It’s usually something trivial. I will help as much as I can and as time permits. It should be doable.
      Also, ability to define your own settings on the fly is possible. I will put that on my TODO and get to it as I free some time.

      Good luck!

      • Johannes Lehto says:

        Thanks for the fast response

        Here’s an image. I pretty much duplicated what your images showed.

        I created a test file in revit with four sheets (in view set named “C”) and 3 print set presets like you can see. Every sheet printed otherwise just fine, but revit always uses the settings I last used in dialog, whether it was , or some saved preset.

  14. Stig Komma says:

    Konrad
    I have some trouble with the Print PDF node. I’m running the 2016 version of Revit and I have tried to use Print PDF inn your newest packaged. I have attached a screen shoot off the error message. I have tried to create a new phyton script based on code on this page, but I still get the same error.

    I hope that this will work, It’s a great solution :)

    Best regards Stig

    Attachment:  PrintPDF.jpg

  15. giovanni says:

    Yes, I am getting the same error in 2016: “expected PrintRange, got str”
    It looks like it does not like string for that parameter / value…

  16. Roderick says:

    Hi Konrad,
    Can you please explain what’s the input into the node “combine by pattern” must be? In your screen capture Capture1.png from august the 7th is that not visable.

  17. Amin Ghali says:

    Hi Konrad. First of all thank you for the package, a huge time saver.
    I’m trying to change two shared parameters of the sheets in the view set. The problem is, that view sets output using “get views from viewset” is views, and for me to set a sheet parameter, I need the corresponding “sheet”. I tried using list map by sheet number , but was unsuccessful.
    Is there a direct way to get the sheet element from the view ?

    • when you say “sheet” do you mean the ViewSheet or Titleblock? As far as I am aware this node does return a ViewSheet at the moment so I am not sure what the problem is. Please be more specific. Thank you

      • Amin Ghali says:

        I mean Viewsheet.
        Since viewset output is views, I wanted to get the corresponding sheets for the views so as to assign some shared parameters only on the sheets present in that viewset. Unsuccessful so far.
        Thanks

        Attachment:  viewset.png

        • Amin,

          Yes, so a ViewSheetSet contains ViewSheets. Since ViewSheet is really a subclass of View then then they can be interchangeably cast from ViewSheet to View and reverse. What you see is an example of that happening. ViewSheetSet when queried for its contents ( ViewSheetSet.Views ) returns View class objects. However, they are still ViewSheets, but need to be cast as such. Since Python doesn’t handle casting like C# does, I wasn’t worried about it and just returned Views class objects. They work great when printing. You can extract ViewSheet equivalent of View just by comparing their Ids. Like I said, they are the same object just cast into two different classes. Check out an image attachment.

          Attachment:  Capture2.png

          • Amin Ghali says:

            Thank you so much. That did it. I’m sluggish with filters and list map, but getting there. I’m now using your package to assign a “sheet # of “total number of sheets”” parameter based on the sheets in the view set every time before printing. works great. Thanks again.

          • Glad it worked. Good luck!

  18. Gustav Blom says:

    Hi Konrad,
    Thanks for this package, it is incredibly useful. However, while I can get the “Print PDF” node to work, I seem unable to override the print settings in the Revit UI with the “PrintSettings” input. For instance, if I set the settings to ISO A0 in the UI, and select A3 in the “Print Settings” node, it will still print in A0 format. Other inputs, like “PrinterName” and “FilePath”, are able to override the settings from the UI. Can you get this to work for you? Cheers

    Attachment:  Print.zip

    • Gustav Blom says:

      I figured this one out. I changed the end of the definition “PrintView” in the “Print PDF” python script from:

      # apply print setting
      try:
      printSetup = printManager.PrintSetup
      printSetup.CurrentPrintSetting = printSetting
      printManager.Apply()
      except:
      pass
      # save settings and submit print
      TransactionManager.Instance.EnsureInTransaction(doc)
      viewSheetSetting.SaveAs(“tempSetName”)
      printManager.Apply()
      printManager.SubmitPrint()
      viewSheetSetting.Delete()
      TransactionManager.Instance.TransactionTaskDone()

      to:

      # apply print setting
      ps = FilteredElementCollector(doc).OfClass(PrintSetting)
      for k in ps:
      if k.Name == printSetting.Name:
      newPrintSetting = k
      # save settings and submit print
      TransactionManager.Instance.EnsureInTransaction(doc)
      printSetup = printManager.PrintSetup
      printSetup.CurrentPrintSetting = newPrintSetting
      printManager.Apply()
      viewSheetSetting.SaveAs(“tempSetName”)
      printManager.Apply()
      printManager.SubmitPrint()
      viewSheetSetting.Delete()
      TransactionManager.Instance.TransactionTaskDone()

      Now I can print as many formats and settings as I please in one go!

      • Michal says:

        Gustav thanks a lot, this was one I was awaiting for as I could not print in different formats as well,

      • EPrunty says:

        Hi Gustav,

        Is this code exactly as you entered it, with no further edits to Konrad’s Python script node within ‘Print PDF’? I’ve been wrestling with it for a while and it’s not working for me…

        • Gustav Blom says:

          Hi,
          Yes this part was all I changed, and it is copied directly. Obviously you have to watch the tab positons for each line of code, as they are not copied over to the forum post. I have attached the node so you can try it.

          Attachment:  Print-PDF.zip

          • EPrunty says:

            Amazing! I thought I had the tabs in the correct locations, but evidently I did not… Works like a charm, thanks Gustav.

          • Emilio says:

            Hi all,
            Gustav, I was having the same problem as you.
            I used your edited node, but I’m having this error shown in the image.

            Any idea what the problem is?
            I’m trying to learn phyton but I couldn’t figure it out.

            Attachment:  Capture-1.png

      • Pavel says:

        Thanks, Gustav!
        I had the same problem and your script helped!
        Initially i got an error but when i rearranged the script a little it worked.

  19. Amin Ghali says:

    Hi Konrad,

    Somehow viewsets node is deprecated. I’m on 0.9.1. should I revert back to 0.9.0 ?
    thanks

    Attachment:  viewset1.png

    • Amin Ghali says:

      I uninstalled 0.9.1, and the node works fine with 0.9.0. The thing is, there is no backward compatibility for 0.9.1. Really wish I didn’t upgrade in the first place and save all my files with the new build.

  20. Jon says:

    I am struggling to get your PrintPDF node to work for combined files as well as for overriding print settings. I am using your archi-lab.net version 2015.12.10 and am running Dynamo 0.9.0. I have set up the nodes with the following inputs:

    View Sets: (A custom user created view set in Revit project file named “Test Set” with 16 sheets assigned)
    Print Range: Select
    Combined File: True
    Printer Name: Code Block [“Adobe PDF”]
    Print Settings: (A custom user created print settings with ARCH E document size.)
    File Path: (New PDF filename on desktop)

    If I use these settings as shown with a combined file, the output is a single sheet of the wrong size. I need to manually change the print settings in Revit prior to running the node for it to output the right size. However, this doesn’t fix the fact that it only prints one sheet rather than the whole set. Here is the error traceback I get when running with the above settings:

    ————-
    Traceback (most recent call last):
    File “”, line 117, in
    File “”, line 93, in PrintView
    Exception: The files already exist!
    ————

    Can you please give me some guidance on where the script is failing? I have tried a few editing tweaks myself but haven’t had any luck to get it to print to a combined file. Non-combined seems to work, but need this script specifically for a combined application.
    Thanks!

    • The error states that what you are trying to print already exists. I would check that your Adobe settings are set to automatically override existing files without asking for permission.

      • Jon says:

        I did check this early on. That setting to Ask for replacing is not checked in Adobe PDF presets. It seems to me, looking through the script and the errors that the printing loop is only completing one run and then completing the pdf. Is there a previous version of the node that may work more seamless? I have even tried setting all the preferred presets in Revit prior to running the node and it is still only printing one sheet from the view set.

  21. carlos pinelo says:

    Hello all,

    I am also learning dynamo and find all your tools and posts very helpful. what changes would we have to make to print from a list of views/sheets instead of the view+printRange. in other words i want to print from a list of sheet numbers either from excel file, list created in dynamo or list from all sheets in current revit document. I want to print to a pdf per the sequence in my list and not from a print set.

    thank you,

    • Yeah, that would mean modifying the Print PDF node’s functionality. It would have to instead of making a single call to print a view set, make X-number of calls to print every sheet in a list. That’s not impossible but would require a little bit of work. Also, that Excel part would mean reading the excel file and then using that list of names to sort all sheets in the model. That’s also very possible and not hard to do.

    • carlos pinelo says:

      So this is where I am. I’m using a list of sheets in the ‘views’ input instead of ‘views from view set’. So far this seems to work just fine with the added bonus that it prints the pdfs in the same order as the list. I’m using the sheet index schedule exported to excel through bimlink. Combined pdf does not work, I’m having the same problem as Jon. Only the first page print and errors out with file already exists. I combine pdfs after printed sorting by date for correct order.

      a couple of the issues I have are:
      ‘select’ is the only option that produces any pdfs.
      ‘combinedfile’ only prints first sheet

    • carlos pinelo says:

      here’s the image.

  22. Jon says:

    That was my goal as well. But we sort our sheets in our drawing index by a single project parameter in Revit, so I intended to sort the list in dynamo using that same identifier prior to inputting into the printpdf node. This way, our drawing index matches our sheet order in the PDF and there is no manual reordering required. Just have to get the printpdf node to print a combined file now. Can you send me the unaltered node python script to make sure the downloaded version I have isn’t tainted? Thanks again for these tools!

    • Just so its clear, Revit will not accept a collection of sheets that are custom ordered. It orders them internally by sheet number. What that means that it’s not possible – at least not out of the box – to print a combined set with a custom order. Now, of course it is possible to write a custom solution where we print each sheet separately and then combine them into a single PDF according to custom order but that operation would be outside of Revit. There are plug-ins for Revit like RTV Tools that do that sort of thing and they are not hugely expensive – basic license is probably $40 while corporate license is $10,000. Personally, I don’t plan on creating such a tool at the moment, because I don’t need it at work.

  23. Daniel Nielsen says:

    Hey Konrad
    Great workflow! But… I am missing some inputs/nodes like View sets, Print range and Print settings. I have tried to just write the inputs in strings, but that does not work for Print Sets. What to do? Is me that just do something wrong. Everything is set up as you examples.
    Thanks,
    daniel

    • looks like you have a bad install of Archi-lab.

      • Daniel Nielsen says:

        I have got it to work. It worked with the dropdown menus at some pc’s and others not.
        For some reason I have some trouble to install the Package. I have tried to download the Package manually. It seems to there is some problems with View Sets etc. They do not exist in the .dyf folder, only in the backup folder as a backup. There is also a lot of backup files. I suppose it is not the purpose?

        • Daniel,

          I see what is going on. It looks like Pacakge Manager uploads the backup files as well as the actual nodes when I am publishing updates. Also, it seems that If I had a node missing from my package, but it was in the backup folder I would not even know about it because it still shows up in my library. Now, I will clean this stuff up, remove backups and try to re-upload the package. This is clearly another limitation of the Package Manager that I wasn’t aware of. As a side note, archi-lab package is currently built on top of 0.9.0 release. I will update to 0.9.1 in the near future and probably roll these two changes out together. Thanks!

          • Daniel Nielsen says:

            Good to hear it was not me that did something wrong ;) But, now it does not work anymore. I have tried to move the missing nodes from the bakcup to right location. Is there any chance of you have time to update the package very soon? Thanks :)

          • I will try to put something together today. I will let you know.

  24. Dan says:

    Hi Konrad,
    I’d just like to say thanks first of all for your blog! It’s been extremely helpful.

    I was going to ask for a small favour if you would?

    I’m not 100% sure how all the nodes come together to achieve all of this as the images are fragmented. I’m quite a new dynamo user and it would be a great help if there was some way you could show me this?

    Cheers,

    Dan

    • Dan, thank you for the kind words, but I am a little busy at the moment. Please refer to DynamoBIM.com forum for help with this. I will be back to granting people’s wish in a month or so. Thanks!

  25. BDerrick says:

    Konrad
    Great post! I sympathize with your frustrations about printing and renaming-I’ve gone through that process many times. I’m only just getting into Dynamo but I wish I had seen this post earlier!
    I tried to modify your process to meet our office workflow and I got a little hung up at the very end. I’m not sure what’s going on. I know you’re incredibly busy but if you get a chance would you mind taking a look? Thanks.

    -BDerrick

    • i will when I have a moment.

      • EPrunty says:

        Firstly, great website Konrad and thank you for your excellent posts!

        In response to BDerrick if it hasn’t been answered elsewhere (and if you don’t mind Konrad)
        I had a similar problem. The ‘directory’ string you have going into IN[0] on the ‘Rename Files’ node is actually a file path. The python code os.listdir(path) in the rename node can not read generate the file list from the path of one file, rather than the whole directory which it needs.
        See my attached image for the string manipulation I used to get a directory path that works with the Python script in the Rename Files node.

        FYI All nodes except ‘Custom Rename Files Script’ in my image are standard ootb and named as indexed in Dynamo.

        • Thanks for answering, but in all honesty the post was pretty clear about this. There is an image of a Directory Path going into that input as well as its called Directory. I fail to see how anyone would wire a File Path into that and then be surprised it doesn’t work. It’s not exactly rocket science. Anyways, thank you for answering that question. I hope others will appreciate it.

          • EPrunty says:

            No problem! I agree on the clarity of explanation in the post for using Directory Path, but for some reason when using the Directory Path prior to my adding a suffix of “\”, it caused an error along the lines of ‘can’t find part of path’. I thought that BDerrick might have attempted it with both file and directory paths, resulting in the same error!

          • Then the question should have been clearly stating just that. I am not exactly well versed in mind reading. :-) Anyways, thanks for offering another possible solution. I will put that down, as something that I need to check out.

          • BDerrick says:

            Good catch. I have fixed a few other mistakes that I had made as well. It all works now except the file renaming. I’ve gone through the article many times but I can’t see what I’m missing.
            My String From List node result is null but my Rename Files node results in success so maybe it should be working. However, non of the files are renamed.
            Any suggestions?

  26. Jon says:

    Thank you again Konrad for this tool. Has anyone had any luck finding a fix to the combined PDF issue? I have tweaked the Python script a few different ways and had no luck getting a combined PDF to work (even with a single print setting).

  27. Jon says:

    Konrad, I know you’ve been busy, but do you by chance have any updates on getting the combined PDF function to work? Or anyone else found a fix? Thank you again!

  28. Marian Chick says:

    Thought-provoking post ! BTW , if anybody is interested in merging of two PDF files , my company stumbled across post here http://goo.gl/ts9qze

  29. Piotek says:

    Hello Konrad.

    I have a problem with “Rename Files Node”, screenshot with warnig in attachment.
    Could you help mi solved this problem?
    Best regards!

    Attachment:  problem1.jpg

  30. Alberto Castellanos says:

    Hi Konrad,

    First of all, thanks a lot for this website, it is super useful and I am learning a lot.

    I have a problem with the Rename file nodes that I can’t figure out. I have created these 3 pdf using you print pdf node (worked perfectly!):

    Project1 – Sheet – 00001 – TEST1.pdf
    Project1 – Sheet – 00002 – TEST2.pdf
    Project1 – Sheet – 00003 – TEST3.pdf

    After running the rename files node, I receive these files

    0 (no format)
    Project1 – Sheet – 00002 – TEST2.pdf
    Project1 – Sheet – 00003 – TEST3.pdf

    And this error report:

    {
    Traceback (most recent call last):
    File “”, line 27, in
    WindowsError: [Errno 2] [Errno 3] Could not find a part of the path ‘C:\Users\nayaa\Desktop\New folder (4)\Project1 – Sheet – 00001 – TEST1.pdf’.

    ,Traceback (most recent call last):
    File “”, line 27, in
    WindowsError: [Errno 17] [Errno 183] Cannot create a file when that file already exists.

    ,Traceback (most recent call last):
    File “”, line 27, in
    WindowsError: [Errno 17] [Errno 183] Cannot create a file when that file already exists.
    }

    Any idea how to solve this?

    Thanks

  31. Pascal says:

    Alberto Castellanos,

    What happens when you make two Dynamo scripts (1 for printing and 1 for renaming)? I also had a problem with traceback, than i tried with a ‘Pause’ node, it worked but not good.
    So we made a second script for renaming, and for me it works fine

  32. Piotrek says:

    thanks for the reply…
    in my opinion your package is like shit, none does not work

    • Piotrek,

      Dzieki za wpis. Przykro mi ze moj darmowy plug-in, do darmowego oprogramowania, zamieszczony na blogu ktory czytasz za darmo nie spelnia twoich standardow jakosci. Ale, wiesz co? Ja lubie pomagac innym w moim wolnym czasie wiec jak masz jakis prawdziwy komentarz na temat mojego plug-inu to prosze sie nie krepowac, chetnie poslucham.

      Ps. Nastepnym razem jak bedziesz chcial mnie, lub kogos innego obrazic to prosze Cie napisz po Polsku. Angielski to nie jest twoje forte…kultura i dobre wychowanie najwyrazniej rowniez, ale mam nadzieje ze zrozumiales moje przeslanie.

      Powodzenia!

  33. Piotrek says:

    Nie obrażam Ciebie tylko nie działające skrypty, poniosło mnie. No ale nie działa mi to Rename:( Revit 2017, najnowsze dynamo, a spędziłem przy nim z 20 godzin. Za godzine w polsce bierze się 200zł więc 4tys w plecy;/.
    PS. Widocznie polski również, bo nawet nie wiem co to znaczy forte;p

  34. Piotrek says:

    Z tego co się orientuje, wiele osób ma problem z twoimi pakietami po aktualizacji na nową wersje …problem…one po prostu wcale nie działają. Pierwsza zasada dobrego programisty – jak już coś robisz, rób to porządnie:) Wydawanie niedziałających rzeczy sieje tylko zamęt, lepsze nic niż to, bo wtedy człowiek nie traci wielu godzin cennego czasu na sprawdzanie dlaczego jemu działa a mi nie.

  35. Marlo Melching says:

    Hello Konrad, is the combine function still broken?

  36. Ali says:

    Hi,
    great job thank you.

    it worked perfectly but the common problem we are still facing is we need to save every pdf before plotting. Can we set 1 directory for all pdfs ?

  37. Sean Johns says:

    Hi Konrad,

    Thanks for another great post and series of nodes!

    I haven’t been able to get this one to work yet though. I have two problems: 1. The “Print Files” portion in my version of the script is returning an error with line 101 in the script; 2. and consequently, the “rename PDFs” section has nothing to rename though I think I may have the same problem with that part of the script as a few others have.

    Am I missing something obvious?

  38. wavaw says:

    where to download the latest archi-lab_Grimshaw package

  39. wavaw says:

    Thanks, Konrad K Sobon.
    Helped.

  40. Dear Konrad,

    thanks a lot for your post.
    I have same problem as posted in comment “Alberto Castellanos
    September 20, 2016 at 12:52 pm “.
    Is there a solution for this? I am, structural engineer and new into Dynamo, and without any programming skills.
    I tried split pdfprint and pdfrename into seperate dyn files but no results.
    PDFprint is working well except that I must save each sheet (but how I understand it depends on printer).
    I attached image af nodes and what I get in directory. Also dyn file.

    Hope you will have time to help.
    Gatis

    Attachment:  PDFprintsRename.png

  41. I am adding imege of what I get in directory after execution.

    Attachment:  Result.png

  42. martijn de graaf says:

    Hi Konrad

    pdf print works great in revit 2016 thanks!
    but in revit 2017 it doesn’t… revit crashes.
    have you any idea what the problem could be.

    an unrecoverable error has occured

    greetz martijn

    • Christopher says:

      I am having this same problem – getting a fatal error when using the script in 2017 (it worked in 2016, though I did get a fatal error sometimes there, too).

      Anyway, any insight would be much appreciated.

      Thanks for all your work!

  43. Liam C says:

    Hi Konrad I am having trouble getting the script to work by printing the pdfs off. I’m getting the same error message ,
    Traceback (most recent call last):
    File “”, line 27, in
    WindowsError: [Errno 17] [Errno 183] Cannot create a file when that file already exists.

    Although nothing is getting printed off/ renamed. The printing node works fine. Could you take a look? is it because the “list4” part are not equal values? would massively appreciate your help on this thanks.

    Attachment:  Rname-node.png

  44. Jack Cole says:

    Hello Konrad and thank you for you hard work.

    I am also getting the same error message as Liam C. Has anybody been able to work this out?

  45. Jack Cole says:

    I have found some more up to date material regarding this.

    https://forum.dynamobim.com/t/batch-pdf-with-multiple-sheet-sizes/11629

    Thank you again for getting us to this stage. I’ve been researching for dynamo for quite some time at work and I’m now feeling a need to bring something into the office to make us more efficient!

    Regards,

    Jack

  46. joe dukelow says:

    Hi Konrad,

    I’m trying to use the rename files node that you have created. However, I’m getting the following error.

    “Traceback (most recent call last):
    File “”, line 27, in
    WindowsError: [Errno 2] [Errno 3] Could not find a part of the path ‘C:\Users\jdukelow\Desktop\PBA Drawing borders\Prints\1000.pdf’.”

    I’m a bit stuck with this could you help?
    Thanks in advance.

    Attachment:  Capture-2.png

  47. joe dukelow says:

    Hi,

    I think have managed to come up with a fix to the reason why the Rename Files node was not working.

    There seems to be an error in the Python code. I copied the Python code into a new workspace and hooked up the inputs. When run I got the following error:

    Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
    Traceback (most recent call last):
    File “”, line 37, in
    NameError: name ‘sheets’ is not defined

    Checking line 37 in the Python script “OUT = sheets”. I replaced this with “OUT = newFileName” and the renaming now works.

    You’ll have to excuse my lack of scripting knowledge, and this may not be the ultimate fix but its working my end now.

  48. DynamoBoy says:

    Hi,
    In order to answer to Alberto Castellanos. (SEPTEMBER 20, 2016 AT 12:52 PM)
    I met the same problem and i solve it with to thing :
    – first thing i set my lacing to “Shortest” (lacing is my weakness)
    – but the Rename Files component from the online package returned the wrong test (in fact when i put on the OUT the list of identifiers it return each char of each list items).
    Man this is because half of the import are missing in the downloadable package component. Copy past the code post in this thread and all will be ok)

    To Pascal (OCTOBER 8, 2016 AT 9:21 PM)
    You can handle it in one script while using the runIt boolean INPUT.
    Just change the OUT of the PrintPdf component to 1 instead off “succes” and link it to a Python Script Delay bloc, here is the code i’m using (i’m sure there is a better way to get the delay value from the execution of the pdf generation but i’m to lazy to search for it :P) :
    #————————————————————-
    import clr
    clr.AddReference(‘ProtoGeometry’)
    from Autodesk.DesignScript.Geometry import *
    dataEnteringNode = IN
    import time

    input = IN[0]
    seconds = IN[1]

    time.sleep(seconds)

    OUT = input
    #————————————————————-

    Then just link the OUT of PrintPdf to the First input of your Delay Python script – Create a int or code block to set the delay in second – add a input to the python script and link the OUT to the RunIt of Rename Files!
    It works like a charm.

    Wish i helped

  49. Christopher says:

    Hello Konrad,

    I am attempting to use the printing nodes in Revit 2017 and Dynamo 1.3; however, the Local Printers Names node keeps giving me a fatal error. Is there any advice or help you might be able to provide? Even after removing the node from the custom node and placing the Python script itself in the flow, it fatal-errored and does not provide any error or way to check it that I can see.

    Thank you.

  50. David says:

    Hi Konrad,

    Thanks for the great work. However, with the latest arch-lab.net package, it looks like Dynamo Print Setting node is being overwritten by the settings in Revit print dialogue, so when I feed A1 and A3 print setting into the Print PDF node, it prints the PDF with the current setting, so that A1 is printed as A3 size or vise versa.

    Also the Rename node is giving me N as the file name for the first file in the list and leaves the others untouched.

    Just wondering if there is another update to the arch-lab.net package. I’m running 2016.13.3 and Revit 2016

    Cheers

  51. adam staniland says:

    Hi Konrad,

    I have a problem with the rename module (I’ve not been using the print options, I’m just interested in renaming the files once they are printed – is this a problem?).

    When I run the script it renames the first sheet with the first number that it should be renaming it with and then stops and doesn’t add a .pdf suffix. and I get this error message (for 3 files I am testing on):

    Traceback (most recent call last):
    File “”, line 27, in
    WindowsError: [Errno 2] [Errno 3] Could not find a part of the path C:\Users\adam.NRSN\Documents\New folder\2723 Craigsfarm Community Centre – CENTRAL_adam – Sheet – A(2-)00 – BUILDING ELEMENTS

    Traceback (most recent call last):
    File “”, line 27, in
    WindowsError: [Errno 17] [Errno 183] Cannot create a file when that file already exists.

    Traceback (most recent call last):
    File “”, line 27, in
    WindowsError: [Errno 17] [Errno 183] Cannot create a file when that file already exists.

    Do you have any idea as to the issue?

    Thanks

  52. AJ says:

    Is there a way to create a scheduled PDF print…i.e.: print a set of PDFs every friday at noon.

  53. Marek says:

    Thank you so much Konrad!!! Amazingly done.

  54. Maurice says:

    Hi Konrad,
    Thnx for sharing this, the problem that occurred for me is that the print settings that I have selected doesn’t work, the current settings in revit are used to print the sheets.

    can you help me out? im using revit 2017.

    Greets Maurice

  55. Dee says:

    Hi Konrad, this is awesome. However the “Sheet Revision” code block parameter does not work for me and therefore cannot input current revision at the end of each file name. Has the name of this been updated? Or is this a custom parameter that you made in your project?

    Thanks.

    • Dee says:

      It seems the correct parameter should be “Current Revision”

      However, the rename script still does not work.

      I am presented with the following error after trying to input the current revision into the pdf file name.

      WindowsError: [Errno 17] [Errno 183] Cannot create a file when that file already exists.

  56. Jed Lankitus says:

    Hello,

    It is mentioned in the article that the Adobe print settings ‘Output Folder’ always overrides where the file is saved.

    I have a similar issue with the Bluebeam print driver. Has anyone found a print driver that allows the code to override the settings and choose the file path, instead of having the user choose?

    Thanks!

  57. Robert Glover says:

    I’m new to Dynamo, so please be gentle and forgive my ignorance.

    This is great and I’ve gotten it to print all PDFs in the currently open RVT. I’d like to add the function of printing all sheets in all RVT files in a list of specified directories. ((This is to say I want to open all models in the mechanical, electrical, and plumbing folders of the project, print all sheets from all files, then close.)) I have nodes for open in the background and another to close (from Rhythm), but I don’t know how to tie that into this script since the list of sheets from your script is pulled from the currently open file. Perhaps what I’m asking is: how do I put A before B rather than running A and B concurrently?
    Any assistance is greatly appreciated. Thank you.

    • You would need to work with linked documents. You can get views from linked document, but the Print PDF node was not designed to print from a linked model. This all comes down to getting the right document in the code, so it needs to be accounted for, and I didn’t think of that potential use case. Sorry. You are left with coding it up or using a $50 RTV Tools. They are great!

  58. Jack says:

    Konrad,

    Many thanks for this!

    However, as many before me have already said, there seems to be an issue somewhere, i assume with the Rename.Files Node.

    The INPUTs for Rename.Files are exactly as per your example in the discussion attached, yet the OUTPUT returns errors at line 27 for each item on the output list.

    Is there a fix for this?

    I have gone through this entire comments section, tried everything and no luck.

    Many thanks in advance if you’re able to look into this. I can send over my .dyn file if needed.

    Attachment:  archilab.jpg

  59. Chris says:

    Hello Guys,

    Im new to Dynamo aswell, Konrad is saying that the Rename files script needs a directory path. But when you edit the script it says filepath?
    is this wrong or is my dynamo knowledge not that good..

  60. Raf says:

    Hy Konrad,

    How do i know that the Rename Files node is the latest version?
    The Python script states “2016”..
    I’m running packages as seen on attachement.

    grtz
    Raf

    Attachment:  packages.jpg

  61. Paul Wintour says:

    Hey Konrad

    Nice work! However I’m getting an error “Cannot create a file when that already exists”. Not sure why as the file name is different.

    Interestingly if I copy the Python node out of the custom node is works, albeit with an error on Line 37 saying ‘sheets not defined’.

    Any idea what is going on?

    Attachment:  Capture.jpg

  62. XEOWAREZ says:

    Konrad.
    Thank you very much for this dynamo application. It works perfectly. Also now I can print all different sheets formats with only one click.

  63. Arjay says:

    Hi Konrad,

    Need your help. How can I do the print PDF’s to one file only? I cannot get it working. Does it has something to do with the PDF print driver? If yes what print driver can you suggest?

    Thanks!

  64. KonradO says:

    Hi Konrad,
    I have a problem with the script (or with printer/revit). All my pdf’s are the same size (printing goes with default paper size of printer). It looks like PrintSettings are not taken into consider.

    Attachment:  Problem.png

  65. Thiefsie says:

    The current api entry for revision is:
    “SHEET_CURRENT_REVISION” so you’ll have to update your code block to suit in the sheet renamer

  66. Donn says:

    When I run the rename. I get an message that says “Your intended file name is not a compatible file name. Make sure that you are not strings like……. and the file was renamed not as shown on “String From List” “Watch” node. How do I fix this issue?

  67. Kirk says:

    Every time I make the CombinedFile “True” my dynamo either crashes or freezes. I’ve let it run for up to 30 mins to be successful and it still doesn’t work. I’m trying to get all my pdfs be one and not individual pdfs. Please help!

    • So this is quite an old node that I wrote a long time ago, and haven’t really had time to make any recent updates to it. Please go to Dynamo Forum: https://forum.dynamobim.com/ Search for Printing PDFs. I might have answered a similar question there, or some other users might have had suggestions. I will try and do a better job with updating this in the future.

  68. Solida says:

    Hello I am Civil Engineering student in year 3. I want to ask you if we want to learn Dynamo Revit What kind of skill that we need to learn? please recommend to me.
    ..

  69. Sujan Maharjan says:

    Hi,
    I have tried recreating the script but Naming of the pdf file is not working for me consistently. I tried to do it with Dynamo 1.2 as well but got the same result.

  70. Brenten Smekens says:

    Hi,

    First of all, thanks for the amazing work.

    I am having some problems with ‘printer settings’. No matter which setting I select, it always prints on the paper size on which setting it is defined at that moment in Revit. It’s like the program I run does not overwrite (or choose) the printer setting in Revit with the setting I selected in Dynamo. Any chance you can help me?

    I work with Revit 2020.

    Thanks in advance!

    Kind regards,
    Brenten Smekens

    • I don’t think that printing from Dynamo is a great idea. I think you should look into tools like pyRevit for it. I stopped using my Dynamo nodes for it quite a while ago. Why do you prefer doing that with Dynamo? If there is a legitimate reason we can probably work out a good solution for that, but just for everyday printing i think pyRevit or other tools that are also free or really cheap are much better than Dynamo.

  71. Rob says:

    Konrad,

    Thank you so much for this, it’s fantastic!!! It’s taken a bit of juggling but I’ve got it working. The only problem I’m having is that each time i open it the “View Sets”, “Print Range” and “Print Settings” nodes have an additional output point added and i have to relace them, see image linked below

    https://ibb.co/tb9gJXn

    Is there something I’m doing wrong.

    • I think the additional port output issues are related to version of Dynamo you are using and the version of the archi-lab.net packages you are using. So the package version has the following format 2020.23.1 where 2020 stands for Revit version, 23 stands for main Dynamo version supported ie. 2.3 and finally 1 stands for build number. That last number is just iterated as I make changes. The first two matter because you might have some API changes between Revit versions that we are taking advantage of. The main thing that matters though is that middle Dynamo version. Please make sure that you are updated to the latest.

    • Derek Edwards says:

      I’ve encountered the same issue as above. The View sets, print range, and print settings nodes have an additional output point added to them. I’m currently running dynamo 2.0.3 and I have archi-lab.net package 2018.2.2 installed (Latest package for Dynamo 2.0.3?)

      Any ideas on what to do to fix it?

  72. Ben says:

    Hi,

    Think i might have gone something wrong in the renaming part but not sure what it is i’ve done as it doesn’t rename properly. It removes the entire name and replaces it with a single character

    Attachment:  PDF-Print.png

  73. j B says:

    I cant seem to find the “Get Views from View Set” Node am I missing something? I have downloaded the archi-labs.net package. I’m new to Dynamo sorry in advance.

  74. james smithsmith says:

    Thanks for building this. I was able to modified it so it pulls from my sheet list. One question for you. How do it take multiple sheets and make it print as one file? TI thought setting the combined file to true would work. It seem I only changes the time of the files.

Leave a Comment