Element Location in room

Is there a way, to acces the location data of an element??
The room data you can acces with schedule trough Dynamo??

Welcome to Dynamo Forum!

Which data you’re trying to access? Could you be more specific.

I just try to use the room location point, so i can use the room data.

You can get the rooms location points this way:

Sry. Not the room points, the room calculation points of an element, so i can see which room it’s belong.

@nichlas.aa.holm Are you trying to get rooms from elements location?

1 Like

Yes, exactly. :slight_smile:
Bu does the note “Element.GetLocation” use the calculation point??

No If you want to get by room calculation point, you can get this way:

The above method checks if the room calculation point is activated then return Rooms or else return Room Calculation Point is not activated. Does that makes sense?

1 Like

Is it possible to get af copy of the script?? It take a long time to type it all in. :slight_smile:

Below is the python snippet. You could copy and paste to get it worked:

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

toList = lambda x : x if hasattr(x, "__iter__") else [ x ]
elements = toList(UnwrapElement(IN[0]))
# get the family types of instances
familyTypes = [e.Symbol.Family for e in elements]
# get roomCalcPoint
roomCalcPoint = [type.LookupParameter('Room Calculation Point').AsValueString() for type in familyTypes]
result = []
for r,e in zip(roomCalcPoint,elements):
	if all([r != x for x in ["No"]]):
		result.append(doc.GetRoomAtPoint(e.GetSpatialElementCalculationPoint()))
	else:
		result.append('Room Calculation Point is not activated')

OUT = result

Mark the post as solved. You’re welcome!

4 Likes