Get Element's Room PYTHON

Gotcha based on #1 above. Not sold on why for #2 as you could always use nodes in the custom node, but I digress.

Instead of calling for the parameter call the method to get the room, as I recently showed here: Family-Parameter(Window) based on nearness/enclosure to Room - #11 by JacobSmall

You do have a few elements which won’t have either the parameter nor the method to get the room (ie: system panels) so because of those you may have to add a big try/except to catch the failure points, or you’ll have to use a bunch of if statements to get things to gather the data without throwing an error. After the easy methods shown above I would move onto adding a loop to pull the location of the object, breaking each item down to a point, and using that to get the room at point.

You can add the many parameter methods which store room data in them, but I am not sure how those return data with phased projects (because that table has a room in the existing conditions, phase and a different room in the new construction phase). Depending on how many element types you find have the property for ‘room’ / ‘from room’ / ‘to room’ it might actually be better to skip it all and jump directly to the room at point method I noted before.

I’ll try to look over your code today to see if I can make it repeat the issues you’re having on a sample project, but I have a rather busy day today so no promises.

1 Like