Multiple Views on Sheets

Hey, I’m working on a python script to place multiple views on sheets. At the moment it takes a list of sheets and a list of views and places all the views on the first sheet then when it gets the 2nd sheet it errors because it tries to place the entire list of views on the 2nd sheet again. I’m hoping to be able to feed it a list of sheets and a list of views with sublists the same length as the sheet list. So when it runs at the first sheet it would place whatever views are contained in the first sublist, at the 2nd sheet the views in the 2nd sublist, etc.

Below is what I have so far but I don’t know how to make it accept a sublist. Any help or a nudge in the right direction would be much appreciated. Below is what I have so far.

Multiple Views on Sheets

Hi Jimmy,

I already have a script that can place multiple views on different sheets. Give me sometime i will post. I am driving now.

That’d be great! Thanks! So far I haven’t been able to find any that will work with structural plans.

Hi Jimmy,

Below is the screenshot of the workflow. I guess this is what your looking for.

 

Untitled

Unfortunately the sheet.byname… node does not work with structural plans. This is why I’m trying to do something with python. Thank you kulkul

Also rather than adding one view per sheet I’m hoping to be able to add anywhere between 2 and 4 views per sheet depending on my list of views

I tried the following and got a little closer but still not quite there. It now accepts the sublist of views and places the views of the first sublist on the first sheet. Except then I think it tries to place the first sublist of views on the 2nd sheet as I’m getting the following error Exception: viewId cannot be added to the ViewSheet. So I assume the views it’s trying to place are already on a sheet.

Multiple Views on Sheets - dynamo Multiple Views on Sheets2

Hi Jimmy,

I think it is expecting Views. Your trying to feed View Id’s that’s the reason your getting error “View Id cannot be added to the View Sheet”.

The first 2 views in the list (IDs 2733275, 6777777) are placed on the first sheet in the list (ID 6586160) so the first iteration is performing correctly. But in the next iteration I think it’s failing because it’s trying to place those 2 views again. I was getting the same error earlier when I knew I was accidentally trying to place a view on a sheet that was already on another sheet.

Thanks.

Jimmy i am not able see your Python script. I cannot enlarge the screenshot. Can you re-post it.

Thanks,

I don’t seem to be able to post any pictures so the script is just in text below. Each for loop is nested within the one before, just can’t indent properly by text.

import clr

clr.AddReference(‘RevitAPI’)
clr.AddReference(‘RevitAPIUI’)
from Autodesk.Revit.DB import *
import Autodesk
import sys

clr.AddReference(‘RevitServices’)
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument

result = []

TransactionManager.Instance.EnsureInTransaction(doc)

viewlists = []
for i in IN[1]:
viewlists.append(UnwrapElement(i))
for viewlist in viewlists:

sheets = []
for i in IN[0]:
sheets.append(UnwrapElement(i))
for sheet in sheets:

views = []
for i in viewlist:
views.append(UnwrapElement(i))
for view in views:
fview = Viewport.Create(doc,sheet,view,XYZ(0,0,0))
result.Add (fview)

TransactionManager.Instance.TransactionTaskDone()

OUT = result