Categories of families

Please send a link to the categories of families. how to access them programmatically, for example I need cable trays.

Check that out. You have an example here for walls


and you will find the enumeration of builtin categories here
https://apidocs.co/apps/revit/2022/ba1c5b30-242f-5fdc-8ea9-ec3b61e6e722.htm

Hi,
Categories are accessed from Autodesk.Revit.DB.BuiltInCategory.<enumeration>, see the list of enumerations here.

See this small example for reference. It will look for all the cable trays in your model and will prints if its a channel or a ladder:

from Autodesk.Revit import DB

doc = __revit__.ActiveUIDocument.Document

cable_tray_collector = DB.FilteredElementCollector(doc)\
                   .OfCategory(DB.BuiltInCategory.OST_CableTray)\
                   .WhereElementIsNotElementType()

for tray in cable_tray_collector:
	print(tray.GetShapeType())

how to take a value from a given parameter?

while it comes out like this.
image

Iā€™m not exactly sure that I understand what you mean, my guess is you want to search your parameter by name. If so you can use LookupParameter("<parameter name>")
See if you can get some useful information from this:

from Autodesk.Revit import DB

doc = __revit__.ActiveUIDocument.Document

cable_tray_collector = DB.FilteredElementCollector(doc)\
                   .OfCategory(DB.BuiltInCategory.OST_CableTray)\
                   .WhereElementIsNotElementType()

for tray in cable_tray_collector:
	length=tray.LookupParameter("Length").AsValueString()
	id=tray.Id
	print("Cable Tray {}: Length = {} mm".format(id,length))

Just note that if you are using Russian, the parameter name should also be in Russian when using LookupParameter

1 Like

your code seems fine except the .format(total_lenghth) in lieu of .format(total_volume) line 24