Associate a determined number of parking stalls to the closest bloc


I need to associate a determined number of parking stalls to the closest bloc in an apartment complex.
All blocs have 1 park stall per apartment, so I need to set parameters with the name of the bloc and the apartment which that parking stall belongs.

For example, I have an apartment complex consisting of 10 blocs. Each bloc has 3 floors, and 4 apartments per floor. So, I’ll need 120 parking stalls. Each bloc needs to have the 12 closest parking stalls associated to it.

Does anyone know how to do this using Dynamo?

I’m not sure if I was clear, if there’s any question feel free to ask.

1 Like

You can use dynamo to calculate the distance between the center of parking stalls and the center of the apartment blocks and then assign the parking blocks to whichever apartment block is the nearest to it. You can use a shared parameter to input this information into the parking stalls

Hi, @SouravGanguli, thanks for your reply.

My main problem is how to hierarchize this action, like, how to avoid two different apartment blocks to pick up the same parking stall.

That would be an iterative script. Select all parking posts. Take the distance from them to the first building. For the first 12 spots assign the building parameter, and then remove them from the list of all stalls. Repeat for all buildings until all spots have been numbered.

This may not return optimized results though, as you may get different spot selection based on which building you start with.

If you provide a data set (sample Revit model with a basic mass for the buildings and an element for the spots) I can try to look into this sometime this weekend.


Hi, @JacobSmall, thanks for you reply

Sorry for the delay.
Following the files.

Thanks so much!

SharedParameters_TEST.txt (698 Bytes)
Parking.rfa (300 KB)
Test.rvt (1.5 MB)