How to get the order of view filters as shown in VV / Filter tabs?

Hello everyone, I’m wondering if it is possible to get the order of view filters in a view? As you can see in the screenshot below, in the VV/ Filters tab (left side of the screenshot), the order is:
COLD WATER SUPPLY
HOT WATER SUPPLY
HOT WATER RETURN
WASTE PIPE
SOIL PIPE
VENT PIPE
but the result is different (right side of the screenshot). I know the result is due to the order of view filter IDs. So is there a way to get the filters arranged in the same order in the Filters tab? Please give me some advice. Thank you.

Hi,
since Revit 2021, you can use this method

GetOrderedFilters

Hi @c.poupin , thanks for replying. But what about Revit 2019, Revit 2020? Because some projects that I’m working still using Revit 2019, 2020.

Unfortunately, it’s not possible, the other method GetFilters() return list of filter ordered by Ids

@c.poupin Ok, I got it. Thanks a lot for your help.