Salut,
voici un petit bout de code rapide permettant de récupérer tous les circuits connecté à une installation électrique et la liste des équipements connectés à chaque circuit :
public void Demo()
{
Document rvtDoc = this.Application.ActiveUIDocument.Document;
FilteredElementCollector collectorE2 = new FilteredElementCollector(rvtDoc);
List<Element> roomListE3 = collectorE2.OfClass(typeof(FamilyInstance)).OfCategory(BuiltInCategory.OST_ElectricalFixtures).ToList(); // Installation électriques
StringBuilder stb = new StringBuilder();//
foreach (Element e in roomListE3)
{
FamilyInstance famInst = e as FamilyInstance;
MEPModel mepModel = famInst.MEPModel;
ISet<ElectricalSystem> setElecSystems = mepModel.GetElectricalSystems();
//TaskDialog.Show("debug",setElecSystems.Count.ToString());
if(setElecSystems != null && setElecSystems.Count() > 0)
{
int iMax = setElecSystems.Count();
for (int i = 0; i < iMax; i++)
{
StringBuilder stbCircuit = new StringBuilder();
ElectricalSystem elecSystem = setElecSystems.ToList()[i];
stbCircuit.AppendLine(string.Format("Tableau : {0} - Circuit : {1}",e.Name,elecSystem.Name));
string strTypeCircuit = elecSystem.CircuitConnectionType.ToString();
string strNomPanneau = elecSystem.PanelName;
stbCircuit.AppendLine(string.Format("Nom du Circuit : {0}",elecSystem.Name));
stbCircuit.AppendLine(string.Format("Type de Circuit : {0}",strTypeCircuit));
stbCircuit.AppendLine(string.Format("Nom du Panneau : {0}",strNomPanneau));
stbCircuit.AppendLine("Liste des équipements connectés : ");
ElementSet lstElements = elecSystem.Elements;
StringBuilder stbElementConnecte = new StringBuilder();
foreach (Element elmnt in lstElements)
{
FamilyInstance famInstElec = elmnt as FamilyInstance;
stbElementConnecte.AppendLine(string.Format("- {0} : {1} - {2}",famInst.Symbol.FamilyName, elmnt.Name , elmnt.Id));
}
stbCircuit.AppendLine(stbElementConnecte.ToString());
stb.AppendLine(stbCircuit.ToString());
}
}
}
TaskDialog.Show("debug",stb.ToString());
}
Et voici le résultat sur le fichier que tu as joint :

😉