All Elements of Category

New user stumbling through some early experiments. I tried to search the community here for something on this topic, but did not find anything.

I thought it might be useful to use Dynamo to generate a selection of objects in a Revit project without manually selecting them. I found the Revit > Selection > All Elements of Category node, which requires the input of a Category, and outputs a list of elements. Tried using a String input node to provide the Category input (my sample Revit file had several Walls drawn in it, so I chose “Wall” as the category; that did not work. I then found the Revit > Elements > Category > Create > Category.ByName node, which has a Category output and a name input. The help for that node indicates that the name input requires a string, but my “Wall” text input did not work, nor did “Basic Wall”. (Warning: Category.ByName operation failed. Requested value ‘Wall’ was not found. ElementQueries.OfCategory operation failed. [Last line appears total of four times.])

I also tried to add Revit > Selection > Categories node, hoping this might have a list of categories from which I could choose, and then send that choice to the All Elements of Category node, but when I double click that in the Library to add it to my workspace, nothing is added and this text appears on the Console:

Failed to load built-in type
System.InvalidCastException:
Unable to cast object of type ‘Dynamo.Nodes.Categories’ to type ‘Dynamo.Models.NodeModel’.
at Dynamo.Models.DynamoModel.CreateNodeInstance(String name)
Failed to create node ‘Categories’ (GUID: 9e768baf-c697-4f62-8c59-41bb02301a51)

Am I just providing the wrong name for the category that would select Walls, or am I missing something basic (or not so basic)? How should I be providing a Category for the All Elements of Category node?

Select All Elements of Category Test 01

2014-09-22_135935 The “All Elements of Category” usually goes hand in hand with the “Categories” node. Does that work for you?

Also might I suggest checking out the LunchBox package of Nodes by Nathan Miller. It can give you a more refined selection for some of the most common Revit elements.

The “Category.ByName” actually expects the built-in name of element categories in Revit. They usualy start with “OST_…”

1 Like

That would work perfectly for what I am trying to do. I had tried to add a Categories node, as noted in my original post, but was unable to do so. I tried again today, at work (different computer) and got a similar error message on the Console:

Failed to load built-in type
System.InvalidCastException:
Unable to cast object of type ‘Dynamo.Nodes.Categories’ to type ‘Dynamo.Models.NodeModel’.
at Dynamo.Models.DynamoModel.CreateNodeInstance(String name)
Failed to create node ‘Categories’ (GUID: f893f593-cecf-4e09-a182-54b030525d91)

Does that mean there is a problem with my installations, or a problem with the code for that node?

 

I had a similar problem once with an older daily version. It was solved by updating to the latest version of dynamo. You might want to do a clean install: uninstall dynamo and delete the dynamo 07 folder in program files, then reinstall.

I had installed 0.7.1. Are you suggesting that I install the latest of the pre-release 0.7.2 versions?

In playing around tonight, I stumbled on: Element Types (Wall selected) --> All Elements of Type --> to get all Walls in the Revit file. Not sure how this is different from selecting the Walls Category (if I could) and then getting all elements of that Category.

I am struggling with the terminology, as a Revit “Type” does not appear to correspond to a Dynamo Element Type. The Dynamo Element Types seem to be system families or system family Types (in the Revit sense). The Dynamo Family Type appears to be loadable Revit family types. (Although I had no luck in using Family Types (Wall Tag:1/4" selected) --> All Elements of Family Type --> to select all of the instances of that Wall Tag in the model (one is placed).

The daily version is the most feature rich one :slight_smile:

As I am just starting out in Dynamo, I was willing to trade a few newest features for stability, but I may try installing the latest at home over the weekend. Thanks for the advice.

Hi David,

I just loaded 0.7.2 on top of Revit 2015. Create a new project in Revit 2015, add some walls, then load Dynamo from the AddIns tab. Load this definition, and it will give you a list of wall elements. Works for me.

It uses the Categories selector that Dimitar recommended.

Select-All-Elements-of-Category-Test-01

I unistalled 0.7.1 and installed 0.7.2. The Revit > Selection > Categories choice in the Library places a Categories node that works as I had originally expected. Thanks for the heads up on the new version.

Hello,
I would like to create a project parameter to a particular list of elements from Revit in dynamo. We have a node " Create Project Parameter" in Dynamo, but this can only create parameter to all the elements which belongs to the category. I want to create parameter to only specific list of elements of a category.
Can anyone please help me?

I would recommend starting a new topic that is specific to your request. The post you replied too is nearly 7 years old and isn’t relevant.

1 Like

Closing this thread for the reasons noted above.