<?xml version="1.0" encoding="UTF-8"?>        <rss version="2.0"
             xmlns:atom="http://www.w3.org/2005/Atom"
             xmlns:dc="http://purl.org/dc/elements/1.1/"
             xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
             xmlns:admin="http://webns.net/mvcb/"
             xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
             xmlns:content="http://purl.org/rss/1.0/modules/content/">
        <channel>
            <title>
									Как в c# коде добраться до фильтров спецификации? - АВТОМАТИЗАЦИЯ				            </title>
            <link>https://forum.bim2b.ru/api/kak-v-c-kode-dobratsya-do-filtrov-speczifikaczii/</link>
            <description></description>
            <language>ru-RU</language>
            <lastBuildDate>Tue, 07 Apr 2026 13:07:37 +0000</lastBuildDate>
            <generator>wpForo</generator>
            <ttl>60</ttl>
							                    <item>
                        <title>Как в c# коде добраться до фильтров спецификации?</title>
                        <link>https://forum.bim2b.ru/api/kak-v-c-kode-dobratsya-do-filtrov-speczifikaczii/#post-1609</link>
                        <pubDate>Thu, 14 Sep 2023 16:02:35 +0000</pubDate>
                        <description><![CDATA[Спецификации на листе мне &quot;изловить&quot; удалось. Как бы теперь добраться до фильтров оных? Для начала хотя бы прочитать. :) Ну а потом уж - и изменить.
using System;
using System.Linq;
using...]]></description>
                        <content:encoded><![CDATA[<p>Спецификации на листе мне "изловить" удалось. Как бы теперь добраться до фильтров оных? Для начала хотя бы прочитать. :) Ну а потом уж - и изменить.</p>
<pre contenteditable="false">using System;
using System.Linq;
using System.Collections.Generic;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Structure;
using Autodesk.Revit.UI;
using Autodesk.Revit.UI.Selection;

namespace XX.Functions.KJ
{

public class param_in_filter : IExternalCommand
{
public Result Execute(ExternalCommandData cmdData, ref string msg, ElementSet elems)
{
UIDocument uiDoc = cmdData.Application.ActiveUIDocument;
ViewSheet selectedSheet = GetSelectedSheet(uiDoc);
if (selectedSheet == null)
{
msg = "Выберите лист";
return Result.Cancelled;
}

// Получение спецификаций, вынесенных на выбранный лист
IList&lt;Element&gt; specifications = GetSheetSpecifications(selectedSheet);

return Result.Succeeded;
}
private ViewSheet GetSelectedSheet(UIDocument uiDoc)
{
// Получение выбранных элементов на виде
ICollection&lt;ElementId&gt; selectedElementIds = uiDoc.Selection.GetElementIds();

// Проверка, является ли выбранный элемент листом
foreach (ElementId elementId in selectedElementIds)
{
Element element = uiDoc.Document.GetElement(elementId);
if (element is ViewSheet sheet)
{
return sheet;
}
}

return null;
}

private IList&lt;Element&gt; GetSheetSpecifications(ViewSheet sheet)
{
// Получение графических элементов, размещенных на виде
FilteredElementCollector collector = new FilteredElementCollector(sheet.Document, sheet.Id);
IList&lt;Element&gt; elements = collector.WhereElementIsNotElementType().ToElements();
IList&lt;Element&gt; specifications = elements.Where(elem =&gt; elem.Category?.Name == "Графика спецификации").ToList();
return specifications;
}

private void ShowSpecificationsList(IList&lt;string&gt; specificationNames)
{
// Вывод списка спецификаций 
string listText = "Specifications:\n";
foreach (string specificationName in specificationNames)
{
listText += "- " + specificationName + "\n";
}

TaskDialog.Show("Specifications List", listText );


}

}
}</pre>
<p> </p>]]></content:encoded>
						                            <category domain="https://forum.bim2b.ru/api/">АВТОМАТИЗАЦИЯ</category>                        <dc:creator>Alexandr</dc:creator>
                        <guid isPermaLink="true">https://forum.bim2b.ru/api/kak-v-c-kode-dobratsya-do-filtrov-speczifikaczii/#post-1609</guid>
                    </item>
							        </channel>
        </rss>
		