Can't seem to Collect Conduit Bends using C#

I am trying to find a way to collect conduit bends in my Revit project. I can find and collect all the stright pieces, but not the bends.

Here is a sample of my code:

If anyone knows how I can modify my code to include the bends as well that would be amazing help.

This question is probably better suited for the Revit API Forum. Regardless, you may want to use the OfCategory method with the following two categories:

BuiltInCategory.OST_Conduit
BuiltInCategory.OST_ConduitFitting
2 Likes

@cgartland had given you the right categories, from the code above, you are just collecting all conduits, and not conduits fittings. Thatts why fittings werent in part of your collection. You can use ElementMulticategoryFilter to the wherepasses method to collect all conduits and conduit fittings at the same time.

1 Like

Also, make sure when you are collecting elements, that if you want the instances that are placed then use the…

.WhereElementIsNotElementType()

And…

.ToElements()

Methods on the FilteredElementCollector. Or you will collect the types of elements too, and I think you only want the placed instances.

2 Likes

Wow, I have never used that class before. Previously, I would create a list of FilteredElementCollectors and extend a master list of elements, but this is much cleaner.

1 Like

yea it is much cleaner to use as much as possible revit built-in search functionality since it is their own database :smiley:. Further more, this ElementFilter class object can be extended with LogicalAndFilter or/and LogicalOrFilter to create your own custom complicated filter to get your desired element