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.

Thanks!

2 Likes

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

2 Likes

Hi @carlosguzman,

I’m thinking you will need access to this method:
http://www.revitapidocs.com/2018.1/535f4910-37e0-0f46-924a-443899587d95.htm

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!

-john

2 Likes

Awesome @john_pierson thanks a lot!

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

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

3 Likes

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?

I am using Johns opening/closing methods in combination with my nodes, and I am sure if John says that it is not possible at the moment, then it is not :slight_smile:

But I recognize a minor change in your nodes @john_pierson … I am looking forward to your next release :slight_smile:

2 Likes