Get/set location of schedule graphics on sheet

This should do the trick:

Here’s code for the Sheet.Schedules node:

# Copyright(c) 2017, Konrad K Sobon
# @arch_laboratory, http://archi-lab.net

import clr
import sys
pyt_path = r'C:\Program Files (x86)\IronPython 2.7\Lib'
sys.path.append(pyt_path)

clr.AddReference("RevitNodes")
import Revit

clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)

clr.AddReference("RevitServices")
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument

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


def process_list(_func, _list):
    return map(lambda x: process_list(_func, x) if type(x) == list else _func(x), _list)


def get_schedules(item):
    return FilteredElementCollector(doc, ElementId(item.Id)).OfClass(ScheduleSheetInstance).ToElements()


output = []
try:
    errorReport = None
    output = process_list(get_schedules, IN[0])

except:
    # if error occurs anywhere in the process catch it
    import traceback

    errorReport = traceback.format_exc()

if errorReport is None:
    OUT = output
else:
    OUT = errorReport

Here’s code for the Schedule.SetLocation node:

# Copyright(c) 2017, Konrad K Sobon
# @arch_laboratory, http://archi-lab.net

import clr
import sys

pyt_path = r'C:\Program Files (x86)\IronPython 2.7\Lib'
sys.path.append(pyt_path)

clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

clr.AddReference("RevitNodes")
import Revit

clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)

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

doc = DocumentManager.Instance.CurrentDBDocument

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


def process_list(_func, _list):
    return map(lambda x: process_list(_func, x) if type(x) == list else _func(x), _list)


def set_location(item, location=IN[1].ToXyz()):
    schedule = UnwrapElement(item)
    schedule.Point = location
    return item

output = []
try:
    errorReport = None
    TransactionManager.Instance.EnsureInTransaction(doc)
    output = process_list(set_location, IN[0])
    TransactionManager.Instance.TransactionTaskDone()
except:
    import traceback

    errorReport = traceback.format_exc()

# Assign your output to the OUT variable
if errorReport is None:
    OUT = output
else:
    OUT = errorReport

The general idea here is that you select all ScheduleSheetInstance object. Those are basically schedules placed on a sheet. The only trick here is that a Revision Schedule is also a ScheduleSheetInstance so we need to get rid of it. Then we collect just the one that we need based on a name and finally set all of their locations to the same position so all our schedules nicely align from sheet to sheet.

Ps. Sheet location is relative to view origin which is not always titleblocks bottom/left corner. Keep in mind that user could have moved the titleblock and in that case this will align all schedules but you would need need to also first align all Titleblocks to get the desired result. That’s however, a different topic so if you wish for someone to help with that, just start a new topic.

8 Likes