<?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: Creating Groups from Revit API in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/creating-groups-from-revit-api/m-p/5453808#M74598</link>
    <description>&lt;P&gt;Hi Jared, Not sure if this helps. Dale&lt;/P&gt;&lt;P&gt;&amp;lt;code&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;public&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;static&lt;/SPAN&gt; &lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;Group&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; MakeGroup(&lt;/SPAN&gt;&lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;Document&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; doc, &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;string&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; pstrGroupName)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;Group&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; group = &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;null&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;using&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; (&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;Transaction&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; tr = &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;new&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;Transaction&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;(doc, &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a31515; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #a31515; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #a31515; font-family: Consolas; font-size: small;"&gt;"MakeGroup"&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;))&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;tr.Start();&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;try&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008000; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #008000; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #008000; font-family: Consolas; font-size: small;"&gt;// create collector to collect all elements on active view&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;FilteredElementCollector&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; collector = &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;new&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;FilteredElementCollector&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;(doc, doc.ActiveView.Id);&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008000; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #008000; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #008000; font-family: Consolas; font-size: small;"&gt;// get ids of all elements in view&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;ICollection&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;ElementId&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;&amp;gt; ids = collector.ToElementIds().ToList();&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008000; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #008000; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #008000; font-family: Consolas; font-size: small;"&gt;// make into group &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;if&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; (ids.Count &amp;gt; 0)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;group = doc.Create.NewGroup(ids);&lt;/P&gt;&lt;P&gt;group.GroupType.Name = pstrGroupName;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;tr.Commit();&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;catch&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; (&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;Exception&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; ex)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008000; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #008000; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #008000; font-family: Consolas; font-size: small;"&gt;//tr.RollBack(); // no need, "using" does this&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;MessageBox&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;.Show(&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a31515; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #a31515; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #a31515; font-family: Consolas; font-size: small;"&gt;"Error: "&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; + ex.Message);&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;return&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; group;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;/code&amp;gt;&lt;/P&gt;</description>
    <pubDate>Sun, 28 Dec 2014 05:58:14 GMT</pubDate>
    <dc:creator>Dale.Bartlett</dc:creator>
    <dc:date>2014-12-28T05:58:14Z</dc:date>
    <item>
      <title>Creating Groups from Revit API</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/creating-groups-from-revit-api/m-p/5451985#M74597</link>
      <description>&lt;P&gt;I'm currently trying to figure out a method for producing multiple&amp;nbsp;group types from geometry in a project based on views. The end goal is to be able to define views with a specified naming convention, create a group type from the geometry in each view, and create group instances throughout the model.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem I'm facing is that there doesn't seem to be a good way to create these groups. I'm able to narrow down my selection to the specific elements I want, and I'm able to use the postcommand enumeration for create group, the problem is that the enumeration doesn't leave room for arguments and I'm not sure how to issue the command to name the group and create the group from the selection. Is there any known method for creating a group from a selected set of elements?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-Jared Regan&lt;/P&gt;</description>
      <pubDate>Tue, 23 Dec 2014 20:57:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/creating-groups-from-revit-api/m-p/5451985#M74597</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-12-23T20:57:25Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Groups from Revit API</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/creating-groups-from-revit-api/m-p/5453808#M74598</link>
      <description>&lt;P&gt;Hi Jared, Not sure if this helps. Dale&lt;/P&gt;&lt;P&gt;&amp;lt;code&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;public&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;static&lt;/SPAN&gt; &lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;Group&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; MakeGroup(&lt;/SPAN&gt;&lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;Document&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; doc, &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;string&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; pstrGroupName)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;Group&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; group = &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;null&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;using&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; (&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;Transaction&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; tr = &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;new&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;Transaction&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;(doc, &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a31515; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #a31515; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #a31515; font-family: Consolas; font-size: small;"&gt;"MakeGroup"&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;))&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;tr.Start();&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;try&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008000; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #008000; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #008000; font-family: Consolas; font-size: small;"&gt;// create collector to collect all elements on active view&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;FilteredElementCollector&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; collector = &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;new&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;FilteredElementCollector&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;(doc, doc.ActiveView.Id);&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008000; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #008000; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #008000; font-family: Consolas; font-size: small;"&gt;// get ids of all elements in view&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;ICollection&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;ElementId&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;&amp;gt; ids = collector.ToElementIds().ToList();&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008000; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #008000; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #008000; font-family: Consolas; font-size: small;"&gt;// make into group &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;if&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; (ids.Count &amp;gt; 0)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;group = doc.Create.NewGroup(ids);&lt;/P&gt;&lt;P&gt;group.GroupType.Name = pstrGroupName;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;tr.Commit();&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;catch&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; (&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;Exception&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; ex)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008000; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #008000; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #008000; font-family: Consolas; font-size: small;"&gt;//tr.RollBack(); // no need, "using" does this&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #2b91af; font-family: Consolas; font-size: small;"&gt;MessageBox&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;.Show(&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a31515; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #a31515; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #a31515; font-family: Consolas; font-size: small;"&gt;"Error: "&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; + ex.Message);&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: small;"&gt;return&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; group;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;/code&amp;gt;&lt;/P&gt;</description>
      <pubDate>Sun, 28 Dec 2014 05:58:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/creating-groups-from-revit-api/m-p/5453808#M74598</guid>
      <dc:creator>Dale.Bartlett</dc:creator>
      <dc:date>2014-12-28T05:58:14Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Groups from Revit API</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/creating-groups-from-revit-api/m-p/5453980#M74599</link>
      <description>&lt;P&gt;Have seen the Autodesk "my first plugin"?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It&amp;nbsp;has an example that creates and copies groups.&amp;nbsp;&amp;nbsp; That sounds at least similar to what you are trying to do.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 28 Dec 2014 14:53:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/creating-groups-from-revit-api/m-p/5453980#M74599</guid>
      <dc:creator>sragan</dc:creator>
      <dc:date>2014-12-28T14:53:01Z</dc:date>
    </item>
  </channel>
</rss>

