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:
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.
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.
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.
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: