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.
Thank for the reply
May I know how to get the parameter after getting the browserorganiztion?
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 ) 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? Solved: BrowserOrganization.SortingParameterId - Autodesk Community
Hope that helps,
Mark
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
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.
Nice, thanks!
JT can he sing Cry Me a River?!
Maybe⦠Although it should be āCrying: Me in Revitā (Autodesk.Revit.DB remix feat. Element.Id and the Parameters).
thanks
can we get the first name of groupby also?
Becoz I want to check the first āgroupbyā parameter, then set its parameter at its view.
thank you so much!!
the revitapi makes me dizzyā¦
really appreciate for the help!
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
yesā¦I was learning both eventually