MaterialTakeoff definition.GetFieldOrder() returning empty list

I’m trying to use the code from here to get the ScheduleField list from my material takeoff schedule. Since the standard “ScheduleView.Fields” node was returning an empty list.

For a MaterialTakeoff schedule, the line:
ids = definition.GetFieldOrder()
returns an empty list.

I’ve been searching around, but i can’t find the correct method which i should be using for MaterialTakeoff schedules to get the fields.

The code i’m using:

import clr

from Autodesk.Revit.DB import*

schedule = UnwrapElement(IN[0])
definition = schedule.Definition
ids = definition.GetFieldOrder()
fieldnames = []

def getFields(schedule):
    definition = schedule.Definition

for id in ids:
    param = definition.GetField(id)

 OUT = fieldnames

Maybe somebody here has an idea? :sweat_smile: