title: Extracting Floor Area using Revit API
body: <p>So far I have written C# code to allow the user to select multiple parts of a model within revit, and it will post the id of the selected elements. I now want to adapted this in two ways:</p>
  
  <p>1, To check whether the element selected is a room. (has a room tag) so then I only work with rooms.</p>
  
  <p>2, post the area of said room instead of just the ID of the element.</p>
  
  <p>I am fairly new to C# and the Revit API so would appreiate any pushes in the right direction, thanks.</p>
  
  <p>My current code: </p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using Autodesk.Revit.ApplicationServices;
  using Autodesk.Revit.Attributes;
  using Autodesk.Revit.DB;
  using Autodesk.Revit.UI;
  using Autodesk.Revit.UI.Selection;
  using System.Linq;
  using System.Text;
  
  namespace HelloWorld
  {
  
      [Transaction(TransactionMode.Manual)]
      public class Class1 : IExternalCommand
      {
          public Result Execute(
              ExternalCommandData commandData,
              ref string message,
              ElementSet elements)
          {
              UIApplication uiapp = commandData.Application;
              UIDocument uidoc = uiapp.ActiveUIDocument;
              Application app = uiapp.Application;
              Document doc = uidoc.Document;
  
              IList&lt;Reference&gt; pickedObjs = uidoc.Selection.PickObjects(ObjectType.Element, "Select elements");
              List&lt;ElementId&gt; ids = (from Reference r in pickedObjs select r.ElementId).ToList();
  
              using (Transaction tx = new Transaction(doc))
              {
                  StringBuilder sb = new StringBuilder();
                  tx.Start("transaction");
                  if (pickedObjs != null &amp;&amp; pickedObjs.Count &gt; 0)
                  {
                      foreach (ElementId eid in ids)
                      {
                          Element e = doc.GetElement(eid);
                          sb.Append("/n" +e.Name);
                      }
                      TaskDialog.Show("Area Calculator", sb.ToString());
                  }
                  tx.Commit();
              }
              return Result.Succeeded;
          }
  
      }
  }
  </code></pre>