I am able to access the Name of selected areas using the GetParameterByName Node, however when I try to get it in Python it tells me that the Area doesnt have an attribute of Name
Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File “”, line 65, in
AttributeError: Name
Here is the code:
import clr
clr.AddReference(‘ProtoGeometry’)
from Autodesk.DesignScript.Geometry import *
Import RevitNodes
clr.AddReference(“RevitNodes”)
import Revit
Import Revit elements
from Revit.Elements import *
#The inputs to this node will be stored as a list in the IN variables.
Areas = IN[0]
Levels = IN[1]
AreaNames = IN[2]
AreaList = [[] for x in xrange(Areas.Count)]
Counter = 0
OutLevels = []
for i in Areas:
Area = UnwrapElement(i)
AreaList[Counter].append(Area.Name)
Counter = Counter + 1
#Assign your output to the OUT variable.
OUT = AreaList
If I substitute Area.Area for Area.Name it works quite happily, so I am obviously looking for the wrong attribute, but I don’t know which attribute I should be looking for… do you?
Thanks for asking, it’s a small portion of a larger code, I am looking to group the Areas by Name and Level in order to get totals for an area summary.
Something like:
for i in Levels:
Level=UnwrapElement(i)
for k in Areas:
Area=UnwrapElement(k)
AreaLevel = Area.Level
if AreaLevel.Name.ToString == Level.Name.ToString:
AreaTotal = AreaTotal + Area.Area
but with the addition on the Area Name into the equation
And I am also trying to figure out using Python so I have kind of set myself a target of doing this in a Python script.
Would it be easy to do with with OOTB nodes? with the nested If’s etc?
1 Like
do you have a few minutes to show me? to help in my learning
Are you trying to get the name of the area or area scheme?
If is the scheme :
area.AreaScheme.Name
Thanks @erfajo I will take a look
Just the name of the Area
In the Image, the Name is Residential
You can do it like this:
area.GetParameters("Name")[0].AsString()
or if you remove the UwrapElement() function, and work with the Dynamo wrapped class, just area.Name
should work.
Funny, that Dynamo also adds the area number to the name:

1 Like
Thanks @Einar_Raknes that answered the original question
To complement @Einar_Raknes answer,
you can also use the BuiltInParameter
(preferred to avoid parameter name conflict and regionalization, might not matter in your use case!):
name_param = area.get_Parameter(BuiltInParameter.ROOM_NAME)
name = name_param.AsString()
1 Like
No problem! Here is a workflow with OOTB nodes that might work:
sumAreasGroupedByLevelAndName.dyn (7.5 KB)