Placing ScheduleViews on Sheets

Hey, i have a problem with adding a list of existing Schedules to list of existing Sheets.

I think I have all my data correct, number of sheets is the same as number of schedules, I’ve even provided same number of exact same points…

I checked other topics on this forum related to this question, none of solutions/nodes work.
I’ve tried Julien Benoit python code, I’ve tried PlaceViews nodes from Steam, Create.Viewport from Rhythm. They return all different kinds of error messages.

Can you guys help?

Hello
try this

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
clr.AddReference("RevitNodes")
import Revit
# Import ToProtoType, ToRevitType 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

toList = lambda x : x if hasattr(x, "__iter__") else [ x ]

sheets = toList(UnwrapElement(IN[0]))
views = toList(UnwrapElement(IN[1]))
points = toList(UnwrapElement(IN[2]))

# Start Transaction
TransactionManager.Instance.EnsureInTransaction(doc)
out = []
for s in sheets:
	for v,p in zip(views,points):
		a = ScheduleSheetInstance.Create(doc, s.Id, v.Id, p.ToXyz()) 
		out.append(a)

# End Transaction
TransactionManager.Instance.TransactionTaskDone()

OUT=out

Note:
“Internal” schedules can’t be placed on sheet

1 Like

Whoa, that was quick. Thank you! I need to finally get into python for revit, this seems to solve most of the problems.

There is one issue though - this code always splats out two of instances of the same Schedule on Sheet - am I feeding it wrong perhaps?

@filip.kabelis
strange…
the list of Points (IN[2]) and the list of ViewSchedule (IN[1]) must be same length
IN[0] are sheets to place

I fed it only 1 point, 47 sheets and 47 schedules. As it’s seen in post above it did work on all sheets, but twice.

When I fed it 47 same points, 47 sheets and 47 schedules, it’s somehow added 47 schedules to every view…:slight_smile:

Other problem i’ve noticed it adds same schedule to every view …
image

It’s the same ViewSchedule to place on other sheets?

What i’m looking for is to place corresponding Schedules on their Sheets. Lists are already sorted and of same lenght, but this script places only first Schedule from list on all Sheets

Hey, i found another code that seems to work for me!

import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)

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

doc = DocumentManager.Instance.CurrentDBDocument
sheets = IN[0]
views = IN[1]
x = IN[2]
y = IN[3]
viewsplaced = list()

TransactionManager.Instance.EnsureInTransaction(doc) # you need an active transaction as you will create elements

for number in range(len(sheets)):
	sheet = UnwrapElement(sheets[number])
	view = UnwrapElement(views[number])
	ScheduleSheetInstance.Create(doc, sheet.Id, view.Id, XYZ(x,y,0))
	viewsplaced.append(view.ToDSType(False))
	
TransactionManager.Instance.TransactionTaskDone()
OUT = viewsplaced
1 Like

another way

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
clr.AddReference("RevitNodes")
import Revit
# Import ToProtoType, ToRevitType 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

toList = lambda x : x if hasattr(x, "__iter__") else [ x ]

sheets = toList(UnwrapElement(IN[0]))
views = toList(UnwrapElement(IN[1]))

# Start Transaction
TransactionManager.Instance.EnsureInTransaction(doc)
out = []
for v, s in zip(views, sheets):
	a = ScheduleSheetInstance.Create(doc, s.Id, v.Id, XYZ.Zero) 
	out.append(a)

# End Transaction
TransactionManager.Instance.TransactionTaskDone()

OUT=out
1 Like