Create View Filter - Spaces and Rooms by Level


#1

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:

I have tried two different methods without success.

Method 1:

Method 2:

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)


#2

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


#3

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


#4

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

The name “[TEST FILTER]” is unique.

Any ideas?


#5

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.


#6

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


#7

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.

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.


#8

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.

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.


#9

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 )


#10

Thank you for the ideas.

Like this?

Unfortunately the same result.

If you were talking about this:

I did try this:

Also, same result.


#11

That’s a good call!

However, same result.


#12

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


#13

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.