To-From Room for Rooms in Linked File

Hi all
Im trying to get room (located in link file) name and number to use it for doors in main file.
the script below is working only if rooms and doors are in the same file, i tested it.
but now the rooms are created in another file and linked in the doors model file, so the script cant read the room data, Any help ?

.

I don’t think Dynamo can run anything at all on a Revit file that isn’t currently opened, unless you start digging in data with methods that are a whole lot more complicated.

Does the to/from room parameter fill itself out in your schedule?

yes to/from room parameter works only if the room created in the same file not in linked file

Which is why this won’t work as you’re hoping - it was intended as a leading question. You’re in for a fun one.

Only way I know to do this is to get each room out of the linked model, get each door’s location (a point) and offset it by a bit more than the thickness of its’s host element and the inverse of that value along the door’s facing vector. Next run a test to see which room contains which points, filter the list of all rooms by that series of masks, and then get your name and number (and whatever else you may want) for each room. Now you should be able to set each door’s parameter values accordingly.

Hopefully you have studied up on lacing, list levels, type vs instance documents, and getting elements from linked models.

Alternatively you could put thing into one model. Coping the rooms between models may be an easier morbid here, and would allow better scheduling by room for other categories as well.