Room name to Equipments (But equipment above room boundary)

Hi All,

This question seems to be asked earlier. But in my case the Equipment is above the room boundary (Ceiling space).

So I couldn’t use any of the Nodes like Element.in room. So I copied a script & added codes to bring the Element location point - Z to 0. & when I run the script, I am only getting 1 Equipment parameter set…

Don’t know why…Plz help…

Scripe code

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

pyt_path = r'C:\Program Files (x86)\IronPython 2.7\Lib'
sys.path.append(pyt_path)

# Import ToDSType(bool) extension method
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)

# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *

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

roomlist = UnwrapElement (IN[0])
#pointlist = IN[1]
elementlist = UnwrapElement (IN[1])
outroom = []
outfamily = []

for family, room in zip(elementlist, roomlist):
	pt = family.Location.Point
	ptx = pt.X
	pty = pt.Y
	ptz = 0
	pt1 = XYZ(ptx,pty,ptz)
	if room.IsPointInRoom(pt1):
		outroom.append(room)
		outfamily.append(family)
			
OUT = outfamily, outroom

Room name to Equipment_Script.dyn (10.1 KB)

Sample file below…
https://1drv.ms/f/s!Au4nQORJGDGchEo6-vvb3ZN3IyiR

That’s because in your for loop you create an element-room tuple for every iteration. So every element will be compared to only a single room. Translated to Dynamo-slang: you need to set your for-loop to cross-lacing.

Might it be easier to drop the room location point of the family by 3’?

Thanks @T_Pover, @JacobSmall .

I couldn’t make that script work, so I am using the codes from Element.In room node after editing it to show location point Z value to 0.

But I don’t know how to loop the script in red box number of times from List count.

Room name to Equipment_Script.dyn (16.5 KB)

You don’t loop all of it. Let dynamo’s lacing and list levels deal with that for you.

Use a list.FirstItem node with longest lacing to get all rooms (the upper path). Then use a list.drop node with 1 dropped element and longest lacing to get all the elements (lower path).

You may need to adjust some of the lacing or list levels on the other nodes as you move along.