My main purpose is to assign communication device to seperate panels.
As you can see in the example above, one connector of the family is assigned to a panel, and the other connector is not assigned. I want to get the connectors which are not assigned.
If i can get the connector electrical system i can filter those connectors.
I’m using the following python code to assign the connectors to the circuit. But this code always creates a new circuit and assign more than one electrical system to a connector.
Any ideas?
import clr
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)
if isinstance(IN[0], list):
connectors = IN[0]
else:
connectors = [IN[0]]
listout = []
TransactionManager.Instance.EnsureInTransaction(doc)
for conn in connectors:
ckt = conn.ElectricalSystemType
#Revit 2017 and older:
#newckt = doc.Create.NewElectricalSystem(conn,ckt)
#Revit 2018 and newer:
newckt = Electrical.ElectricalSystem.Create(conn,ckt)
listout.append(newckt.ToDSType(False))
TransactionManager.Instance.TransactionTaskDone()
OUT = listout