Automatically Deleting 3D Views

Hi dear friends

I worked on a script to create new 3D views based on each specified clash in Revit model (As shown in the first attached pic). I want to extend my script to automatically delete these new 3D views, which were created in the last run, before creating new 3D views based on new clashes.


To delete my views, I tried to get all my 3D view names from the model, and filter it to use “Delete Elements” node to delete them, but it did not work unfortunately (Please see the attached pic).

Can anybody help me? How can I give sequence to our modules in Dynamo? In the same script I have a module to create new 3D views after each run. How can I delete these two 3D views first before creating new ones?
Thanks and your helps will be appreciated :slightly_smiling_face:

Hi @Mojtaba.vlj, you are trying to get a “True” with anything that matches “Clash”. You need to use a String.Contains “Clash” and then get the true/false from that to your List.FilterByBoolMask :slight_smile:

1 Like

Hi,yes. I want to delete views that has “Clash” in their name. Could you please send me a very simple example? Thanks

Of course :).

1 Like

I tried and it does not work :frowning:

Can’t you do the deletion in Revit itself?
(count your mouse clicks)

1 Like

Between Element.GetParam node and String Contains node, you need a “String From Object” node to convert the value to String. :slight_smile:

1 Like


Do you think those values are not strings already?

1 Like

You’re right, didn’t notice. Just assumed they were not :-).

Thanks :slight_smile:

It worked. But when I wanted to delete those views by “Elements.Delete” node from archilab, it gave me an error. I also tried it with “Tool.Eraser” node from SteamNodes, it did’nt give me any error but my views were not deleted.

Try use a Flatten between Mask and Elements.Delete.

1 Like


Null values are the culprit here i think.
So the selection of 3D views is not working.
A View must have a name

1 Like

Just tried it. Removing the nulls will do it :slight_smile:

1 Like

I tried with Flatten between Mask and Elements.Delete. but it still doesn’t work.
Thanks @Marcel_Rijsmus for your response. But when I check my 3D Views, I see all my views have a name. How can I remove nulls from the list?

didn’t see at first


There is a node called ‘IsNull’ which returns a true/false. Use a Mask with that.

1 Like

I tried again and finally it worked. Now my views could be deleted. Is null usual as shown in the following pic?

I have another issue. In my script, I have several modules. One of them is to delete my previous views created and saved in my models, and another one is to create new 3D views in my model based on the most updated clashes. Is there a way to give a sequence to the script operation? For example, first delete the previous views and then create new views. If both modules in my script work simultaneously, no new 3D views will be created.

Thanks you so much :slight_smile:

Mabe the transaction end node or pass through node?

btw, if you see yellow or red nodes, something is wrong

1 Like

Thanks for your helps. Do you have any idea?

@Mojtaba.vlj basically you can set up a ‘gate’ which forces the evaluation of the downstream content so you delete prior to creating the new content. These are easily made in a code block as follows:


This effectively says, don’t pass along the items that start the next stage of the graph until you get the items that finished that stage of the graph. If this isn’t obvious after reading it, please mark a solution here, check the rest of the forum for similar results, and then make a new topic for your new problem. This will allow others to learn from the help we give you.

1 Like