image exporter for dynamo

image by archi-lab

This post has been long overdue, but I had gotten quite busy at work and basically have been hording all of these ideas. The image exporter came about when I was considering ways of adding a floor plan to each Room Data Sheet while keeping the data in Excel. The idea was to just export each room’s floor plan as a JPG and then embed it into Excel. That worked fine, to an extent but I realized that it will be better to just keep RDS in Revit and not export them to Excel for now, so I moved on from Image Exporting.

Obviously Dynamo, already has a OOTB (out of the box) node for exporting views to images. It works fine, and I have nothing against it. The only thing that its lacking is flexibility, and all of the options that Revit’s UI offers when one wants to export something to an image. I really like having options:

image_01

In order to implement this node I had to make a few miscellaneous nodes that would retrieve things like Fit Direction Type, Image Quality or File Type. They are very simple enumeration nodes that just produce a list of available options for each setting. This way I don’t have to write that all out.

Next in line was putting it all together into one export node. Here’s code for it and I will explain the logic/behavior below:    

The idea is to be able to specify whether we want to export a single image or a whole set of images. Also, there are options for Image Resolution and Size, but those can only be set when the Zoom Type is set to Fit To View. Just like you can see in the UI when you choose Fit To option, Zoom To becomes grayed out. Very similar thing happens when dealing with the API and we can chose one or the other and with each choice comes a different set of options that we can set.

If you chose Fit To, now you can also specify exported image size in pixels (there is a limit in size, but I haven’t figured out what it is yet) and whether its in Horizontal Direction or Vertical. So if i Specified Horizontal and 500px, exporter will make sure to scale my image down to 500px in horizontal direction and vertical will be whatever it comes out to be based on proportions.

This is a work in progress obviously, and I am sure there are still some bugs in it, but give it a whirl and let me know if you encounter any trouble and hopefully I can fix them.

Example of how the node can be set up. All custom nodes are part of the archi-lab package so get them from the Package Manager.

Untitled-1

Update: 09/01/2015

There has been a change (for better I hope) in how most of the custom nodes here are working. I decided to hard code them using a DropDown node as a base. This should make picking all of the right types much easier. Please download latest Archi-lab package to see that reflected.

Update: 09/10/2017

Since there were some changes to Archi-lab package for Dynamo 1.3.0, I need to post an update here. Get All Views node no longer exists. I hope that it was replaced with something better. Please see the below image for the above workflow.

Update: 12/23/2020

I have recently received a question on the blog in the comments section, asking if there was a way to export an image, and get it saved in the project. Revit allows that by right clicking on a view, and saving it to a project. I was able to update a few nodes in archi-lab.net package to open that functionality up. The only thing worth noting here, that there is a little bit of a limitation to this workflow. It only allows you to save an image to a project, when the range is set to “Current View”. That means we can only do this for the currently active view. Since Dynamo is a little limited when it comes to switching the active view, we are kind of stuck at doing one view at a time. Sorry. Here it is:

Support archi-lab on Patreon!

26 Comments

  1. Graham says:

    I think this is a great tool and is very similar to what I am trying to automate myself. What I am trying to do it is instead of exporting an image (Revit> Export> Images and Animations> Image) I am trying to save sheets out of Revit (Revit> Save As> Library> View). I am not sure if I would be able to modify this node or what exactly I have to do but any help would be much appreciated! Thanks in advance!

    • Graham, I might be wrong but I don’t believe that this particular functionality that you are asking for was exposed in the Revit API. It might be only available via UI. I am sorry.

      • It would appear that way, I have checked a few other sources and they are all coming back with the same conclusion. It is a little odd that it’s accessible only through the UI but thank again of the help!

  2. Johanna says:

    Hi
    I tried Export Image by view. I have Revit 2017, Dynamo Revit 1.3.1 Your arch-lab.net 2016.13.4. I can’t find the nod Get All Views. Were is it?
    However I just tried one view using views but that view did not show and the end result shows up empty.

  3. Joe says:

    Well done!,

    How does one download the archi-lab package?

  4. AMR says:

    This is a great tool and saves a ton of time!

    One issue I am having – my JPEGS seems to be getting cut off a bit on the left and right edges, as if there are no margins at all around the perimeter of the image. Any way to adjust this?

    Attachment:  Capture.jpg

  5. JD says:

    Does not work – not exporting views on Dynamo 1.3.2 and Archi Lab package 2018.13.13 or newer. Tried multiple packages and two files. Why does the File Path node have to point to an existing image? Can we not just point it to a folder?

  6. Mo NA says:

    Hello Konard, This is a great tool, thank you. I am trying to rotate an object that I have and take snapshots of each view. I have done that all automated, but I have to switch the “RunIt” to off and on again to save each view. Could you please tell me how I can run it all automated and continuous without switching the RunIt Boolean? I appreciate it.

  7. Clay says:

    Konrad,

    Any way to filter which views get exported?

  8. Jake says:

    Hello Konrad,

    I have a use case that requires saving a list of project views as images to the project rather than exporting them to a file. Saved images are ultimately placed on sheets to show how the project varies with variation in design parameters.

    The Revit UI functionality that allows for saving a project view to the project is labeled: “Save to Project as Image…”. Right clicking a view exposes the function as an option available to the user. The images themselves are saved as Family/Type “Rendering/Rendering” in the Revit environment.

    Is there a way to modify your image exporter node to save a list of project views to the project rather than exporting them to a file? I’d like to think there’s a hard coded path name option that hooks back to the project rather than an external file but I’m sure it isn’t that simple.

    Of note, Revit documentation on Rendering an Image (Save the Rendered Image to a File) seems to suggest that internally saved images are compressed jpg files while exported images offer a high quality option. Aside from workflow efficiency it looks like there may be a project file size benefit to saving images internally.

    Thank you for any guidance you may be able to offer.

    Best wishes,
    Jake

  9. Sam Roberts says:

    Hello, Does this node still exist, cant find the ‘export image by view’ node. Tried to recreate it from the code and came back with an error

  10. Anthony says:

    Hi i’m trying to export a jpg of all family in the model.
    I would like to make a schedule with screen and name of family or type.

    I want to do that for controlling geometry level

    Is it possible ?

  11. Anthony says:

    Thanks for your answer.
    I think to do a screen of the 3D views of the family type which are in the project.

    • Yeah, that should be possible to do with Revit APIs. I don’t know that all of the nodes that you would need for that are in the Dynamo library, so you might have to do some custom scripting in Python/C# but it should be doable. Good luck!

Leave a Comment