Getting a family by name with patial of that name

Hi all,

A few days ago I wrote a simple script about getting Pile coördinates from Revit to Excel.
And it worked fine! This morning I wanted to refine the script with less user input and before I altered anything I run the script…and it gave an error!
I have 2 user inputs: being the Excel file location and the other being the item selection. And it’s the 'Select Model Elements" node that’s the problem.

Warning: ElementSelector.ByUniqueId operation failed
The managed object is not valid

One of the refinings ment to auto pick all the Piles in my Revit model.
Butt there’s a catch…I want to select only the family’s that start with the number 17.
And 17 is the buildingpart code. Like wall openings indoors is code 32 and wall openings outdoors is code 31.
It’s part of the Dutch NL_SfB code.

But what node do I use to find that family?

Hi @Mike_Wellink

There is no way anybody would be able to figure out your problem with the information provided.
Please provide complete screenshots with list previews and error messages expanded. Thanks :slight_smile:

Hi @Kulkul

sorry if I was not clear enough but I’m not looking for an explanation of the error.
I’m looking for a way to replace the “Select Model Elements” node by a “select-only-the-family-names-that-start-with-17” node.

That way I can avoid the error in the first place.

“ElementFilterByName” is one of the possible way to filter by name

Thanks @Kulkul I’ll look into it right after I reïnstalled Dynamo.
It looks like to error massage has something to do with the Dynamo core.
My scripts keeps running and not ending/finished.
When I close Dynamo it’s notifying me that Dynamo has crashed.
So I un-installed it and about to re-install it again hoping that solves the problem. It could be the packages that I installed this morning that’s causing the problem.

@Kulkul this isn’t the thing I’m looking for. Thisonly gives me the family’s in my project and then filter out the ones that has 17 in it. That return me 2 familytypes: squire piles and round piles.

What I’m looking for is an sequence that get all my pile out of my Revit model.
Piles are a structural foundation. And the family name is “17_…” for all piles.
And I can’t find (because I’m a newbie) the right nodes to get the piles out of my model automaticly.
For now I’m using teh node “Select Model Elements” but this involves user input. And I want to get rid of that.

Here’s the pile family:

You could give spring nodes a try:

1 Like

Hi @Dimitar_Venkov,

no, that’s not working either. Your example gives me all element types that have some connection with the with “foundation”.

Yet I need to find only the Family types that start with “17_” because we have more tpes in that family that are not piles.

I only need Dynamo to find all the elements within the family types: “17_RHD_pile-round” and “17_RHD_pile-square”.
Once I have those I’ll have Dynamo get the Pilenumbers (“Mark” parameter) and the coördinates from the piles.

Won’t this cut it?

@jostein_olsen,

Hi Jostein,

Your close…but not close enough. You go directly from category to elements. Relying on the fact that the element names given by the user contains the word “fam” and in my case “pile”. But I can’t guarantee that my users do that. They should…but not always. So to make ik 100% fail proof I must first search for the correct family. In my case they start with 17_ because that’s a national rule her in my country. It’s part of an building code. And in order for BIM to work all items MUST make part of this code. So there is the one thing I can count on!

And after playing with your setup a bit I just typed “All families of category” in the node search bar and BOOM…there it was!!! That’s what I needed! And the funny thing is…I had used this node at the beginning of last week. When I started with Dynamo again after half a year!
But knowing a bit more Dynamo after a week tinkering in combination with YOUR example I was able to get what I needed.
So THANKS JOSTEIN!!! for putting me on the right track!
Now I need to get it to work in my pile script.