Create View Filter - Spaces and Rooms by Level

My end goal is to auto-create view filters for all levels of a project, to hide all rooms and spaces not associated with each view.

Example filter:
CREATE%20VIEW%20FILTER%20-%203

I have tried two different methods without success.

Method 1:
CREATE%20VIEW%20FILTER%20-%201

Method 2:
CREATE%20VIEW%20FILTER%20-%202

On method 2, I was able to get the create view filter to give me a message saying my filter name needed to be unique. I can’t seem to get that result again.

I’ve read various other posts, but I was not able to find one on how to make a simple on/off filter like this one.

Any help would be appreciated.

Scripts:
CREATE VIEW FILTER -1.dyn (12.7 KB)
CREATE VIEW FILTER -2.dyn (7.7 KB)

In method 2, you want to feed an actual view into the View.AddFilter node instead of a view template. I believe.

Tried that without success. The issue occurs during Create View Filter. As it is returning a null value.

Here is the message. “Sorry, failed. Please check that you have a unique filter name.”

The name “[TEST FILTER]” is unique.

Any ideas?

I’m back to method 1, it will work with the Category of Levels, Parameter name of Name. Will not work with Category of Rooms, Parameter Name of Level.

image

Have you tried using actual Level element instead of Level name?

Method 1:
I believe you might be making a mistake here. I’ve got a similar script that makes filters for me, and the key part is that your categories and “parameter” work on the same objects.
You’re applying a filter to the category “Spaces” but you are trying to filter on a parameter used by the “Level” category.
image

Perhaps the best thing you can do is add a project parameter to levels and spaces, and create your filter to work with those. As a bonus you can always perform a check on that project parameter before you run your filter generation to ensure that parameter is filled in correctly.

Thank you for the response. I finally came to that conclusion as well. Where I am using the rooms category for both inputs. For some reason, I’m getting the error “One of the given rules refers to a parameter that does not apply to this filter’s categories.” Which is confusing, because I got the level parameter from the room category.

image

I’d like to avoid the extra step of creating a new parameter if possible. It still feels like I should be able to create filters for spaces and rooms by level in Dynamo, since it can be done in Revit.

What happens when you put a “get first item in list” node between “All elements of Category” & “Parameter.ParameterbyName”?

Your script is now pumping in a list of “Level” parameters into the filter generation wich I highly discourage ( due to lacing and such )

Thank you for the ideas.

Like this?

Unfortunately the same result.

If you were talking about this:

I did try this:

Also, same result.

That’s a good call!

However, same result.

image

How strange,
I’ve got nearly the exact same setup ( with the exception of some naming stuff )
And it works in both RVT2017 and RVT2018

1 Like

Right?! :open_mouth:

This does help me build the logic for applying the filter to both rooms and spaces though!

CREATE VIEW FILTER V0_0.dyn (15.2 KB)

Here is the script, if anyone wanted to poke around with it.