How to get the elements associated with each row in a Schedule using Revit API?

How to get the elements associated with each row in a Schedule using Revit API?

mespinosagKJG49
Community Visitor Community Visitor
238 Views
2 Replies
Message 1 of 3

How to get the elements associated with each row in a Schedule using Revit API?

mespinosagKJG49
Community Visitor
Community Visitor

Hi everyone,

I'm working with the Revit API in C# and I need some help understanding how to map elements to individual rows in a Schedule.

So far, I can do the following:

  • I can get the rows of the schedule:
   ViewSchedule viewSchedule = viewSchedules.First(vs => vs.Name == schedule.Name);

   TableData tableData = viewSchedule.GetTableData();
   TableSectionData body = tableData.GetSectionData(SectionType.Body);

 

  • I can get the scheduled elements:
ICollection<ElementId> elementIds = viewSchedule.GetDependentElements(null);

 However, what I really need is to figure out how to get the element (or elements) associated with each specific row in the schedule.

Is there a direct way to do this in the API?

Any help or example would be much appreciated.

Thanks!

 

0 Likes
239 Views
2 Replies
Replies (2)
Message 2 of 3

TripleM-Dev.net
Advisor
Advisor

As far as I know you can't directly get the element(s) associated with specified rows in a schedule.

 

GetDependentElements, will return more elements than needed.

Use a FilteredElementCollector and set as ViewId the schedule

Schedules in this respect behave like any other view so you get all elements listed in the schedule

Note:

- selection doesn't work directly, unless you activate a model view after selecting rows

- For Area and Rooms the "Not placed etc" setting is ignored and all are retrieved (with respect to filters)

 

To id the elements for a Row you would need to rebuild the filtering and grouping/sorting of the schedule, get all parameter fields etc. in you're app

And then compare that to the values in the rows....and then it may or may not be accurate.

 

- Michel

0 Likes
Message 3 of 3

ctm_mka
Collaborator
Collaborator

try "GetCellText" from the ViewSchedule itself. Dont know if you can actually get this info, but heres what Revit Lookup is showing:

ctm_mka_0-1748381586324.png

 

0 Likes