How do you delete all views in a Revit model using Dynamo?

Hi all,

I am fairly new to Dynamo, but learning everyday!

I can’t understand why this seemingly simple task isn’t working. I’ve tried two techniques:

  1. The Document.Views node from Clockwork package and the Delete Elements node from Archi-lab-Grimshaw package. This results in no views being deleted.

  2. The Get All Views node from the Archi-lab_Grimshaw package and the Delete Elements node from Archi-lab-Grimshaw package works, however I’m not sure of the best way to use these two nodes without having several “Delete Elements” nodes (one per view type). Is there a way to concatenate a list of these different view types so that I can use a single “Delete Elements” node to delete all views?

Thank you in advance!

You can use a big 'ol list.create and flatten. Then feed that into delete.

Jumbo size that bad boy then hit the BOOM button (aka delete node, for those less bombastic amoungst us)

1 Like

Thanks for your reply. I just tried your method but the Delete Elements didn’t delete any views in the Revit model.

Is it possible that there is an issue with the Delete Elements node input says “Elements”? Is there some sort of conversion I need to do to the items in the flattened list? Pardon my laymen’s terms.

Here is the Workflow that I tried:

Some of those views probably can’t be deleted.

It didn’t seem to delete any views whatsoever.

You need a list.clean at the end. I can post a screenshot later.

*List.clean after the flatten. With a false on preserve indices.

Try the following instead:

8 Likes

you CANNOT delete all views from Revit model. There is a restriction that won’t allow you to delete all of them. Now, leave at least one out of the deletion process and you will be fine. I guess.

This worked! Thank you so much.

Yes, it totally makes sense that you cannot delete all views, I just wish there was some sort of error message.

How do you add 1 more view to that list2? I tried 2 views with ++, but it didn’t work. Also did try list.create.

Ok, sorry it works somehow. List.create didn’t work at first, but when I restarted dynamo it worked.

Actually is so easy to delete all views inside Revit: go to your View Schedule, don’t itemize every item, so that you only have one row with no text in it, click on that row, and click delete! You will delete all views in the model with a single click.

Thanks for your input, but if I have to manually create a schedule, select all views, then delete the rows, that is already too much work. I am here to have Dynamo automate tasks like that for me.

Create a schedule takes a few seconds, and you don’t have to manually select all views. By not clicking on “Itemize Every Instance”, you just need to do one click on the actual schedule (only one row, and that row will select all views for you)… No need to select all views one by one.

I believe it will take much longer for you to re-create this script. Remember that you can also save your schedule as a view and then import into other projects, so you don’t have to setup this schedule every time.

I love Dynamo, but sometimes I feel that people want to use it for things that are already there in Revit or other applications/plugins, but anyway…

Yes, creating a schedule takes a few seconds, but that is only the first step of your process.

Your method:

  1. Choose insert views from file
  2. Browse to project that contains schedule
  3. Find and select the schedule to import
  4. Select row to delete
  5. Delete

The Dynamo Way

  1. Launch Dynamo
  2. Browse to Script
  3. Run Script

Note that there are nearly half as many steps with Dynamo and they are much simpler steps.

Keep in mind that I process several models weekly. That means I need to maximize my department’s efficiency for these repetitive tasks. I don’t want to have people import the schedule to every model just to delete views. I would rather run a script because there is less thought involved, thus reducing the opportunity for errors. Also consider others in my department - I don’t want to train someone on how to delete views using a schedule. I would rather say, “run this Dyn.”

If you’re trying to convince me to complete a task manually rather than have a program do it, you are wasting your time.

My method: include the Schedule in the template and you will eliminate the first 3 steps altogether, so we are now left with 2 steps only.

Your method: Launch Dynamo (a few extra seconds), Browse to script (more seconds), Run. By the time you finish launching Dynamo, I finished already with my alternative method.

Since we are talking about efficiency here: Have you considered the time you spent building the .dyn, troubleshooting, teaching people how to use Dynamo, keeping up to date with dailybuilds and compatibility of packages, etc.? Are you familiar with K.I.S.S.?

And finally, I am trying to help you. You don’t have to be rude! And of course I am not trying to walk you away from using Dynamo: we are in the dynamobim forum for Christ sake! My intervention in this thread ends here. Goodbye.

1 Like

:kissing_heart:

The models that I process are from other consultants and clients. I do not have the ability to modify their templates to add this schedule.

Here’s my version of @Dimitar_Venkov 's example.Delete all views.dyn (3.4 KB)

2 Likes