Sort Views by Variable Project Browser Organisation

Hey all,

I am attempting to use the Data-Shapes TreeView Input so that the UI shows Views/Sheets in the same format as Revit’s Project Browser.
image

The catch is getting this to work when the parameters used for Browser Org are different between models.

I’ve managed to cobble together some Python and nodes that will identify and report the active Browser Org parameters which was the first part of the puzzle (suggestions of improvement are welcome).
Now, the issue is trying to group and sort the views by the Browser Org parameters when you don’t know how many levels there might be in the Browser.

I initially used the method outlined by @Mostafa_El_Ayoubi on another thread (Browser organisation in UI-dropdown) to try and get my head around the logic but this requires that you have a known/set number of Browser Org parameters which isn’t the case in this scenario.
I suspect that Python will be the answer here but my knowledge is rudimentary at best so I’m hoping someone can help direct me.
I’ve attached my WIP definition including some experimentation I’ve been doing with dictionary sorting.

Views by Browser Organisation.dyn (114.3 KB)

1 Like

@SBaker-AHMM ,

its better to show the graph also by pic… :slight_smile:

import clr

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument

clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

import System
from System import *

br_org = BrowserOrganization.GetCurrentBrowserOrganizationForViews(doc)

br_folders = br_org.GetFolderItems(doc.ActiveView.Id)
output = []
for folder in br_folders:
        fID = doc.GetElement(folder.ElementId).Name
        output.append(fID)


sort_order = br_org.SortingOrder
sort_param_id = br_org.SortingParameterId

bip = next((e for e in Enum.GetValues(BuiltInParameter) if int(e) == sort_param_id.IntegerValue), None)

OUT = sort_order, bip, br_folders, output

KR

Andreas

1 Like

Thanks @Draxl_Andreas.
May also be relevant that I’ve used nodes from Archi lab 2022.212.3222 and Data-Shapes 202.2.103.