So I know this question can be answered in a bunch of ways, I’m hoping to get a Python solution but am not apposed to a using Dynamo nodes. To preface, my Python is a little above beginner level, I can use and understand Revit API in a Python node, but I’m not advanced enough to even begin to scratch the surface of all the possible libraries the API offers. Below is my graph of what I have working. I wrote some nodes to pull rooms and equipment out of a LINKED model, I want to take every piece of mechanical equipment in the linked model, figure out what room it is in (either the room in my electrical model I work in or the room in the linked mech model… both should have the same rooms anyways).
Let me stop here and say I’ve tried pulling the instance parameter out of the linked mech equipment for “Room”… I’m either completely wrong and just can’t find it, but I don’t work in mech models nor do I know their families… I don’t believe the mech families are setup to populate this “Room” property, and my company is WAY to big to ask that entire portion of the firm to change their families they use… or even update them… So I’m trying to do this by xyz location. This next picture below is what I currently have for doing so. Taking a room, converting it to geometry, taking a point location of mech equip, finding the closest point between the two… easy enough to compare. Here’s where I’m stumped, I need to do this for EVERY piece of mech equip, not just one… And I can’t seem to input an array into the “Geometry.ClosestPointTo” node. I’ve tried using bounding boxes but due to odd room sizes in most projects, a bounding box wont work. I’m hoping to either somehow see the code running the out of box “Geometry.ClosestPointTo” node, or there is a simple solution I’m not seeing… I’ve tried the while loop node, it’s possible I’m misunderstanding but it doesn’t seem like it works like a “normal” loop you would use while actually typing code.