Place multiple views on multiple sheets by coordinates

@Daniel_Woodcock1 @jacob.small

I wanted to add this here because I am having similar issues to above.
When running the python script I am getting the List[object] has no attribute ‘Id’ error…

I am feeding multilevel lists into the python script at each level.
If I add [0] to each input of the codeblock as suggested above the python script works but adds views on the first sheet…

I’m not very familiar with Python. Any thoughts on how I can fix this?
Thanks,

Have you tried using the Viewport.Create node in Rhythm? You may need a few minutes of trial and error to get your input levels correct, but after that it works a treat.

Place list of Views on list of Sheets by list of Points - Python for Revit Dynamo · GitHub should do it.

I’ve a problem with the script. I’ve got a output “null” could someone help me with this?

You have no inputs for sheets and points in your codeblock. Also use a small S and small P to name “sheet” and “points”

This one requires 3 equal-length flat lists as inputs.

#based on code by Julien Benoit @jbenoit44 
#http://aecuandme.wordpress.com/
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
# Import ToDSType(bool) extension method
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
# Import geometry conversion extension methods
clr.ImportExtensions(Revit.GeometryConversion)
# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
from System.Collections.Generic import *
# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

sheets = []
for i in IN[0]:
	sheets.append(UnwrapElement(i))
views=[]	
for i in IN[1]:
	views.append(UnwrapElement(i))
points=[]	
for i in IN[2]:
	points.append(UnwrapElement(i).ToXyz())

# Start Transaction
TransactionManager.Instance.EnsureInTransaction(doc)
viewp=[]
#for s in sheets:
#	for v,p in zip(views,points):
#		a=Viewport.Create(doc, s.Id,v.Id, p)
#		viewp.append(a)
cnt = 0		
for cnt in range(len(sheets)):  
    a=Viewport.Create(doc, sheets[cnt].Id,views[cnt].Id, points[cnt])
    viewp.append(a)

# End Transaction
TransactionManager.Instance.TransactionTaskDone()

OUT=viewp
1 Like

Your list depths look incorrect. Sheets should be a flat list (no sublists) and views + location lists should be identically nested lists 1 level deep. So, for each sheet there should be a list of views to place on it and their positions. If you have a list of sheets, then you should have a list of lists for views/positions. Please see this post which explains this further…