20090502

Render Queue (ish) for Revit

I love using the simplified rendering capabilities of Mental Ray in Revit 2009 and 2010, but it’s a hassle to do large numbers of renderings. Unfortunately, there’s no batch render functionality and the API doesn’t yet have controls for the necessary functions. However, using the journaling mechanism built into Revit and a handful of VB script techniques, you can build a render queue that, while lacking in User Interface, works pretty well.
This is a render queuing script that I built about a year ago and have refined a bit (one for revit 2009, on for revit 2010). It isn’t pretty, but it gets the job done, at least to make multiple renderings from a single file.


[Edit: There are variations and developments of this script with a more user friendly Graphic Interface at these locations:
Revit Batch Renderer: Beta 2.0

Batch Render . . . In French]

To use it you will need to do the following:



  • Put on your propeller hat. Tinfoil will work too.
  • Put the script in the same folder as the .rvt file to be rendered.
  • Set your render settings (names of views, quality, size, etc) in the space provided. 2010 version has a bit more functionality than the 2009 version. (Please read the instructions in the script carefully, it's easy to put in bad information and the script is a sensitive hothouse flower.)
  • Save changes and drag this file from Windows Explorer onto your Revit shortcut icon to run. Images are saved in the same folder, so make sure to remove all output before running for a second time, as the script will fail if you try and overwrite exisiting files.

Caveats: The last saved state of your file MUST be:

  • All views to be rendered in the file MUST have render settings set to "print" NOT "screen"
  • Render quality of each view must be set to something other than target output (i.e. you can't save the view with quality set to "High" if script is going to set it to "High" too).

The script shouldn't make any changes to your file, as it undoes alterations to your file before closing and there is no “save” at the end (workshare files do a "Relinquish elements and worksets" upon exit).

Tips: I recommend first trying out this script with your images very small and quality very low. That way you can trouble shoot the batch you intend to print (I often screw up getting the view names EXACTLY right). If you do this, don’t forget to delete your resulting low quality images, as the script will fail trying to overwrite them when you run it for a second time.

I’m sure someone out there with better scripting abilities can make something more comprehensive (something that could render from multiple files, for instance) and I’d invite anyone to use this script to do so. I’ll probably make some additions to it later to save out multiple exposures of the same image. If anyone has suggestions about how to improve the functionality, leave some comments and I’ll see what I can do.

As with anything you download from some bozo on the interweb, use at your own risk.

{Edit: There are variations and developments of this script at these locations:


Revit Batch Renderer: Beta 2.0

Batch Render . . . In French]

37 comments:

  1. How long did it take you to figure out all that?

    ReplyDelete
  2. lovin' the candy du jour :)

    -chico

    ReplyDelete
  3. oh yeah, and also lovin' the new background for you title.
    q: could you make the candy enlarge-able?
    -c

    ReplyDelete
  4. "How long did it take . . ."
    My job has me working in the Revit journals on a daily basis, and I was doing this sort of stuff with the rendering functionality pretty regularly for several month. So it's hard to estimate.

    ReplyDelete
  5. "could you make the candy enlarge-able"
    Yep. Thanks for the comments

    ReplyDelete
  6. In the next version you can make it network render. ;) Thanks for the work!

    ReplyDelete
  7. Thank you so much for this batch!!! I have been looking for something like this for ages- I am pretty sure this is the best thing since air.
    My design principal's problem with Revit is its lack of quick batch rendering ability ("Like Microstation") without taking it into 3DsMax, which this has solved!! One of my project teams started using it the day I got it, & it has already saved them from having to stay in the office all night just to hit render - they thank you for their sleep!!

    (I did have to remove one line that it kept getting hung up on:
    Jrn.ComboBox "Modeless , Rendering , Dialog_Revit_ProteinRenderingDlg" , "Control_Revit_RenderDpi" , "Select" , "Custom (" & ResolutionDPI & " dpi)"
    but after I removed that it worked perfectly!)

    ReplyDelete
  8. Liz,
    Glad it's working for you. I have gotten similar comments about the redundant piece of code. I can't quite diagnose when it's used and when it isn't (I'm assuming that you are using r2009?). I think you might need it for non-workset environments. Thanks for the bug fixing!

    ReplyDelete
  9. Zach - thanks for the script! This is just what some of us (perhaps architect-types) needed....now I can start billing for my time in the middle of the night while I'm sleeping soundly not dreaming about revit. I hope to have some more time in the near future to continue to play with it - lots of potential now that you've done the hard part...

    ReplyDelete
  10. It seems to have issues rendering a 3D view that has not been set by a camera... any thoughts?

    ReplyDelete
  11. What sort of problems? Can you send me the resulting journal?

    ReplyDelete
  12. Hey Zach,

    I noticed a problem when attempting to render a 3D view that is not based on a camera. The problem appears to be during the first set of code after Revit opens the files (The crop region and show camera portion).

    I duplicated the default 3D view and set up a few different views using that. The error prompts something along the lines of the journal and "run in interactive mode"

    Great script though... worked great for any camera views I set up. I even began to tweak it and have Revit show a mass before rendering.

    Thanks!

    ReplyDelete
  13. Glad to hear you've figured out how to make the script your own . . . sorry about the 3d orthographic views, I don't render them very much. Are you using the 2010 or 2009 version? If it's 2010, I'm guessing it fails with the 7 lines after 'set image size. Try to take these lines out and see what happens (the 2009 version does not have image size control in the script).

    ReplyDelete
  14. Yeah I am using it with 2010.

    I will give it a try with removing the lines.

    Thanks!

    ReplyDelete
  15. Hi there,
    first a big thank you. I have been seeking that kind of tool for quite some time now.
    I have been tweaking it to make it work for half an hour now and I keep getting the same errors. I am using 2010 but in Fr, what I assumed first was the Fr translation of some of the script and actions. I change Views to Vues as per the french version... it didn't work. I tried the 'set image size tweak. and all noted above... still it does not seem to work and I get the same error as the Revit Kid said: "The error prompts something along the lines of the journal and "run in interactive mode"" , I also tried the no tweek version of the script.... I get stopped at line 40 then if i tweak the two lines at line 45 of the file. any guess?

    ReplyDelete
  16. I got it working... yuppa!
    damned translations...
    I wish they kept all journal files in english to be consistent.

    here you are with my solution:

    switch this line:
    ''''''''enter your desired quality, choices are Draft, Low, Medium, High, or Best
    RenderQuality = "Low"

    for that one:
    ''''''''enter your desired quality, choices are Qualité brouillon, Qualité inférieure, Qualité moyenne, Haute qualité or Qualité optimale
    RenderQuality = "Qualité inférieure"

    and also:
    Jrn.Browser "ToggleExpandedState" _
    , ">>Views (all)>>3D Views>>"
    For Each View in ViewArray
    Jrn.Browser "Activate" , " "
    Jrn.Browser "SelChange" , ">>Views (all)>>3D Views>>" & View & ">>"
    Jrn.Browser "LButtonDblClk" , ">>Views (all)>>3D Views>>" & View & ">>"

    for that one:
    Jrn.Browser "ToggleExpandedState" _
    , ">>Vues (all)>>Vues 3D (3D View)>>"
    For Each View in ViewArray
    Jrn.Browser "Activate" , " "
    Jrn.Browser "SelChange" , ">>Vues (all)>>Vues 3D (3D View)>>" & View & ">>"
    Jrn.Browser "LButtonDblClk" , ">>Vues (all)>>Vues 3D (3D View)>>" & View & ">>"

    ReplyDelete
  17. Hi,

    I have tried this script file a multitude of times, both at work and home and continuously get a error message with the journal file. I am trying in 2010 64 bit machine with Widow’s Vista and have tried taking out the line like recommended but with no success so far. Do you have any more recommendations?

    Thanks

    ReplyDelete
  18. Julia,
    Have you tried the graphic front end version with the same results?

    ReplyDelete
  19. Is it also possible to render an entire or partial walktrough with this batch?

    Please let me know

    ReplyDelete
  20. I'm afraid this can't be used to render walkthroughs. (This is an interesting question, though, as walkthoughs are themselves batch processes)

    ReplyDelete
  21. It doesn't work on my system (Win Vista x64) with Revit 2009. Is there a solution?

    ReplyDelete
  22. Anonymous,
    Have you tried the graphic front end version with the same results?
    http://buildz.blogspot.com/2009/08/revit-batch-renderer-beta-20.html

    ReplyDelete
  23. Zach, hi, could you adapt it to batch render in revit 2011? It would be great man. Thx!
    Otto

    ReplyDelete
  24. Hi...i'm using revit 2010 64 bits in portuguese. What can i do? It's not working!!

    ReplyDelete
  25. Yes, I'm afraid that the functionality is very language dependant. You can see in the edits to the above posting that there has been a French version posted as well. Similar work would be needed for a Portuguese version. Sorry

    ReplyDelete
  26. Hi Zach.

    I am trying to use the batch renderer with Revit 2011! So far I have had little joy. The Batch Renderer doesnt't let me fill in the Revit Version! Does this mean that it does not work with 2011?

    ReplyDelete
  27. Try using the raw journal file (the .txt file with instructions for use listed in this post) rather than the application that was written later. Until someone makes a new application that recognizes r2011, it won't find the install.

    ReplyDelete
  28. I was testing raw journal file in Revit 2011 and it's working great :D

    ReplyDelete
  29. hi all, where can i find raw journal file for Revit 2011? thanks all

    ReplyDelete
  30. You can use the 2010 journal that is linked in the second paragraph of this post. Works with 2011 as well

    ReplyDelete
  31. Hi Zach,

    What a nice surprise:
    I tried the Journal File with Revit 2012 and it seems to be working.

    One problem which I have noticed: The saved rendered files are transparent in the background area (no background image). When I watch the rendering process the background image is there.

    Is there something that can be done about it ?

    ReplyDelete
  32. Hi DvirHar,
    The transparency has to do with the file format that it is exported in. My recollection is that the files should be saved as .tif, in which case the background should be available but there is an alpha channel that might be masking it in whatever your image editor or viewer is.

    ReplyDelete
  33. Hi Zach,

    Indeed this happens with tif files: exporting the rendered image after normal rendering to tif format gives the same results - transparent background.

    I tried to change your file, based on intuition only. In lines 78,79 I replaced every "tif" with "jpeg" and in line 80 I replaced the line types with "JPEG Files (*.jpg, jpeg)". It works. I now get jpg images with bacground.

    So far so good :-)

    ReplyDelete
  34. Hi Zach,
    I have zero experience with script, so I apologize ahead of time. When modifying the text file, do I leave the double quotation marks in place and just modify the text between them? On line 2, do I leave the word 'Array' as well as the parentheses in place?

    ReplyDelete
  35. Wow... even I was able to get this to work!!! And the 2010 script works in 2011. Thank you, thank you for creating & sharing this!
    Please disregard my previous question about modifying the text file... I left all in place (for anyone else new to modifying script) and it worked like a charm.

    ReplyDelete