By Aaron Lu
In Revit, when we create schedule, Revit will provide a list of fields for us to choose,
The corresponding way to get a list of fields in API is using method ViewSchedule.ScheduleDefinition.GetSchedulableFields(), but somehow it returns more fields than we see in the UI, what are the invisible guys?
It turns out that in the UI, besides the visible fields, we can also add shared or project parameter as field by clicking "Add Parameter", which is why there are more fields return by API.
So the question is: how to know those fields are invisible in the list in UI?
Answer: by checking the ParameterId of SchedulableField is greater than 0 or not, if it is greater, then it is shared or project parameter.
var fields = viewSchedule.Definition.GetSchedulableFields(); foreach (var field in fields) { if (field.ParameterId.IntegerValue < 0) { // parameter visible in the UI } else { // shared or project parameter } }