ARTICLE AD BOX
I try create a new schedule in revit 2022+ using C#. I can create schedule, filters and query add SchedulableFields.
But when I try to create a new calculate field I get errors.
I've seen old forum questions about this topic but users were told that it wasn't possible. It's been many years so has the situation changed?
The code for adding the calculation field
//function input created Schedule and field properties static public void CreateCalculateField(ViewSchedule schedule, string configScheduleParameterHeading, string configScheduleParameterWidth, string configScheduleParameterHidden) { SchedulableField field = new SchedulableField(ScheduleFieldType.Formula); //error line ScheduleField newField = schedule.Definition.AddField(field); //set properties newField.HorizontalAlignment = ScheduleHorizontalAlignment.Center; newField.GridColumnWidth = UnitUtils.ConvertToInternalUnits(Convert.ToDouble(configScheduleParameterWidth), UnitTypeId.Millimeters); newField.IsHidden = Convert.ToBoolean(configScheduleParameterHidden); }