Referencing an existing Schedule Instance

Referencing an existing Schedule Instance

grahamcook
Advocate Advocate
515 Views
1 Reply
Message 1 of 2

Referencing an existing Schedule Instance

grahamcook
Advocate
Advocate

Hi

Part of one of my Addins will create and place schedules on a sheet.  The sheets have layout options that the user can choose, so I need to be able to get a handle on the existing schedule and move it around the sheet.  Problem is when I iterate through the Views collection on the sheet the Schedule is not present.  I have also tried ViewSheet.GetAllViewports() but again schedules are not present in the returned set.  Does anyone know how I can get a reference to an existing Instance of a schedule on a sheet?

 

Actually, just before I submitted this one I thought I would think it through...

 

Came up with this that seems to work so thought I would share it:

 

var scheduleColl = from elements in new FilteredElementCollector(doc)
                  .OfClass(typeof(ScheduleSheetInstance))
                  let type = elements as ScheduleSheetInstance
                  where type.OwnerViewId == viewSheet.Id
                  select type;

foreach (ScheduleSheetInstance ssi in scheduleColl)
{
    ssi.Point = new XYZ(2, 2, 0);
}

 

Accepted solutions (1)
516 Views
1 Reply
Reply (1)
Message 2 of 2

Joe.Ye
Alumni
Alumni
Accepted solution

 

Good solution by checking the owner view Id.

Thanks for sharing this.

 



Joe Ye
Contractor
Developer Technical Services
Autodesk Developer Network
0 Likes