Panel Schedule Spares copy from one Panel schedule to another Panel schedule

venkatadanarao_onteru
Explorer

Panel Schedule Spares copy from one Panel schedule to another Panel schedule

venkatadanarao_onteru
Explorer
Explorer

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 ?

 

@jeremytammik 

0 Likes
Reply
186 Views
3 Replies
Replies (3)

jeremy_tammik
Autodesk
Autodesk

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:

   

  • Set up your BIM manually in the UI
  • Perform the required modification manually in the UI
  • Analyse the resulting changes in the Revit database in the elements, their properties and relationships using RevitLookup and other db exploration tools

   

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?

   

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes

venkatadanarao_onteru
Explorer
Explorer

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"

0 Likes

venkatadanarao_onteru
Explorer
Explorer

Someone please help with this 

0 Likes

Type a product name