Output the current view from UI view

Hello All,

I am trying to generate some snapshots from an object I have created. I have created a Dynamo workflow to rotate an object and fit the view using .ZoomToFit(). Now I am trying to output the view to save it using ExportAsImage, but I don’t know how to output the view. The output of my code is Revit.UI.UIView and I don’t know how to convert it to the actual view to input it to ExportAsImage.

Please help.

Jacob, thank you very much. It is now working but I want to output any degree as a snapshot. I have to refresh the code anytime I want to save. I need it to save continuously when I am rotating the element. Do you have any suggestion?

Generate all the view points you want to use, the set up a periodic run method to pull a single item out of the list of all the points based on the time, and use that point to make the view, export the image, and then delete the created view. Rinse and repeat for the given timeframe to catch all points.

Note that you may have to adjust your periodic runtime to ensure its a larger value than the total graph runtime.

You may be better off exporting an animation directly from Revit.