Hi,
I work on Python script that creates and edits schedules.
I wish to edit the headings of schedule columns - the row that contains the parameter names, below the schedule title. It can be overridden to any other text in UI. As far as I understand, it is the row no. 0 of the Body type of TableSectionData.
I can successfully edit the schedule title, however, when I try to edit the column headers I get the exception ā This operation is forbidden for cells in standard schedule body sections.ā.
Does it mean that you cannot really edit this row through API, even though you can edit it with UI?
Please see a part of my code (choosing any schedule in the model and trying to override first cell in the column heading).
import clr
clr.AddReference("ProtoGeometry")
from Autodesk.DesignScript.Geometry import *
# Import RevitNodes
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)
clr.AddReference("RevitAPI")
clr.AddReference("RevitAPIUI")
import Autodesk
from Autodesk.Revit.DB import *
# Import Revit elements
from Revit.Elements import *
# Import DocumentManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
from System.Collections.Generic import *
import sys
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
adoc = doc.ActiveView
schedule = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Schedules).WhereElementIsNotElementType().FirstElement()
TransactionManager.Instance.EnsureInTransaction(doc)
tableData = schedule.GetTableData()
tableBody = schedule.GetTableData().GetSectionData(SectionType.Body)
tableBody.SetCellText(0, 0, "MY TEXT")
TransactionManager.Instance.TransactionTaskDone()