Create floor type by filtered room name

Hi

I am relatively new to Dynamo so bare with me. Although I have created a script to add a floor type to rooms, this floor type is the same throughout all rooms. I would like to filer out a room name and apply a specific floor type to that room. I have looked on the forums and have only found a way to do it with lists from excel, but I want to apply the actual floor and not just text to a parameter. I have created the room boundary, and I have created the filer. I get lost trying to join the two together.

Would appreciate some help, or an alternative way to do what I am asking.

Thank you

Look into the Room.Boundaries node in the Clockwork package as a start. It has a single output for the perimeter lines so you don’t have to rebuild that geometry (which can be very time consuming).

Thank you Jacob, that is much tidier. Still trying to create a floor type for a particular room.

Pardon my ignorance here, but when I click on that link it brings me to written code. How do I get that as a node?

You mean the Dyf?

Yes

the Dyf is the actual node but without a name.
If you save the Dyf in the folder where you’re nodes reside, it shoud show up, i believe.
Am i right here? @JacobSmall

Sorry, I really am a Newbie. I’m still lost. How do I save the code as a dyf?

Sorry, forget about it, i opend it myself and looked inside, its old code.
I will try to find a better solution for you in a moment.

Marcel

1 Like

@K104

sorry for the delay.

So, as @JacobSmall mentioned, you can get the room boundaries from rooms.
Those lines are called Curves in Dynamo.
If you look at the node Floor.ByOutlineTypeAndLevel it askes you for those outlines in the first input. The second input you can connect to what comes out of the fist picture (a new floor type) and then give it the level of the room you derived the outline from.

image

@Marcel_Rijsmus

Thank you for your time, however I am lost with what you are explaining. I have the outlines in the first input of ‘Floor.ByOutlineTypeAndLevel’, the Floor Type into the 2nd, and the level into the 3rd, however I would like to link the room filter I have created.

It would be great if there was a node ‘Floor.ByOutlineTypeAndRoomName’, but there is not, so I am trying to link my filtered room name to the room outline somehow.

I have been able to tidy up my script from my initial one (see below) according to Jacobs suggestion of using the ‘Room.Boundaries’ node, while I also discovered ‘Filter by String’ instead of filter by Boolean.

In my Script, I want to apply a Floor Type (not text parameter) to the Classrooms only on Level 1.!

Filter to the rooms first using your previous Boolean method.
Then use the room boundaries on the included set which becomes your perimeter curves.
Next use the string you searched for (classroom in this case) to make a new floor type (or select a type by name) and use that as your floor type.
Lastly get the level parameter value of the rooms, which will become the level input for your floor.

2 Likes

@JacobSmall

Thank you Thank You Thank You.

The full solution script is attached.

1 Like

Glad you’re sorted out, but I wanted to point out that this isn’t quite what I had indicated. Note that this requires that you manually input:

  1. the filter for classrooms
  2. the level of the floor
  3. the floor type

Generally speaking hard coding inputs like this is problematic and should be avoided. What if you had classrooms at two levels? Would people know to add a filter for level earlier in the script and adjust the levels to run things twice? What if you wanted to do offices instead? Would people know to change both the string filter and the floor type to office?

By reading parameter values to select the floor type you can remove that input. If it comes up as something odd or null you can then have it create a new floor type as @Marcel_Rijsmus noted above.

By using the room’s level to assign the floor level you remove that input (and allow the script to run on projects with multiple levels).

These sort of changes take graphs like this from a ‘one time use’ setup to a major time saver on all projects.

1 Like

Thank you for your feedback.

Apologies, I thought I followed what you recommended. I jumped the gun a little, however I still got something to work out, which I am glad for.
I understand what you are saying about having to input strings more than once to re run for different floors, etc. but for the moment I am happy with this script. There is no doubt that my knowledge of Dynamo will increase, but I have literally only been using it for over a week.

So moving forward… How would I use the rooms associated level in this script? Or, how would I input all levels to be selected?

Thanks again

I have figured out the selecting multiple levels. I used Categories (Selected Levels) and linked this to All Elements of Categories which is linked to levels. That’s one input out of the way.

@K104

If you have the room you can have the level FROM that room, taking a shortcut.
The level is one of the properties of that room

@Marcel_Rijsmus

Yes I get that, but how do I apply that to the script. Is there a node that takes the room level from the room name that I can link to level?

yes, you can have it by using GetParameterValueByName from the rooms, you will have a list of levels in the same order as your rooms. Since index 1 of your rooms corresponds to the level mentioned at index 1 in the list of levels, you can feed it in in the create floor node.
Just make sure you see the Id of the Room in the list in green, if you see that you can get all parameters from it