How to duplicate a split schedule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all,
My research came up fairly empty hence the post. I need to duplicate sheets via the API and I'm struggling to create exact duplicates of schedules that were split in two or more parts and placed on the same sheet.
I'm doing some tests on how to achieve that and I can manage to split a schedule using the Split(IList(Double)) however, despite Revit Lookup telling me that my schedule is split, it's shown as one single schedule in the sheet.
Part 1
I split the schedule via the UI and collected their segment heights via the API (as I couldn't find that method in Revit Lookup).
var allScheduleSheetInstance = new FilteredElementCollector(doc, doc.ActiveView.Id).OfClass(typeof(ScheduleSheetInstance));
var splitSchedIds = new HashSet<ElementId>();
foreach (ScheduleSheetInstance schedInst in allScheduleSheetInstance)
{
var viewSched = doc.GetElement(schedInst.ScheduleId) as ViewSchedule;
if (!schedInst.IsTitleblockRevisionSchedule && viewSched.IsSplit() == true)
{
splitSchedIds.Add(viewSched.Id);
}
}
foreach (var splitSchedId in splitSchedIds)
{
var viewSched = doc.GetElement(splitSchedId) as ViewSchedule;
int segCount = viewSched.GetSegmentCount();
for (int i = 0; i < segCount; i++)
{
TaskDialog.Show("Title", $"SEGMENT HEIGHT: {viewSched.GetSegmentHeight(i)}");
}
}
Part 2
I then hard coded the heights as a list and passed it to Split() but no success as mentioned before. The schedule is reported as split but it looks the same in the sheet. Any help would be very appreciated.
var allScheduleSheetInstance = new FilteredElementCollector(doc, doc.ActiveView.Id).OfClass(typeof(ScheduleSheetInstance));
foreach (ScheduleSheetInstance schedInst in allScheduleSheetInstance)
{
var viewSched = doc.GetElement(schedInst.ScheduleId) as ViewSchedule;
if (!schedInst.IsTitleblockRevisionSchedule && viewSched.IsSplit() == false)
{
var segHeights = new List<double>(){ 0.25, 0.34 };
viewSched.Split(segHeights);
}
}
I'm finding the relationship between ScheduleSheetInstance and ViewSchedule very odd. I can have several instances of the same ViewSchedule in different sheets but the IsSplit() method can be found in the ViewSchedule class, not in ScheduleSheetInstance. Also, I can split a schedule in one sheet and leave it as a whole in another but both are reported as split.