<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Get All Parameters from model elements in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/get-all-parameters-from-model-elements/m-p/12108936#M10734</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3817195"&gt;@jazlik&lt;/a&gt;,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kindly, have a look at this forum thread as advised by Jeremy on the issue:&lt;STRONG&gt;&lt;A href="https://forums.autodesk.com/t5/revit-api-forum/check-if-a-category-contains-any-element/td-p/8759761" target="_blank" rel="noopener"&gt;&amp;nbsp;&lt;/A&gt;&lt;A href="https://forums.autodesk.com/t5/revit-api-forum/check-if-a-category-contains-any-element/td-p/8759761" target="_blank"&gt;https://forums.autodesk.com/t5/revit-api-forum/check-if-a-category-contains-any-element/td-p/8759761&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Ideally, your approach seems quite right. You my loop through the retrieved list of categories, using &lt;A href="https://www.revitapidocs.com/2015/263cf06b-98be-6f91-c4da-fb47d01688f3.htm" target="_blank" rel="noopener"&gt;&lt;STRONG&gt;F&lt;/STRONG&gt;&lt;/A&gt;&lt;SPAN&gt;&lt;A href="https://www.revitapidocs.com/2015/263cf06b-98be-6f91-c4da-fb47d01688f3.htm" target="_blank" rel="noopener"&gt;&lt;STRONG&gt;ilteredElementCollector&lt;/STRONG&gt;&lt;/A&gt;&amp;nbsp; to get the count of elements in each category&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 18 Jul 2023 10:01:44 GMT</pubDate>
    <dc:creator>caroline.gitonga</dc:creator>
    <dc:date>2023-07-18T10:01:44Z</dc:date>
    <item>
      <title>Get All Parameters from model elements</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/get-all-parameters-from-model-elements/m-p/12108627#M10733</link>
      <description>&lt;P&gt;Hey!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I guess this idea was mentioned here a few times, but I quite do not find anything specific for my case.&lt;/P&gt;&lt;P&gt;I would like to find all categories of elements which are "present" in a model. So I would like to find only these categories that have elements instance in a model.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think I went from backwards as first I get all the categories from the model:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First I wanted to get all categories in a document:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;public List&amp;lt;Category&amp;gt; GetAllCategoriesInDocument()&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; &amp;nbsp;Categories categories = Doc.Settings.Categories;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;List &amp;lt;Category&amp;gt; listOfCategories = new List&amp;lt;Category&amp;gt;();&lt;BR /&gt;&amp;nbsp; &amp;nbsp;foreach (Category category in categories)&lt;BR /&gt;&amp;nbsp; &amp;nbsp;{&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; // Check if the category is valid and can be used in the model&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; if (category != null &amp;amp;&amp;amp; category.AllowsBoundParameters)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; listOfCategories.Add(category);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;BR /&gt;&amp;nbsp; &amp;nbsp;}&lt;BR /&gt;return listOfCategories;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then I wanted to get all parameters from these categories, using first element in model&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;public List&amp;lt;Parameter&amp;gt; GetAllParametersOfGivenCategoryFromFirstElement(Category category)&lt;BR /&gt;{&lt;BR /&gt;ElementFilter elementCategoryFilter = new ElementCategoryFilter((BuiltInCategory)category.Id.IntegerValue);&lt;BR /&gt;Element element = new FilteredElementCollector(Doc).WherePasses(elementCategoryFilter).ToElements().First();&lt;BR /&gt;return (List&amp;lt;Parameter&amp;gt;)element.GetOrderedParameters();&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It just occured to me that it will not work as not all categories are going to have elements in the model! Surprise &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;&lt;P&gt;So I followed a few posts here and get to jeremy github(Lab2_2_ModelElements):&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/jeremytammik/AdnRevitApiLabsXtra/blob/master/XtraCs/Labs2.cs#L506-L686" target="_blank"&gt;https://github.com/jeremytammik/AdnRevitApiLabsXtra/blob/master/XtraCs/Labs2.cs#L506-L686&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I am not quite sure whether getting all model elements is the correct approach?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your help!&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jul 2023 07:13:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/get-all-parameters-from-model-elements/m-p/12108627#M10733</guid>
      <dc:creator>jazlik</dc:creator>
      <dc:date>2023-07-18T07:13:12Z</dc:date>
    </item>
    <item>
      <title>Re: Get All Parameters from model elements</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/get-all-parameters-from-model-elements/m-p/12108936#M10734</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3817195"&gt;@jazlik&lt;/a&gt;,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kindly, have a look at this forum thread as advised by Jeremy on the issue:&lt;STRONG&gt;&lt;A href="https://forums.autodesk.com/t5/revit-api-forum/check-if-a-category-contains-any-element/td-p/8759761" target="_blank" rel="noopener"&gt;&amp;nbsp;&lt;/A&gt;&lt;A href="https://forums.autodesk.com/t5/revit-api-forum/check-if-a-category-contains-any-element/td-p/8759761" target="_blank"&gt;https://forums.autodesk.com/t5/revit-api-forum/check-if-a-category-contains-any-element/td-p/8759761&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Ideally, your approach seems quite right. You my loop through the retrieved list of categories, using &lt;A href="https://www.revitapidocs.com/2015/263cf06b-98be-6f91-c4da-fb47d01688f3.htm" target="_blank" rel="noopener"&gt;&lt;STRONG&gt;F&lt;/STRONG&gt;&lt;/A&gt;&lt;SPAN&gt;&lt;A href="https://www.revitapidocs.com/2015/263cf06b-98be-6f91-c4da-fb47d01688f3.htm" target="_blank" rel="noopener"&gt;&lt;STRONG&gt;ilteredElementCollector&lt;/STRONG&gt;&lt;/A&gt;&amp;nbsp; to get the count of elements in each category&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jul 2023 10:01:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/get-all-parameters-from-model-elements/m-p/12108936#M10734</guid>
      <dc:creator>caroline.gitonga</dc:creator>
      <dc:date>2023-07-18T10:01:44Z</dc:date>
    </item>
    <item>
      <title>Re: Get All Parameters from model elements</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/get-all-parameters-from-model-elements/m-p/12109427#M10735</link>
      <description>&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;I guess I was littering blog with another similar post. Thanks anyway! I will look!&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jul 2023 14:07:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/get-all-parameters-from-model-elements/m-p/12109427#M10735</guid>
      <dc:creator>jazlik</dc:creator>
      <dc:date>2023-07-18T14:07:09Z</dc:date>
    </item>
  </channel>
</rss>

