Generating an Area list from Excel

Does anyone know if it’s possible to create a set of preset Areas in Revit using Dynamo similar to the manner in which the Lunchbox Create Room by Name and Number node works?

Hi @Keith_Wilkinson1

yes it is :slight_smile:
just had to change NewRoom to NewArea in the code . Also, it requires an Area Plan, not a level :

#python nodes in dynamo 1.0
#proposed by Julien Benoit @jbenoit44 
#http://aecuandme.wordpress.com/
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
# Import ToDSType(bool) extension method
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
# Import geometry conversion extension methods
clr.ImportExtensions(Revit.GeometryConversion)
# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
from System.Collections.Generic import *
# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

uvs =[]
for i in IN[0]:
	uvs.append(UnwrapElement(i).ToXyz())
level=UnwrapElement(IN[1])
roomlist=[]

# Start Transaction
TransactionManager.Instance.EnsureInTransaction(doc)

for item in uvs:
	uv=UV(item.X,item.Y)
	a=doc.Create.NewArea(level,uv)
	roomlist.append(a)

# End Transaction
TransactionManager.Instance.TransactionTaskDone()

OUT = roomlist 

Many thanks - I’ll need to go and have a look at this in more detail, it’s a step beyond my Dynamo knowledge at present!!

You just need to create a python script node > right click on it > edit > delete the preset content and copy paste the code from my previous post .

You’ll also, in that case, need to press the little + to add an input to the node. Then you’ll have your “create area by point area plan” node :slight_smile:

I hope this helps.

thanks - I’ll give that a go. However I don’t want to place the areas just create them so that they can be placed later. I need a set of areas to match my rooms - one will give me net area the other gross.