Connector ElectricalSystem

Is it posible to get the connector Electrical System?

I can get the element electrical system but i have two “Communication” connectors in one family. So i need to remove specific connector from circuits.

Thanks.

I know all the connector nodes can be a bit confusing, but I think you are looking for ‘Connector.ConnectorSystemType’.
image

My main purpose is to assign communication device to seperate panels.
Electrical1
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

I see what you mean: there is no way to see if a connector is already connected to a panel. I would expect ‘Connector.MEPSystem’ to work, but it seems it does not :frowning:
The only direct workaround I can think of right now is by using the ‘AllRefs’ property. This will return a ConnectorSet of all the references to the connector. If that ConnectorSet is empty then it is not connected to anything. So in that case you will know that it is not connected to a panel.
Here’s the code:

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 = []	
for connector in connectors:
	sys = None
	try:
		refs = connector.AllRefs
	except:
		pass
	listout.append(refs)

			
#Assign your output to the OUT variable.

OUT = [c.IsEmpty for c in listout]

image

2 Likes

Thanks for your help.

1 Like