I made a simple script that exports images from Revit families and applied it to an entire family library using RBP. Quickly realised this approach would take a really long time with RBP having to open and exit Revit for each family, and we have many.
Instead I tried using Rhythms open and close application nodes which is a lot faster and does output images as I would like. However all of the images, though named correctly, contains the same view from whichever project I have open when I run the script.
The IF statement makes sure the script doesn’t stop when opening families without 3D representation. Is there a way to pull views from the opened project files instead of the current one?
Tried that, gives me a null output which in turn shifts to the true input of the if node, which again uses the current document.
If there is a package out there with nodes that can pull views from documents other than the current one that would solve it. Perhaps it’s just not how Dynamo works.
Depending on whether the file (which you had open when you opened Dynamo) is a project or family will affect how Dynamo reads the files you’re trying to open…
Did you try making a(ny) new family and launching Dynamo from there, then running it?
Pretty sure you’ll need to code up something that takes a document and a view to export the image. Shouldn’t be too hard in Python.
This is the command to actually do the export - note it is in the doc class so the different documents you input will have this method called on them. ExportImage Method
That method takes an image export options argument, so you’ll need to build one of those first: ImageExportOptions Constructor
Once you create that, you can set the file path you want to save to (perhaps deriving this from the document’s name and path?): FilePath Property
Unfortunately I don’t know Python at all, but maybe this is a good excuse to learn. Thank you for the head start!
If I manage to write the entire script in Python I’ll also try running it directly from RBP since Python scripts can be run in the same Revit instance, should speed things up.
If going full python, Dynamo’s Python node can open the file, get the data, and return the results for a full directory - you just move the opening of the documents to the Python node as well - no need to go to RBP or other tools as a result.
I did a test with 100 .rfa files, took 48 seconds/file to process. A lot faster than the 3 min/file RBP took. My approx 1200 files would take around 16 hours to complete. Not too bad…