How to - Select and Delete all Wall Types with Name Containing String

I am creating a script to delete all families containing a certain “R” prefix. By using Clockwork’s “All Families of Category”, I can select and filter and delete easily. However, “All Families of Category” does not work on system families (their disclaimer on it was right), and the same goes for “All Family Types of Category”. So, how do I select wall types (not Elements) by a set filter and then delete them?

I have tried “Wall Type” with delete, but it requires you to pick individual wall types already contained within the project. This would require 20 separate lines for each type, and would be useless for new introduced types.

I have tried “WallType.ByName”, which uses a string, but I can’t figure out how to get it to run sucessfully for ALL names that simply contain a substring.

I have tried “All Placed Family Types of Category”, which works on walls, but only on wall types that have been placed, and these walls will only exist as legend components, which this command does not consider to be “placed”.

Does anyone know of a solution, or perhaps another package I should download that would allow me to select All Family Types of Category, as with clockwork, but one that actually works on system families? I currently have the latest Clockwork, LunchBox, and archi-lab.net, none of which have a command for this.

Dynamo - Delete R

Thank you.

Look for similar examples maybe…
http://dynamoprimer.com/en/04_The-Building-Blocks-of-Programs/4-4_strings.html
http://dynamobim.org/forums/topic/search-for-multiple-strings-ex-different-room-names-in-a-string-contains/

The issue is not with the string, the issue is with specifically selecting multiple wall types. All of those posts are simply various methods of selecting multiple elements, not types. When it comes to selecting wall types, my options are limited to only WallType.ByName and Wall Types, both of which normally only process one item at a time. Wall Types doesn’t take an input so I can’t use a list, and WallType.ByName only accepts singular wall types, not lists of wall types. I need a way to select multiple wall types.

Try Element.GetType from Wombat Dynamo or Elements.Type from Archilab or Element.Type from Clockwork or the OOTB Element.ElementType node, or even better, Element Types + All Elements of Type, then use a ElementFilter.ByNameContains or ElementFilter.ByNameBeginsWith from Beaker

Look into Element Types and All Elements of Type. That will get you all Wall Types in your project.

Optionally, see what’s in the Primer, all basics are clearly explained there:
http://dynamoprimer.com/en/08_Dynamo-for-Revit/8-2_Selecting.html
Don’t hesitate to search with diverse keywords also:

Thank you for the suggestions, everyone. Unfortunately none of these options can select multiple types. I am not looking to select all elements of a type (which is what every single one of those examples will do instead), nor am I looking to select a singular type from a project (which is all that Element Types does).

I want to select all wall types. Not instances of types. Or just one Type. All types. Once I have that, I can filter from there.

Element Types requires picking only one type, it cannot receive a list. And leaving blank in the hopes that it will report all of the types simply returns a null value. Elements.GetType and Elements.Type simply tell you the type of an element that exists. I have no elements, only types. I don’t need to find the type of the element, nor is it a viable option for selecting the type. There are lots of options for selecting elements, but my options become very slim when you are trying to select multiple Types specifically.

I have been looking around on google for any possibilities of packages with a script to do what I am seeking to do, but have no luck so far. :frowning:

Looks like I’m not the only one with this problem. This thread did not achieve a solution either. As he said, this solution is not ideal as it requires you to specify each wall. This does not allow for any changes to types within the project, or it will fail or miss new types.

Is this not exactly what you’re looking for?
image

1 Like

No, this causes it to select the placed instance wall elements within the project, not the types themselves. This is proven by running it with delete elements and it will delete the wall instances, but types remain intact.

This is getting the wall types. Deleting them is probably failing because you have instances of these types in the project.


EDIT: Tried it out and deleting them actually works for me. It deleted all instances and the type. Which delete node are you using? Keep in mind you have to keep at least one Wall Type of each kind in a project, so you should be left with 3 Wall Types.

1 Like

I am using Elements.Delete, which worked on component families, what did you use?

See below for method with Element Types, which only deleted wall instances for me, not the type in the project.

This works on my end as well to delete Wall Types with names containing a string (it is only showing one element under the Object.Type node because only one of my walls contained “R”):

If your Elements.Delete node isn’t working, try one from a different package. The one I am using is from archi-lab.

5 Likes

Or simply select WallType instead of Wall in the Element Types node…

3 Likes

I just tried changing to archi-lab’s delete, and I even created a new type with Z, the only one in the project, and it still deletes just the wall instance and not the type.

That only selects one type, not all types. And it has to be specified.

As @Yna_Db stated you’re not grabbing the correct elements. You need to use WallTypes not Walls.

2 Likes

From the Element Types dropdown select WallTypes.

1 Like

Yes, but as I stated earlier, that does not work. It requires you to select from a drop down menu, one of the types in the project. That is not what I want. I want to select multiple types with a text filter, not a manual selection.

You’re not listening. The WallTypes node has a dropdown for a single Wall Type. But the Element Types node has a dropdown with an option for WallType. Using All Elements of Type on this node will get you all the Wall Types in your project.
image

3 Likes