Family-Parameter(Window) based on nearness/enclosure to Room

Hi,
I am trying to add a parameter ( Instance Property) to a Window-Family that assigns the Room-Name to each window.

Each Window has an Instance-Parameter ( Bereich ) where I need to assign Room-Names. So far I have been successful in isolating Room-Name and set of windows each room has but I could not assign the parameter.

In Grasshopper, you could easily extract the List Structure and impose other list with similar Branch Structure, do we have something similar to that Dynamo ?

Please have a look at the picture.

@hassan.orion Use FamilyInstance.Room:

Thanks, but FamilyInstance.Room Node is returning same problem as discussed in the Post. Its returning Null. I tried adjusting CalculationPoint, checked Room Bounding.

Seems like the node has problem. Anyother work around by Lists ?

@hassan.orion Calculation Point should solve it, but when it works for one window, it wont for the other, duplicate types would be a solution

here is an example. I have 5, same family, same type windows, placed in 3 different rooms. Do you mean I have to open edit family for each window even though they are exactly the same ?

I checked in Dynamo, even the window I updated CalculationPoint, even that window does even have any associated Room.

Please have a look at these pictures.


Also, the CalculationPoint arrow should point away from the Room ( is there any logic ) , and just for info, there is nothing outside the window, its the end of building.

I am attaching more pictures of testes, that I did with one single window. I tried changing direction of arrrow inside family. I ran the FamilyInstance.Room node on other 3 projects, all of them had similar problem. I was wondering if there is a problem in Family creation method of our firm ?


Are your rooms and your windows in the same model?

Yes, the its just one model, no IFCs or links.

Furthermore, I just noticed that the Node is working for doors, but not for windows


Can you do a save as, delete everything but two rooms and their associated windows, and post that RVT? I’ll have a look during my afternoon nap… errr meetings. :wink:

Fd_F_W_2-flg_Oberlicht_3(Recovery).rfa (3.4 MB)


I could not upload the room as its 6 mb and it just cant get any smaller ( tried everything ) , however, I am uploading the window family.

In following pictures, window family recognizes the room when the swing is outside, otherway around it does not work. My guess, the problem persists somewhere between the ReferencePlanes of the Family and Origin Point. It also makes me wonder, how exactly revit understands the concepts of ‘Inside’ and ‘Outside’ in a family? because I noticed that Center Front/Back plan was not assigned in the family and still it was recognizning inside/outside somehow.

Also, I saw in some tutorials about To/FromRoomCalculationPoint, and Revit uses different methods for Door and Revit Family. Maybe that is the problem ?

A little description of different planes ( weak/strong) might help, I am sure Revit does not play dice, there is certainly some logic behind this.

I think, RoomCalculationPoint is a very interesting feature, it would help a lot in scheduling, therefore I am trying to wrap my mind around it.

So I tried with 2 more windows from different projects. Seems like windows recognizes room only when there are flipped.
I tried flipping RoomCalculationPoint as well, flipping that does NOT* make any difference.


Here comes a Revit knowledge dump, followed by what I hope will be a solution.

Family Instances have three properties which allow reporting of rooms: .Room[phase], .ToRoom[Phase], and FromRoom[phase]. The [phase] portion is required as there can be different rooms in the same spot in different phases because buildings are dumb. Here is the link to the ‘FromRoom[phase]’ property in the Revit API docs (I’ll let curious individuals find the others on their own).

So we now have a way to get the room properties, and we likely (hopefully - otherwise jumping into the API this fast may not be advisable) know that these points are set in the family environment by enabling the room calculation point, with Windows and Doors having the ‘Two Ended’ spline which defines the from room (start) and to room(end) values, while other family types have just a single point. At this point you may be asking yourself “if doors only have a ‘ToRoom’ and ‘FromRoom’ point, what should be returned by the ‘Room’ property?” This is a valid question, and one which the development team said ‘well likely we don’t want to return null’ and make people ask twice, so let’s return one of the other values too’, and now the ToRoom property value is the same as the Room property value. It’s not necessarily awesome, but anything the put there would be wrong 50% of the time, or we’d have more nulls to deal with.

So what you’re seeing with the ‘FamilyInstance.Room’ node is that the rooms are returning correctly when they align with the ToRoom point, but not reporting anything when that point falls in an invalid room.

Knowing this… we now must question how to get what we want? Fortunately the Python code is relatively simple overall, and can be easily written to work with a few different conditions while keeping speed high:
image

Effectively “ask for the room, and if you get none, ask for the from room, and if you still get none surface a string”.

DYN:
3216581848079686336return_room_toroom_or_fromroom.dyn (12.3 KB)

