Open Revit Sheets in Bulk

Hello Forum - I’m looking for a way to open Revit Sheets in bulk. (I need to adjust the view title locations, and the best way I’ve found to do it involves opening a bunch of sheets at once, usually based on a keyword.)
I’ve gotten far enough with lists & boolean masks that I feel confident that I have an accurate list of sheet elements in Dynamo, but once I have my list, I’m struggling to find a node that will let me open the sheets. I saw a few older posts on the topic without solutions.
Can you point me towards a solution (if that type of functionality exists)?

Thanks in advance for your help!

I’m pretty new to Dynamo, so I’m hoping there’s something accessible that I’m typing in the wrong order or without a ‘.’ to find the right node.

Here’s the script so far - it’s a list of sheets - I’d like to take this list and open all of those “Area A” views in this example.

You don’t have to open the view in order to modify it.

1 Like

I need to modify the position of the View Title of a viewport placed on all of these sheets - is there a way to access that without opening the sheet directly?

The only reason to open a view would be to do something like get all elements in active view, but that’s not usually necessary. I don’t know about View Titles specifically because I’ve never had to mess with them, but you can get the Viewports from the Sheets using something like GetViewportsAndViews from Rhythm. That’s where I’d start.

View Titles are also a little weird to begin with. I don’t know if what you’re trying to do is even possible through the API.

Unfortunately, you cannot move viewport titles in the API. :disappointed:

@john_pierson I didn’t think we could access the view titles directly, so the best workaround has been to open all the sheets, tile the windows, & grab all of the view titles to move them consistently all at once… (based on Aaron’s suggestion)

My hope for speeding up this process is to use Dynamo to open multiple sheets based on a keyword. Then I’m not picking & choosing from the sheet browser anymore after we move scope boxes for views that have already been placed on sheets.

This would only work if the view titles are already in the same exact location on each sheet.
It might be easier to just remove and replace the views.

Thanks @Nick_Boyts - We do already have the views on the sheets in exactly the same location, so when the scope box moves, all the views move out of alignment with the view titles the same amount. When I place new views on the sheets, the view titles still need to be tweaked on all of the sheets.

I feel like my best bet is finding some way to open sheets in bulk since moving the View Title through Dynamo doesn’t seem to be an option.

I’ve been reading a post from December, and I think the simple answer to my question is that there isn’t a node in any of the major packages that uses Dynamo to open a sheet or a list of sheets. Call View to Open

It seems like there’s python code from @Nick_Boyts for opening a view, and that can be modified to open a sheet or a list of sheets… if I look into modifying the python code or creating a custom node and use lacing. Am I on the right research path?

import clr
clr.AddReference(“RevitNodes”)
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
from Revit.Elements import *
clr.AddReference(‘System’)
from System.Collections.Generic import *
clr.AddReference(‘RevitAPI’)
from Autodesk.Revit.DB import *
clr.AddReference(‘RevitServices’)
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
#The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN
myView = UnwrapElement(IN[0])

uiapp.ActiveUIDocument.RequestViewChange(myView)

#Assign your output to the OUT variable.
OUT = "ActiveView set to: " + myView.Name

The trouble is that this just isn’t a great solution, unfortunately. So, yes, this is going down the right path for what you’re asking, but you may not be asking the right questions for the problem you have. I don’t know if you can even open multiple views in a single transaction. And then you’d still have to tile all the views and manually select each one of the view titles.

Try to solve the question: “How can I best accomplish my goal on the first try?” Make the process work from start to finish rather than trying to fix a broken solution. That should give you a clearer path.

This will do multiple sheets, then you can just window tile them all. (WT on keyboard)

import clr
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
from Revit.Elements import *
clr.AddReference("System")
from System.Collections.Generic import *
clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import *
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
#thanks to springnodes for this
    def tolist(obj1):
    	if hasattr(obj1,"__iter__"): return obj1
    	else: return [obj1]

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
#The inputs to this node will be stored as a list in the IN variables.
myViews = tolist(UnwrapElement(IN[0]))

for view in myViews:
	TransactionManager.Instance.ForceCloseTransaction()
	uiapp.ActiveUIDocument.RequestViewChange(view)
#Assign your output to the OUT variable.
OUT = myViews

4 Likes

My guess: WT on a model with 800 sheets = instant crash due to view regen requirements.

I look forward to trying it myself later this week!

Aaron’s done it on a lot of views. So weak machines = crash. :rofl:

2 Likes

@john_pierson thank you so much! works like a charm.

Capped at 397 for me. :frowning:

2 Likes

@JacobSmall: rookieNumbers.gif

1 Like

Thank you for your code john! by any chance do you know how I can chance the python code to only open on sheet? If I input one sheet I get this error.
image

Thank you for your time

Hi there!

Yes, you are inputting one element (Sheet) into the node and the way it is designed it expects a list.

You can simply use the node TurnIntoList from the clockwork package to convert your single sheet to a list. :slight_smile:

or, you can recopy the code from above as I added list handling to it now. :slight_smile:

1 Like

Thank you very much John!!
Have a wonderful day