Getting Dynamo to select 'Include element in links' for schedules

Hello All,

Very new to Dynamo but I have a project which has had hundreds of schedules created but set up incorrectly. I’ve managed to get to the add / remove and sort parameters but cant find how to automate the ‘include elements in links’ check box in the schedule properties dialogue (image below).

image

Is there something I’m missing here? Any help greatly appreciated.

Hello,

I have the same issue right now. Does anyone know how to do it with any node or with python?

This can be achieved with a bit of Python. Create a Python script node and paste the code below. It takes a list of schedules as an input.

Not all schedules have the ability to include linked files (e.g. keynote legends) so the output has a list of the schedules accompanied by a report of booleans to show whether it was successful or not

# Enable Python support and load DesignScript library
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

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

clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *

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

doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

schedules = UnwrapElement(IN[0])

out = []
report = []

for schedule in schedules:
	if schedule.Definition.CanIncludeLinkedFiles:
		try:
			TransactionManager.Instance.EnsureInTransaction(doc)
			schedule.Definition.IncludeLinkedFiles = True
			TransactionManager.Instance.TransactionTaskDone()
			out.append(schedule)
			report.append(True)
		except:
			out.append(schedule)
			report.append(False)	
	else:
		out.append(schedule)
		report.append(False)

OUT = out, report
3 Likes

How would I edit this code to work with one schedule instead of a list of schedules?

Hey Icarr,

Maybe you should put this one schedule in a list containing only this schedule. that will work aswell.
otherwise you need to get rid of the for statement:

doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

schedules = UnwrapElement(IN[0])

out = []
report = []

if schedule.Definition.CanIncludeLinkedFiles:
	try:
		TransactionManager.Instance.EnsureInTransaction(doc)
		schedule.Definition.IncludeLinkedFiles = True
		TransactionManager.Instance.TransactionTaskDone()
		out.append(schedule)
		report.append(True)
	except:
		out.append(schedule)
		report.append(False)	
else:
	out.append(schedule)
	report.append(False)

OUT = out, report

i think that will work

Perfect! Thank you. I had a feeling it was the “for” statement. I’ll give it a try.
As far as using a list with one item, I tried to use a list with one item and it returned an error. When I added another item it worked. I’ll let you know how it goes.

As @Coen_Ooijevaar has done, the Python code can be altered to expect a single schedule. It was originally written to expect a list, so a single item will fail because it is not iterable. Alternatively, you can feed a list with one item and it will work.

1 Like