Hope this helps!

2 Likes

I read your reply several times. Thanks for looking into it in detail.

However, I have two issues:

  1. I am not satisfied behind the concept of Room Recognition. It seems like it is a ‘just make it happen somehow approach’ form the Development team, or maybe I still haven’t understood it. I was thinking more in terms of vector/BoundingBox Intersection. You are correct that interaction of FamilyEnvironmentPoint with RevitBoundingBox has to do something with the relation how coordinates of two separate systems interact. Speaking purely in terms of Geometry, the SplineArrow EndPoint ( point further away from the RoomCenter) interacting with RoomBoundingBox should give the Room. I am asking questions in detail, because you could see all the geometrical construction in Grasshopper and resolve it. Anyway, this is conceptual discussion. I also like to comment that involving Phases is very practical approach. This leads to my second point.

  2. I tried to use your script. I am still having problem. Am I facing error due to the fact that I have two Phases ? I tried all combinations ? Line 13 fromRm = fam.FromRoom[phase]. I tried to check if Dynamo has FromRoom node so I could see if there is some problem with the value, couldnt fine any. Any idea why the script is working in your example and not in mine ?


  1. This a question of do you want to do the work yourself, or would you rather use the BIM data which Revit has already stored in the file? Marshaling the rooms from Revit to Dynamo (or for that matter grasshopper), serializing them into the new geometry engine is not an insignificant task - if you have five rooms no biggie, but what if you have 50,000? And then doing the same for every one of the 50,000 windows. And then testing 50,000 window geometries against 50,000 room geometries… that’s 2,500,000,000 tests. You’re welcome to peruse that solution, but I’d use the BIM data already added to the RVT file when you placed the window/room.

  2. The error is stating that you cannot iterate over a family instance, which makes sense as it is not a list. You are feeding one window and a list of phases. My Python code was intended for many windows and a single phase. If you want to run for any possible condition of input you’ll need to add some for-loops to handle both phases, and list enforcement to ensure the list of families is packed into a list if not already so. Alternatively (and what I would recommend) you could wrap that Python in your own DYF custom node so you can make use of list lacing and levels.

1 Like

hey, I tested your Python Node with 3 Windows, it works fine. I had to add 2 extra lines.

  1. Do you think these lines would create problem in future ?

  2. I checked PhaseValue of each window. Seems like there are some ‘Entities’ that are not selectable but categorised as windows. I am calling them ‘Entities’ because I cant select them even through SelectByID. I assume it is the reason behind python node not working.
    Can you please narrow it down what they are, and how can I filter them ? it’s the same Id repeated 5 times. I get this info when I SelectById.


image

  1. Is there any way to do the job while skipping Phasing ? or Phasing is hard coded for each Element.
  1. No issue with those two lines, but the comments need adjustment and you are likely going to get repeated data as ToRoom and Room should have the same value, if not post an example rvt so the larger community (including myself) can learn from the data set.

  2. Upload a cleaned out model with just one normal window and these two oddities. I’ll see if I can figure out where they come from, but my guess is these are from a group type. Filtering out any windows which don’t have a location may resolve the issue. You can also try getting the parameters of those phases.

  3. You could remove the ‘[phase]’ override, but that would mean you could only ever query the last phase of the job. While that may work today it has an apparent limitation for future use, and having to come back and ask someone for help when you need the phase could be problematic. Overall the phase drop down isn’t hurting anything so I see no reason to skip it, but you could add a test to see if that input is null and if so grab the last phase in the job.

  1. I did as you suggested to look for parameter for the id, it shows it as window, and the anomiay was actually Phase shown as number. You could see that in the SelectPhase Node. It was mentioned in another Topic that some Phases are shown as Text and some as Numbers, dont know why. My guess was that the PythodScript was not working due to this Phase. So I tried to skip that particular Window ( maybe there could be another more efficient way to filter ), still the PythonScript remained yellow.

(Rooms) Phase and Phase Id - Revit - Dynamo (dynamobim.com)

  1. When I delete all the windows to upload , that anomaly is gone, is there anyother way to upload files bigger than 4 mb ?

  2. I extracted the room paramters and pinched it to each window as I intended ( see image ). I converted all windows CreatePhase to New, and then your Script worked perfectly fine.


    So in a way, I achieved what I intended, ( assign room name to each window in a new parameter ) but as you said, it wont work with correct Phases. Also, is there a way to skip/set null when no room name data is found in particular room ?

Perhaps filter out any windows which don’t have a location prior to passing them into the Python?

If you can’t upload it here try another source (ie: OneDrive, Google Drive, WeTransfer, Box, DropBox, etc.).