Placing families from Excel as a department grid with color overrides in Revit/Dynamo

Hi everyone,

To clarify what I’m trying to achieve:

I have an Excel file that contains a list of rooms with their names, departments, and areas. The goal of this Dynamo script is to:

  1. Read the Excel data (room name, department, area)
  2. Calculate the side length of each room using √(Area)
  3. Place instances of a custom family (Famille4.rfa) in Revit as a grid — not a single row — where:
    • Each department gets its own row (i want it by grid)
    • Rooms are placed side by side within each row, sized according to their area
    • Each department is displayed in a different color

Thanks!

Tableau Excel Surfaces.xlsx (7.9 KB)

Famille4.rfa (480 KB)

Excel_to_Block.dyn (35.3 KB)

this is the result that i need

Sooo, what problem(s) did you run into?

1 Like

Please review the thread on how to best get help.
How to get help on the Dynamo forums - FAQ - Dynamo

There are also a ton of topics on this exact same workflow. Please read through them for suggestions or solutions before starting a new one.

2 Likes

Hi There, i edited the post

Hi, I really didn’t find them. I found one similar but it’s not resolved

I don’t know Python :snake:, but I think you should also post your Python :snake: codes
for people who do. The issue might be the Python :snake: codes.

i used chatgpt for that code :sweat_smile: , i hope if someone can help me without using any code

So what does the Python do?

I’ll start by saying that you don’t need Python for what I am seeing.

Don’t ask chatgpt for help here - if you think you need an AI assistant you can use the Dynamo one as the answers will be more tailored to the context (though you’re at least 7 versions of Dynamo and therefore likely 3 versions of Revit behind being able to use that - it’s time to update to 2024 (skip 2023 as the usual timeline would have support for it ending in a few months).

But before you even do that, you need to write down the steps for your process.

Something like:

  1. Read the excel file into Dynamo (avoid Excel if you can it’ll do more harm than good - CSV would be preferred; you can always export the excel to CSV and work with the snapshot stored therein)
  2. Build a list of dictionaries of the object data contained in the excel file, with a key for each heading
  3. Sort each list of dictionaries by area
  4. Calculate the side length by the square root of the area and add to the respective dictionary
  5. Calculate the offset by adding a small value to the area (to get a gap)
  6. Group the dictionaries by department
  7. Use a mass addition method to pull the ‘summed offset’ distance of each family in sequence and write to the respective dictionary (remember the first should be zero)
  8. Get the largest offset from each list of dictionaries and use that as the ‘row offset’, writing it to all dictionaries in the associated sublist
  9. Use the row offset + summed offset of each dictionary to create a family instance for each dictionary
  10. Set the width and length of the family using the side length

I’m leaving material out of this - you’ll have to think though that process before you start the build or it’ll be quite difficult to insert after the fact.

1 Like