Writing a set of images to a file (+ focal length)


I’m trying to write multiple images to a folder. The problem is, so far I’m only able to create all those images (3D views) in my 3D view on revit itself, but not to a folder. The problem is (I think) is that the output of PerspectiveView.SetFieldOfView has a list as output and not views?

Another problem is that those views should have a set focal length, but it does not work. It does work however, when I run the script step by step (first creating 3D views on revit, then running dynamo script to change focal lengths).

Is there any way I can make this script work, or am I missing some steps and trying it too easy?

I let out the first part of the blocks because those all work just fine

What does the resulting output file look like?

It only runs the pink block, makes a couple 3D views in revit. The grey block also works, but only if I run it apart (with a select 3D view node).

I’m triyng to get them into a map as images (PNG or whatever), but right now the output I have is the output the pink block makes

Hope this answer ur question

what package is the PerspectiveView.SetFieldOfView in?


Found a node with the same name in the Morpheus package - maybe it’s the same maybe it isn’t - please post a version of your graph with the preview expanded including the preview of the nodes prior to the failure. Be sure to annotate all custom nodes as well (the Monocle view extension is great for that). For my node the output is a list of lists which state “success” as a string. Obviously this isn’t a view, so you’ll need to wait for the FOV to be set before you pass the proceeding input into the View.ExportAsImage node. You can ensure this by adding a passthrough method (the Passthrough node in Clockwork will work here, or [passthrough,waitfor][0] in a code block works as well) between the PerspectiveView.SetFieldOfView node and the View.ExportAsImage node.

Note that you’ll need a file path not a directory for the path input on the View.ExportAsImage node. As it’s wired now you’ll get only one image of the last view with the name “path.png” but I think you want “exported view 1.png”, “exported view 2.png”, etc. Getting the name of the view which you created might be best for that part.

If I understand correctly, this is what ur asking?

In short what I’m doing is: Creating all kinds of different pictures at a given set of camera points, aimed to target points. As the input of the pink “Makes Views” node have to be lists for multiple points, they’re put in a list first with the same amount of points in it. This all works fine, and creates those views in revit (picture below)
this lists goes on and on…

All those images should have a set focal length, but it’s not the right focal length on the views created on revit, I have no clue how to fix that since those perspective views go straight to the next node (picked the one from Morpheus, still didn’t work :confused: ). And at last, I want all these views to go in a folder on my desktop saved as images.

By using the file path as u mentioned, I really don’t have a clue how to write these images to that specific file, maybe I didn’t express that well what I wanted, my bad. At the end of the dynamo script, I should have a filled folder loaded with images, from perspective views at given focal length.

Hope this helps

Note quite - the item you want to passthrough is the list of views in the perspective view by points node, not the results of the focal lengths - you want to wait for that to be done before you passthrough the list of views.

The file name is just a string containing the full path and name (not the extension though) for the file you want Dynamo to write. So in your prior graph it would be “C:\Users\admin\desktop\path”. Write that in a string node and then use an addition node to add the name of the generated views (ie: 0,1,2,3,4,5…).

This is the current situation then that I just tried:

The focal length still appears to be unchanged, and I still have the issue to export as displayed on the picture. Perhaps I’m trying to many things in one dynamo run, and need to seperate the steps?

  1. The focal length node wires into the waitfor input of the code block (red line).

  2. The output of the code block wires directly into the view export node (blue line).

  3. the name still isn’t right - you only have one name for all n views. Add another “\” on the end of the string, and then wire that into the X input of an addition node. Then build a range (Range node) from and 1 to the count (List.Count node) of the number of views and wire that output into the Y input of the addition node, and finally wire the addition node into the name input of the view export node (green +).

If be sure to watch your data previews as it’d be very clear why your graph isn’t working at the moment if you had.

Should this not work, post a sample Revit file to run your graph on and the full dyn and I’ll look at it Monday.

I tried to do it as u said (I hope it’s right this time), does not seem to work, however there was 1 .png written to the path (but it had no name).


I couldn’t upload any revit file since it exceeds the upload limit (?) but it works on any rvt file I guess