Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Automatically Connect Load to Panel

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
opferjohn
1056 Views, 2 Replies

Automatically Connect Load to Panel

I have an electrical load with 9 connectors and would like to automatically connect each of them to a panel by having the user select the load and panel.  My current approach is to create an electrical system for each connector and set the panel.  I am able to create electrical systems, however when I use the SelectPanel method and pass in the panel, I am given the error "The panel and circuit do not match".

 

The panel and load are the same voltage and both have the same number of phases.  I am able to manually connect them (Select load, click Power, ect...) without any problems, so why am I getting an error here?  Here is the snippet of code in which I create the electrical system for one connector and attempt to select the panel (load and panel are both FamilyInstance types):

 

TransactionManager.Instance.EnsureInTransaction(doc)
newElectricalSystem = Autodesk.Revit.DB.Electrical.ElectricalSystem
loadConnectorIterator = load.MEPModel.ConnectorManager.UnusedConnectors.ForwardIterator()
loadConnectorIterator.MoveNext()
loadConnector = loadConnectorIterator.Current
circuit = newElectricalSystem.Create(loadConnector, ElectricalSystemType.PowerCircuit)
TransactionManager.Instance.TransactionTaskDone()
circuit.SelectPanel(panel)

 

I am using Revit 2019 and coding in Python using Dynamo

2 REPLIES 2
Message 2 of 3
jeremytammik
in reply to: opferjohn

I believe the Revit SDK PowerCircuit sample demonstrates some of the functionality you require. Please take a look at that.

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 3 of 3
opferjohn
in reply to: jeremytammik

Thanks for the reply @jeremytammik .  I placed another panel(same family and type as the first), ran it with the same code, and it worked and works for all other panels I am using this code with.  I'm not sure why it was giving me errors before, but all is well now.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Rail Community