I am working on some cable tray automation and I would like to input a specific Cable Tray TypeID into my python script.
As a first try I manually created cable tray instance in Revit to extract the element type using the “Element.type” node. I successfully forward the typeID as an input to the create tray node. The newly created cable try is in fact of the same type as expected. Great!
Next, what I would like to achieve is to select the corresponding Cable Tray Type Name from a list or search for the name in the various existing cable tray types in the project.
Now, if a cable tray of that specific type has already been placed in the project, I can select it using the “All Placed Family Types of Category” with “Cable Trays” as a Category input.
In normal situation I won’t have any cable trays in the model, so I cannot use this method to select the cable tray type. The node “All Family Types Of Category” returns an empty list if no cable trays exist in the model.
I tried using the “FamilyType.ByName” node but it returns the first matching family type which is in this case a cable tray fitting which shares the same type name.
I found this old thread https://forum.dynamobim.com/t/cabletraytype-id/1499 but couldn’t figure out a solution.
Any thoughts on how to accomplish the idea? I know I can always insert a cable tray in Revit to select it in Dynamo and get the typeID, but it doesn’t feel right to me. I could also change the names of all my fittings but that would be time consuming.
Any help is appreciated!