& Construction

Integrated BIM tools, including Revit, AutoCAD, and Civil 3D
& Manufacturing

Professional CAD/CAM tools built on Inventor and AutoCAD
Integrated BIM tools, including Revit, AutoCAD, and Civil 3D
Professional CAD/CAM tools built on Inventor and AutoCAD
Hii sir,
I have 100 Panel schedules, and I need to assign Spares for all 100 Panel schedules like I have one reference. In Reference Panel Schedule I have 2 phase and 3 phase and single-phase Spare circuits.Please help with this i tried searching APIDocs but i didn't find any Class and Properties ?
The best place to start looking for the appropriate API classes and properties is by examining the manually created schedule using RevitLookup and other API-based database exploration tools, cf.,
How to research to find a Revit API solution:
The standard approach to research how address a task programmatically goes like this:
The knowledge of the manual modification steps and the resulting db changes will help determine how to achieve the same programmatically.
So, how do you create the desired spares manually in the UI?
Hii Sir,i'm using following methode to add spares
I'm facing error like below if i'm running python script for adding spares.Please help and could you please explain where i'm doing mistake sir.
import clr
clr.AddReference('RevitAPI')
clr.AddReference('RevitServices')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Electrical import *
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
def create_panel_filter(panel_name):
param_provider = ParameterValueProvider(ElementId(BuiltInParameter.PANEL_SCHEDULE_NAME))
filter_rule = FilterStringRule(param_provider, FilterStringEquals(), panel_name, False)
element_filter = ElementParameterFilter(filter_rule)
return element_filter
def create_panel_filter1(panel_name1):
param_provider = ParameterValueProvider(ElementId(BuiltInParameter.PANEL_SCHEDULE_NAME))
filter_rule = FilterStringRule(param_provider, FilterStringContains(), panel_name1, False)
element_filter = ElementParameterFilter(filter_rule)
return element_filter
panel_name = "DB1"
panel_name1 = "TOOL"
filter = create_panel_filter(panel_name)
filter1 = create_panel_filter1(panel_name1)
source_schedule = FilteredElementCollector(doc).OfClass(PanelScheduleView).WherePasses(filter).FirstElement()
DES_schedule = FilteredElementCollector(doc).OfClass(PanelScheduleView).WherePasses(filter1).FirstElement()
TransactionManager.Instance.EnsureInTransaction(doc)
table_data = source_schedule.GetTableData()
# Get the number of rows and columns in each section
body_section = table_data.GetSectionData(SectionType.Body)
body_rows = body_section.NumberOfRows
body_cols = body_section.NumberOfColumns
l=[]
for row in range(body_rows):
for col in range(body_cols):
value = source_schedule.IsSpare(row, col)
l.append(value)
if value is True:
if col < body_cols: # Ensure column number is valid
DES_schedule.AddSpare(row,col)
TransactionManager.Instance.TransactionTaskDone()
OUT = l
ERROR is "Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File "<string>", line 46, in <module>
Exception: The given column number nCol is invalid in Body.
Parameter name: nCol"
Someone please help with this
How to buy
Privacy | Do not sell or share my personal information | Cookie preferences | Report noncompliance | Terms of use | Legal | © 2025 Autodesk Inc. All rights reserved
Type a product name