Get wire list connected to electrical equipment (panel)

Dear Experts,
I was trying to get list of wire connected to specific Electrical Equipment (Panel).

  • I tried MepOver package MEP connector info but no any result.
  • I tried Connector.ConnectedElements returned only one of wire element. Other wire elements missing.
    Any recommendation python method or custom dynamo node.



here an example with 1 electrical panel at input

import clr
import sys
import System
from Autodesk.DesignScript.Geometry import *
import Autodesk.DesignScript.Geometry as DS

#import Revit API
import Autodesk
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB

#import net library
from System import Array
from System.Collections.Generic import List, IList, Dictionary


#import transactionManager and DocumentManager (RevitServices is specific to Dynamo)
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
uidoc = uiapp.ActiveUIDocument
app = uiapp.Application
sdkNumber = int(app.VersionNumber)

panel = UnwrapElement(IN[0])

if sdkNumber < 2021:
	lst_elec_sys_Ids = [x.Id for x in panel.MEPModel.ElectricalSystems]
	lst_elec_sys_Ids = [x.Id for x in panel.MEPModel.GetElectricalSystems()]

out_wires = DB.FilteredElementCollector(doc).OfCategory(DB.BuiltInCategory.OST_Wire)\
											.Where(lambda x : x.MEPSystem is not None and x.MEPSystem.Id in lst_elec_sys_Ids)\

OUT = out_wires