This Assistant extension scans linked Revit models, collects all unique room names, and writes them to an Excel file together with automatically generated color codes. The resulting Excel sheet can be used as a reference for color schemes, diagrams, or for coordinating room-based color standards across a project.
Extension ID: GenerateRoomColorCodesInExcel
This extension runs inside Revit and requires an open model.
The extension has one setting available in the Assistant task configuration.
- File Path (
FilePath)
- What it is: The full path to the Excel file where room names and color codes will be stored.
- How to set it: Use the file picker in the task configuration to browse to a folder and choose or type a file name ending in
.xlsx.
- Behavior:
- If the file already exists, the extension will open and update it.
- If the file does not exist, the extension will create a new Excel file.
- Only
.xlsx files are supported.
When you run the extension:
- It checks that a Revit model is open. If no model is open, it stops and reports the issue.
- It verifies that you have provided an Excel file path. If not, it stops and asks you to select a file.
- It looks through all linked Revit models (Revit links) in the current project.
- In each linked model, it finds all rooms and reads their room names.
- It builds a list of unique room names across all linked models (case-insensitive, so
Office and office are treated as the same).
- If no rooms are found, it stops and informs you.
- It opens the Excel file you selected, or creates a new one if it does not exist.
- It ensures there is at least one worksheet. If needed, it creates a sheet named
Room color code.
- It sets up two header columns,
Room Name and Color Code, if they are not already present.
- It removes any existing rows whose room names no longer exist in the current Revit links.
- It generates a set of distinct colors and assigns a color to each room name.
- For each room name, it writes:
- The room name in column 1.
- A hex color code (for example
#FFCC00) in column 2.
- A cell background color matching that hex value in column 2.
- It saves the Excel file to the path you specified.
-
Prerequisites
- Revit is open.
- A Revit model is open and active.
- The model has at least one linked Revit model containing rooms.
- You have permission to create or modify the target Excel file (network/drive permissions).
-
Configure the Task in Assistant
- Add a new task in Assistant and select the
GenerateRoomColorCodesInExcel extension.
- In the configuration panel, locate the
File Path field.
- Use the file picker to select an existing
.xlsx file, or type a new file name in a folder where you have write access.
- Save the task configuration.
-
Run the Task
- Ensure the correct Revit model is active and all relevant Revit links are loaded.
- Run the Assistant sequence or execute this task directly.
- Wait for the task to complete. For larger projects, scanning links may take a short time.
-
Verify the Results
- Open the Excel file you selected.
- Go to the first worksheet (or the worksheet named
Room color code).
- Confirm that:
- The first row has headers
Room Name and Color Code.
- Each following row lists a room name from the linked models.
- Column
Color Code shows a hex code and each cell has a background color.
- If you re-run the extension after changes in Revit, verify that rooms that were removed from linked models are also removed from the sheet.
- Causes:
- Revit is open but no model is loaded.
- The active document is not a standard Revit model.
- Solution:
- Open the relevant Revit model and make sure it is the active window.
- Re-run the extension from Assistant.
- Resources:
- Revit help on opening and managing models.
- Causes:
- The
File Path setting was left empty.
- The configured path is invalid or was cleared.
- Solution:
- Edit the task configuration in Assistant.
- Use the file picker to select or create a
.xlsx file.
- Save the configuration and run the task again.
- Resources:
- Assistant documentation on configuring task inputs.
- Causes:
- The current Revit model has no Revit links.
- The linked models do not contain room elements.
- Room elements exist but are not in a loaded link.
- Solution:
- Check that the relevant Revit links are loaded in the active model.
- Confirm that rooms have been placed in the linked models.
- If needed, open the linked models directly to verify room data.
- Resources:
- Revit documentation on rooms and area planning.
- Causes:
- Excel file is open and locked for editing by another user.
- You do not have write permissions to the target location.
- The path points to an unsupported or corrupted file.
- Solution:
- Close the Excel file before running the extension.
- Verify that you have write access to the folder.
- Try selecting a different
.xlsx file or location.
- Resources:
- IT support or project folder access guidelines.
-
Q: When should I use this extension?
- A: Use this extension when you need a consistent list of room names from linked models, together with unique color codes, for use in color diagrams, presentations, or coordination documents.
-
Q: Does it work with rooms in the host model, or only in links?
- A: The current implementation reads rooms only from linked Revit models (
Revit links). Rooms placed directly in the host model are not exported.
-
Q: What happens if I already have data in the Excel file?
- A: The extension keeps the
Room Name and Color Code structure in the first worksheet. It removes rows for room names that no longer exist in the linked models and appends rows for new rooms. Other sheets in the workbook are not modified.
-
Q: How are the colors chosen?
- A: The extension generates a set of distinct colors using an internal algorithm. Each room name is assigned a color and corresponding hex code automatically; you do not need to choose colors manually.
-
Q: Can I edit the Excel file after it is generated?
- A: Yes. You can adjust formatting or add additional columns. However, if you change or delete room names in the first column, those changes may be overwritten or removed the next time you run the extension, depending on which rooms exist in the Revit links.