Dynamo Script to filter elements by height

Hi,

I would like to create a generic script in Dynamo for all elements associated with the electrical discipline in Revit 2019. I would like to create a filter in Revit to be able to filter out any electrical elements that are below a set height, i.e (3000) to highlight in any colour (pink) and if these elements are above 3000, nothing happens to them. This is to enable us to visually depict which elements are above or below a set height. Below is what I currently have as a code. I have added these parameters as shared parameters in the project and they do show up under the filtering rules but nothing happens. Am I missing something?

Hi @aram.odeshTVBYL ,

Seems like this is more of a Revit question than a Dynamo question.

It would be if it wasn’t Revit 2019. In Revit 2019 elevation or offset isn’t available to be scheduled or filtered and this is why I’m attempting to create a Dynamo script to enable us to schedule and filter these parameters.

Ah I see, well if you just want to use those values you could create a new Instance Parameter and use Element.SetParameterByName to copy those values into those other parameter-values.

However, couldn’t you just then not create a parameter calculation like =offset in Revit?

If you want to use a filter then you need to use a filter-able parameter. Which, as you mentioned, cannot be the built-in parameters from 2019 so you’ll have to create a new one to write to. The other option is to override the graphics in view using the existing parameters.

So I have tried to use SetParameterByName however it results in an added parameter that is different to the built in Revit parameter I need the script to pull the values from. See below screenshots.

You do need to use a different parameter than the builtin one but you shouldn’t use the same name. You need to add a project parameter to all your categories and write to that. You also need to make sure you’re pulling the value from the correct parameter for each category.

Hey Nick,

That’s what I’ve done hence why I have “Top Elevation”, “Offset” and “Elevation” to cover all of the electrical categories. The issue I’m facing is that even if I name the parameter to something else, it creates an instance of it but does not pull the values I need directly from the built in parameter. I will have to manually match the input for it to work. See screenshot below.

Correct. You only need one project parameter as you can use it for all of the builtin parameters since you’re treating them all the same with the filter, but it does need to be a unique name.

Since different categories have different parameters, you need to explicitly specify which one you want to use for each category, otherwise you’ll be pulling empty values and overwriting the project parameter with blanks in some cases.