<?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: Remove Group with Revit API in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/remove-group-with-revit-api/m-p/11609251#M15165</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/768212"&gt;@george1985&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am not able to reproduce the issue.&lt;/P&gt;
&lt;P&gt;The code is working fine on my end.&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;FilteredElementCollector collector = new FilteredElementCollector(doc).OfClass(typeof(GroupType));
Transaction transaction1 = new Transaction(doc);
transaction1.Start("Delete Group Type");
doc.Delete(collector.ToElementIds());
transaction1.Commit();&lt;/LI-CODE&gt;
&lt;P&gt;Before&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Before.png" style="width: 261px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1150538i0065BA97DDB342D7/image-size/large?v=v2&amp;amp;px=999" role="button" title="Before.png" alt="Before.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;After&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="After.png" style="width: 152px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1150539iC711F3B53195C907/image-size/large?v=v2&amp;amp;px=999" role="button" title="After.png" alt="After.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 09 Dec 2022 13:40:47 GMT</pubDate>
    <dc:creator>naveen.kumar.t</dc:creator>
    <dc:date>2022-12-09T13:40:47Z</dc:date>
    <item>
      <title>Remove Group with Revit API</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/remove-group-with-revit-api/m-p/11609082#M15164</link>
      <description>&lt;P&gt;Does anyone know how to remove all Model Groups from Revit's Project Browser, with Revit API?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="george1985_0-1670589401356.png" style="width: 300px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1150514i6F3FDE41DEF78ADB/image-size/small?v=v2&amp;amp;px=200" role="button" title="george1985_0-1670589401356.png" alt="george1985_0-1670589401356.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is a &lt;A href="https://thebuildingcoder.typepad.com/blog/2011/09/deleting-a-group.html" target="_blank" rel="noopener"&gt;solution from 2011&lt;/A&gt; by removing the GroupType - which does not work anymore (when I run the code, the Groups are still there in the Project Browser).&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I would be very grateful for any kind of help.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Dec 2022 12:37:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/remove-group-with-revit-api/m-p/11609082#M15164</guid>
      <dc:creator>george1985</dc:creator>
      <dc:date>2022-12-09T12:37:05Z</dc:date>
    </item>
    <item>
      <title>Re: Remove Group with Revit API</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/remove-group-with-revit-api/m-p/11609251#M15165</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/768212"&gt;@george1985&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am not able to reproduce the issue.&lt;/P&gt;
&lt;P&gt;The code is working fine on my end.&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;FilteredElementCollector collector = new FilteredElementCollector(doc).OfClass(typeof(GroupType));
Transaction transaction1 = new Transaction(doc);
transaction1.Start("Delete Group Type");
doc.Delete(collector.ToElementIds());
transaction1.Commit();&lt;/LI-CODE&gt;
&lt;P&gt;Before&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Before.png" style="width: 261px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1150538i0065BA97DDB342D7/image-size/large?v=v2&amp;amp;px=999" role="button" title="Before.png" alt="Before.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;After&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="After.png" style="width: 152px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1150539iC711F3B53195C907/image-size/large?v=v2&amp;amp;px=999" role="button" title="After.png" alt="After.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Dec 2022 13:40:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/remove-group-with-revit-api/m-p/11609251#M15165</guid>
      <dc:creator>naveen.kumar.t</dc:creator>
      <dc:date>2022-12-09T13:40:47Z</dc:date>
    </item>
    <item>
      <title>Re: Remove Group with Revit API</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/remove-group-with-revit-api/m-p/11609831#M15166</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5661631"&gt;@naveen.kumar.t&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much for the quick reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was not precise enough, I apologize for that.&lt;BR /&gt;I am trying to delete unused Groups from Project Browser, as well. Unsused Groups are those whose elements have been ungrouped (so they no more contain elements, but they are still present in the Project Browser):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="george1985_0-1670607441405.png" style="width: 300px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1150636i1AA21C77377E4AA5/image-size/small?v=v2&amp;amp;px=200" role="button" title="george1985_0-1670607441405.png" alt="george1985_0-1670607441405.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;If I run your code, only the used Groups (those that have not been 'Ungrouped') will be removed from the Project Browser.&lt;BR /&gt;Unused are not returned in 'collector' variable.&lt;/P&gt;&lt;P&gt;Do you have some idea how to remove these unused groups from the Project Browser?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Dec 2022 17:39:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/remove-group-with-revit-api/m-p/11609831#M15166</guid>
      <dc:creator>george1985</dc:creator>
      <dc:date>2022-12-09T17:39:03Z</dc:date>
    </item>
    <item>
      <title>Re: Remove Group with Revit API</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/remove-group-with-revit-api/m-p/11612245#M15167</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/768212"&gt;@george1985&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try using this below code&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;FilteredElementCollector collector = new FilteredElementCollector(doc).OfClass(typeof(GroupType));
IList&amp;lt;ElementId&amp;gt; unusedGroups= new List&amp;lt;ElementId&amp;gt;();
foreach(Element e in collector)
  {
   GroupType group = e as GroupType;
   GroupSet groupSet = group.Groups;
   if(groupSet.Size==0)
     {
      unusedGroups.Add(group.Id);
     }
  }

Transaction actrans = new Transaction(doc);
actrans.Start("Delete unused Groups");
doc.Delete(unusedGroups);
actrans.Commit();&lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 11 Dec 2022 13:08:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/remove-group-with-revit-api/m-p/11612245#M15167</guid>
      <dc:creator>naveen.kumar.t</dc:creator>
      <dc:date>2022-12-11T13:08:41Z</dc:date>
    </item>
    <item>
      <title>Re: Remove Group with Revit API</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/remove-group-with-revit-api/m-p/11612486#M15168</link>
      <description>&lt;P&gt;Works perfectly.&lt;BR /&gt;Thank you very much for the fantastic support &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5661631"&gt;@naveen.kumar.t&lt;/a&gt; !&lt;/P&gt;</description>
      <pubDate>Sun, 11 Dec 2022 16:49:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/remove-group-with-revit-api/m-p/11612486#M15168</guid>
      <dc:creator>george1985</dc:creator>
      <dc:date>2022-12-11T16:49:31Z</dc:date>
    </item>
  </channel>
</rss>

