Change electrical circuit number


I am trying to make a way to change circuitnumbers to desired number instead of the automatic setup that is in Revit by default.

I have been looking in the RevitAPI, and it seems that there is a method for this :
[](http://(PanelScheduleView -> MoveSlotTo))

However the input is row and cell number, which is kind of wierd, since moving a circuit includes moving the whole row of a panel schedule. Maybe I am looking in the wrong place?

  • Does anyone know how I can change a circuit number in a panel to have another (chosen) circuit number?

I have tried making a python script for this, and this is how far I have gotten at the moment + error message.

My code:

import clr
from Autodesk.DesignScript.Geometry import *

from Autodesk.Revit.DB.Electrical import *
#The inputs to this node will be stored as a list in the IN variables.

OUT = list()
cellsfrom = list()
cellsto = list()

def tolist(input):
	returnlist = list()
	if isinstance(input, list):
		for item in input:
		returnlist = [UnwrapElement(input)]
	return returnlist

PS = tolist(IN[0])
movefrom = tolist(IN[1])
moveto = tolist(IN[2])

for i in range(0, len(PS)):
	cellsfrom = PS[i].GetCellsBySlotNumber(movefrom[i])
	cellsto = PS[i].GetCellsBySlotNumber(moveto[i])
	for x in cellsfrom[1]:
		PS[i].MoveSlotTo(movefrom[i], x, moveto[i], x)
OUT = cellsfrom, cellsto

Anybody? :frowning:


Keep in mind you can’t move a circuit to an occupied slot.

This is the code I use.

import clr
from Autodesk.Revit.DB import *
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
#The inputs to this node will be stored as a list in the IN variables.

PS = UnwrapElement(IN[0])
nMovingCol = IN[1]
nMovingRow = IN[2]+1
nToCol = IN[3]
nToRow = IN[4]+1



OUT = "Done"
1 Like

I get error on nMovingCol. What number input do you give for the columns?

It’s columns in the schedule, starting at 1, but I believe you can only move the slot. That’s 1 in my schedule and looks like the same for yours.

1 Like

Thank you so much for helping out :slight_smile:

Do you see what might be causing the error here?
I am trying to move circuit 104 to open slot 105.
There are 9 Header rows, so i have also tried inputing 113 to 114, with the same result.

By header rows i mean these:

You have your columns and rows switched. The inputs are (PanelScheduleView, nMovingCol, nMovingRow, nToCol, nToRow).


Oh my god. Can we pretend that was never posted?

Thank you so much :slight_smile:
That was all that was needed!

1 Like


I am getting different error. Do you have any idea why i am getting this error ?

Try inputing the PanelScheduleView Element instead of the Panel Schedule Name parameter into IN[0].

The error says that the data type “String” does not have an attribute called MoveSlotTo.
This is because the parameter you input to IN[0] is text, in other words a string, but a PanelScheduleView element is expected.

Hope that helps.