BrowserOrganization Groupby?

image

Is it possible to get the grouping and sorting information by using python? cant find any from revitapi doc.

You should be able to access browser organization class here…

https://www.revitapidocs.com/2020/4fd57c3f-6127-efd9-f79e-70ad3e5dc1cc.htm

This is a static method, so just do BrowserOrganization.GetCurrentBrowserOrganizationForViews(doc) where doc is the Document you want to get the browser organization for.

You can get the SortingOrder (ascending/descending) as well as sorting parameter id which you can pass into doc.GetElement(id) to get the parameter.

2 Likes

Thank for the reply :slight_smile:
May I know how to get the parameter after getting the browserorganiztion? :frowning:
image

You could probably use Element.Parameters to see which parameters there are and using Element.GetParameterValueByName to actually get the value(s)

Hey,

‘Static Methods’ which I think are the same as ‘Properties’?! (Daniel will correct me :smiley:) are accessed using ‘Dot Notation’…

sortingOrder = browsOrg.SortingOrder

Note that ‘Properties’ are not the same as ‘Parameters’… Which are another bundle of excitement to access.

Also, note that while you can ‘Get’ you can’t ‘Set’? (I don’t think).

@Daniel_Woodcock1 for my interest, I’m not sure whether the parameter is usable? I get a null? Any thoughts? :slight_smile: Solved: BrowserOrganization.SortingParameterId - Autodesk Community

Hope that helps,

Mark


1 Like

Ah, right. I thought this would return a valid ElementId that referred to a ParameterElement. Looks like from what JT is saying that this is actually the integer value of a BIP. In this case, simply convert to an enum…

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.GetCurrentBrowserOrganizationForSheets(doc)

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

image

2 Likes

And no, I don’t think you can set these values, or at least I have not seen any API to support setting the Browser Organisation, but I’ve never really looked too far into the Browser and what you can or can’t do with it, so could be wrong.

1 Like

Nice, thanks!

JT :smiley: can he sing Cry Me a River?!

2 Likes

Maybe… Although it should be ‘Crying: Me in Revit’ (Autodesk.Revit.DB remix feat. Element.Id and the Parameters).

2 Likes

thanks :slight_smile:
can we get the first name of groupby also?
image
Becoz I want to check the first “groupby” parameter, then set its parameter at its view.

Hey,

Apologies, out of time for today, hopefully this helps…

Mark


4 Likes

thank you so much!! :slight_smile:
the revitapi makes me dizzy…
really appreciate for the help! :slight_smile:

1 Like

The problem is that you need to learn Python to implement it, but it’s written in C#, so you’re translating between the two without knowing either!

Don’t worry, it gets easier, there are lots of good resources if you dig around on here, and also there’s a nice website here which I use… Worked Examples

Cheers,

Mark

3 Likes

yes…I was learning both eventually :frowning:

1 Like