public Result Execute(
ExternalCommandData commandData,
ref string message,
ElementSet elements)
{
UIApplication uiapp = commandData.Application;
UIDocument uidoc = uiapp.ActiveUIDocument;
Aplicación app = uiapp.Application;
Document doc = uidoc.Document;
string mep_seccion = "";
//Recorriendo el Sistema MEP
foreach (MEPSystem MEPSystem in new FilteredElementCollector(doc)
.OfClass(typeof(MEPSystem)))
{
List<MEPSection> seccionMeplista = new List<MEPSection>();
getSectionsFromSystem(MEPSystem, seccionMeplista);
foreach (MEPSection secc in seccionMeplista)
{
mep_seccion += secc.Number.ToString() + Environment.NewLine;
}
}
***************************************************************************************************
#region Obtener sección del sistema
/// <summary>
/// Obtener sección del sistema
/// </summary>
/// <param name="system"></param>
/// <param name="sections"></param>
static public void getSectionsFromSystem(MEPSystem system, List<MEPSection> sections)
{
if (system == null || sections == null)
return;
int nSection = system.SectionsCount;
if (sections > 0)
{
for (int ii = 1; ii < nSection + 1; ++ii) //section number start from 1
{
MEPSection section = system.GetSectionByNumber(ii);
if (section == null)
continue;
sections.Add(section);
}
}
}
#endregion