Filterfunc in pyrevit.forms

I am trying to take template as user input by pyrevit forms, but I want to filter by viewtype. For instance only show templates of type Floor Plan.

I’ve tried looking for explanation/examples of uses of the filterfunc= argument for forms.select_views but all examples show filterfunc=None.

How can I found out how to apply the correct value of filterfunc to get desired results?

@eivhal Welcome!
plenty of examples in the github repo

selected_views = forms.select_views(filterfunc=lambda x: isinstance(x, DB.ViewPlan), use_selection=True)

The new search function in Github is invaluable for that matter.

using this:

you get this:

Great!
This was exactly the response I was hoping for.
I knew I had seen something like this in the pyRevit scripts, but Couldn’t find it.

Now i know how to search for the good stuff :slight_smile:

another way to search that I like is using notepad++
CTRL + F then
image

Nice! I never knew about this function.