Get all objects by parameter

So I have a bunch of elements that have a custom parameter assigned. I would to get all those items that have something filled out in those custom parameters. What would be the best way to go about that?

I was thinking that I could grab all the elements in the model and then filter them by if the parameter exists, and then again filter by whether there is something filled out or not. The first problem I ran into was under the revit>selection there was no select all elements, just all in categories, on levels ect… A work around would be to create node for each category combine the list and then flatten them, but that seems like a more work then should be required. Thanks.

Actually this is what I came up with. Works Ok.

2016-03-31 14_57_43-Dynamo

Hello Dennis,

There is a node called “All Elements In Active View”. Maybe this works for you?

Printscreen

Regards, Vincent

Hello Dennis, It is possible to get all elements with some python scripting.

script 1 gets all elements, also non model elements (styles etc).

script 2 get only model elements. just paste the script into a python node and run to get the elements.

script 1

script 2

Filteren should be doable with standard dynamo nodes.

Regards, Martin

Thanks but I need all the elements in the project with that parameter filled out.

@Martin Thanks I will give those a shot.

Since you need every element use a 3D view with everything turned on. I will warn you this may take some time depending on the project size. I have done similar scrips which were garbing every element in view (about 10-15,000 elements) and it took about 10 minutes to run.

Hi Dennis,

You can also try this:

 

There is actually something called Element Parameter Filter in Revit API that can be used just for this purpose. Keep in mind that it’s a slow filter, and running it over all of the elements in a model, will cost you some time.

Here’s how this works:

 

I am selecting a single element in a model to query it for Parameter Names. I then use that parameter and a sample value that a parameter must hold as filter criteria to return all elements that have that parameter and value combination. Now, this is category independent as you can see my filter returns a wall and a desk family since I typed “test” into these two elements Comments parameter.

Here’s Python code:

Capture1

Good luck!

oh and one more thing, please read this: The Building Coder

Hi there,

I’ve used the KULKUL’s python to select all elements in the model. But it select all elements, even those that are not in use. I would like to select only the elements that are placed in the model.

I don’t really know how to do it. I’ve tried to clean the list but it doen’t work.

Hi, I’ve changed sth but stil doesnt work.

 

Hi,

Maybe the Category.byname node is not working properly

 

Hi Manel,

You need to add Prefix “_OST”. Read this topic.

http://dynamobim.org/forums/topic/category-byname-node-doesnt-work/

Thks KULKUL,

In case that someone read this dicussion, just one little thing, the prefix is “OST_”, but it doen’t work for all the categories.

Hi Manel,

Which Dynamo version your using? Try to install latest Dynamo version 1.0. It works for me. Below there are some options how to get category. Good Luck!

 

Hi KULKUL,

I’m using 0.9.2 version because I’ve downloaded from this forum. I thought it was the latest one.

Do you know where I could find the latest one?

Thks

At the below you will find.

Yes, you were right. I was the dynamo version. Now it’s working that node.

 

Thks