I want to get all the parameters of a specific element category and append only the parameters from the visibility parameter Group., I can do it in Dynamo using Nodes, But i need to iterate thru a lot of instances so i tried to do it in Python.
I tried a similar post but didn’t get any results:
I only need to get the element id of all the parameters of the element, then i can check which group it belongs to and filter the results silimar to the pseudocode attached.
import clr
#Import the Revit API
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
elem = UnwrapElement(IN[0])
output = []
params = elem.Parameters
for i in params:
pg = i.Definition.ParameterGroup
if str(pg) == 'PG_VISIBILITY':
output.append(pg)
OUT = output
The Definition object you are using to retrieve the ParameterGroup also has a Name property, which returns the Parameter’s name as a string.
Try this instead:
pg_visibility = BuiltInParameterGroup.PG_VISIBILITY
for param in params:
pg = param.Definition.ParameterGroup
name = param.Definition.Name
if pg == pg_visibility:
output.append(name)