Door Replacement Script for Revit Toolbar Button

Hi :wave:

I’m trying to achieve the following goal and distribute it as a button in the Revit toolbar.
Having a clickable button is essential because I want to make it easily accessible for my team.

Desired Workflow:

  • Delete a door and replace it with our company’s predefined opening family.
  • Ensure that the new opening has the same dimensions as the deleted door.

In theory, this should be straightforward, but I’m struggling with the execution of the script.

Current Progress:

I have two scripts:

  1. Manual Mode Script – Works as expected but requires manual execution.

  2. Button-Triggered Script – Runs from a Revit toolbar button but does not retain the original door dimensions.

There is clearly some confusion in the script execution.

Challenges Faced:

  1. Handling Element Deletion Properly
  1. Preventing an Unwanted Loop in Manual Mode
  1. Transferring Door Properties to the New Opening

Issue with Button Execution:

I’ve done extensive testing but haven’t found a solution yet.
It would be really helpful if you could take a look.
A simple, clickable button is crucial to making this usable for my team.

I will provide a Revit test file (containing just a wall, a door, and a void) along with two Grasshopper scripts:

  1. Manual Mode Script
  2. Button-Triggered Script (for Revit UI)

Thank You!

I truly appreciate your help and hope there’s a straightforward solution.

Best,
Lukas

DoorToVoid (Button).gh (13.4 KB)
DoorToVoid (ManualMode).gh (13.9 KB)
DoorToWall.rvt (2.3 MB)

Autodesk Revit 2024
2024.3
24.3.0.13

Rhino 8
8.14.24345.15001

Rhino.Inside
1.29.9140.19217

I’ll take a look.

Any particular reason to delete the door vs change the Type?

1 Like

It’s a generic family. So I can’t just change the type I guess…

Hey @Japhy
Did you found some time to take a look?

If i understand correctly i think you just want to switch out the Type vs delete and replace, like so…

Hi @Japhy

Thanks for your help.
To clarify, I want to switch a door family to a generic model type.

I’m not just switching the type but the category.

best Lukas

If the goal is to keep the opening it seems like you would want to keep it as a door, turn off the visibility per type or remove its geometry and add the Generic Model (or its geometry) to the door Family.

Hi @Japhy,

This is about complying with our company’s guidelines.

The family is part of the BIMTool distributed by SOFiSTiK. Their plugin writes additional values to these families using a custom parameter. All annotation families, etc., are specific to this family.

I want to resolve this specific workflow. The script I created is partially working, but there’s an issue with the delete component—it’s not functioning as expected. I’ve tried to describe the problem as clearly as possible.

thanks for taking a look :mag: :pray:

Its an unusual workflow, is there any issue deleting the Door after the placement of your Generic Model family?

I can not place it because the door is in the same location

I understand this might sound uncommon, but imagine a scenario where someone wants to switch Revit’s rectangular wall opening to a door—that’s a similar use case. Maybe that perspective resonates more.

I’m all for atypical workflows.

This might be an option. Since your Generic Model is wall based, you can change its category to Door and be able to swap via Door Type.

Hi @Japhy,

It’s always great to get new perspectives and a different approach to a problem, even if it’s not exactly what I was aiming for. I still believe there might be an issue with the behavior of the delete component in Rhino.Inside, but I’ll test whether changing the family’s category could be a viable solution.

Thanks for your input! I might revisit the delete issue in a new, more focused topic later.

Hello,

Want to add that typically you should opt for using the easier workflow as Japhy suggested… but since nothing is always typical… please check the below method i used to do something similar before to achieve what you are looking for.

You need to manage the order your elements are being created and deleted, there is no need for timers etc. and since you are using a wall based family you can’t place them with the same dimensions as the door because it will be cutting nothing and you will get an error, so a simple trick is placing it at a slightly higher location then after the door is deleted move it back down by the same value.

NB. you will need to adjust your data trees as needed depending on your use case I jsut set this up quickly to explain the workflow.

1 Like

Hi @M.Tarabishy,

Thanks so much for your input! The workflow @Japhy proposed involves duplicating families along with their annotation families.

I was actually about to try the same trick with the location—so I really appreciate you sharing this here!

Hopefully, I can get the script to work now. :crossed_fingers: But thanks in advance either way!

Thanks again!

I’ve implemented it and… :drum: it’s working!

I really appreciate your help—thank you so much! :pray:

And thank you again, @Japhy!

I also implemented your idea just before, and it worked as well. You’re really putting a lot of work and effort into this forum, making it incredibly valuable.

Much appreciated! :raised_hands: