I want to select only round duct

string to num not working

Hi @Vikram.Bhaliya one way maybe

Well, you are trying to change a non number
string into a number.

The cleaner way to do this is to get the Type, then get the FamilyName


~or~ if your pythonic inclined - pull the Shape property from the MEPCurveType or Connector classes. Now some fittings have multiple shapes…

import clr

clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import ConnectorProfileType

shape_enum = {
    int(getattr(ConnectorProfileType, v)): v
    for v in vars(ConnectorProfileType)
    if "_" not in v
}


def get_shape(duct):
    if hasattr(duct, "DuctType"):
        return shape_enum.get(int(duct.DuctType.Shape), None)
    if hasattr(duct, "MEPModel"):
        connectors = set(
            shape_enum.get(int(c.Shape), None)
            for c in duct.MEPModel.ConnectorManager.Connectors
        )
        return (
            connectors.pop()
            if len(connectors) == 1
            else "Multiple: {}".format(", ".join(sorted(connectors)))
        )


ducts = UnwrapElement(IN[0]) if isinstance(IN[0], list) else [UnwrapElement(IN[0])]

OUT = list(map(get_shape, ducts))

For the list input on List.FilterByBoolMask, feed in the All Elements of Category output, not the list of strings. You’re trying to filter your original list, after all.

Once you have a filtered list of elements, you can pull the size parameter or whatever else you’re looking to get out of round ducts.

thanks mike its working. Can i get element form any parameters value .i want to define duct gauge. so 1st step is to select max size height or width.

Round ducts only have a diameter - Should this be a new topic?

yes i want to separate both duct and after will define gauge its new topic you can say

The python node outputs a list of shape names. Use a String.StartsWith and List.FilterByBoolMask to filter the round ducts. This is similar to images of solutions in the discussion above.