Zoom extents on all views of background document

Hey guys,

I was sketching out an idea earlier on running a background script to open one family and potentially all families within a folder, and then performing a zoom extent on all views of said family(es)–saving–closing. Later perhaps compressing all these families could also be incorporated into the script. But I’m not that great at Dynamo especially when it comes to accessing Revit API so my question is: Am I on the right track? Is zoom extent an element parameter of the document or…? Suggestions and comments would be extremely helpful.



Not sure if you’re on the right path but setting the active view to the default 3D view would also be pretty awesome so users could see what they are loading in.

1 Like

Yes! you’re right. I’m still playing around maybe I’ll post something more developed later. I figured I’d test the waters first


Hi @carlosguzman,

I’m thinking you will need access to this method:

Not too sure if that is available in any packages yet. :thinking:

Additionally, it seems like this method is available for the UIDocument which I am also not sure is available in a background opened document.

Let me do some digging and see if I can help out too :male_detective: . Very cool idea!



Awesome @john_pierson thanks a lot!

So as a background opened file, it is a no go from a Dynamo standpoint.

After that error, I went ahead and tried activating a new document which would allow this change (http://www.revitapidocs.com/2018.1/5018fbdb-e7c3-6e32-7ca3-ee5c20dbc56f.htm) . But, with Dynamo constantly having a transaction open it is also limiting me.


I wonder if this is where a transaction start/end would come in handy. Maybe it needs to completely load the file before running anything on it? I could be way out of line here…

Yeah I attempted to force close the Dynamo transaction, and I still received that error.

Perhaps @erfajo has some insight he can share?