Hi Guys,
I am trying to get access to the value of the Area Type parameter the Area Element : Building Common Area, Office Area … etc But I cant seem to be able to find how to access these values, and by the look of it in the Revit interface I guess they must be defined as an enum structure
somewhere in the API
but it seems that its hidden in the deepest pits of hell!! lol
here is my code:
public List<string> Foo(Document doc)
{
IEnumerable<Area> areas = new FilteredElementCollector(doc).WhereElementIsNotElementType().OfClass(typeof(SpatialElement))
.Where(e => e.GetType() == typeof(Area))
.Cast<Area>(); ;
List<string> output = new List<string>();
foreach (var area in areas)
{
Parameter areaType = area.get_Parameter(BuiltInParameter.AREA_TYPE);
//output.Add(areaType.ToString()); gives: Autodesk.Revit.DB.Paramater
Definition def = areaType.Definition;
// output.Add(def.Name); // gives: Area Type
output.Add(areaType.AsString()); // gives: nothing I guess it because it does not have a string representation
}
return output;
}
The closest I have gotten is through Definition def = areaType.Definition;
and then accessing def.Name
property, which will give a string equal to Area Type
.
Any hints would be awesome!