Trying to delete views based on parameter value

Hi - All views in my Revit project have a parameter called View Category. I want to delete all views that include “.E1” in the View Category.

I know the Elements.Delete node needs Elements for an input. However, if I connect it to the output from the All Elements of Category node, that doesn’t work either. I’m stuck…

Thanks

Right now you are feeding the delete node parameter values instead of views. Have another look at your graph and see if you can work it out :slightly_smiling_face:

1 Like

As you know, that you need to feed the element, not the parameter as an input, take a look here:

https://forum.dynamobim.com/t/cant-delete-views/

1 Like

If I make the change shown here, then I get an error in the boolmask node. (“Dereferencing a non-pointer”)

I would guess that the number of bools is not equal to your elements. You have to preserve the indices and probably also check your list levels in the list input at your „filter by bool mask“ Node. Do you really need the „list create“ and „list clean“ nodes?
Try connecting the „all elements of category“ directly to the „get parameter value by name“.

It‘s a lot easier to check whats wrong if you show the output of every node.

1 Like

Here’s something to consider:

First and foremost you are using Category > All Elements of Category to select all Views. That’s not a good idea, probably, since some unexpected things are “views”. Let me give you an example: Project Browser is considered a View in Revit. That’s not something you want to delete. So a better way to select views is using archi-lab.net nodes that let you filter by view type directly like so:

Now, I don’t have a sample file that has View Category parameter so instead I am going to demonstrate the workflow on Sheet Name parameter. Sheet Name is a parameter that would be filled in if given view was placed on a Sheet, otherwise it will be empty. So let’s say my intention here is to delete all views that are not on a Sheet. You can see that in the above image at index [0][3]. The field is empty.

Now in the above image pay attention to how I set up a filter for Sheet Name, Equals to “”. Then I use the FilterByBoolMask node to filter out Views, not Sheet Names, because the Delete node needs an element not a String.

Cheers!

-K

2 Likes

Konrad, Gerrit, Martin, thank you. See below. Success.

I also tried using the List.Equals node as Konrad did (instead of String.Contains), but that didn’t work for me. I have allot to learn…