Python get parameter name list

Hi all,
I am trying to learn some python forcing my self to do some scripts. Using dynamo nodes, I am able to perform this action with no problems, but doing it in python it’s a complete different thing.

At the moment I am trying to retrieve parameters name associated to project informations but I keep getting a list of (I think) Revit Objects, not the parameter names.

Please check the image below

  1. This is the OUT variable from the python script

  2. This is the code

> import clr
> 
> #Import Revit Nodes
> clr.AddReference("RevitNodes")
> import Revit
> clr.ImportExtensions(Revit.Elements)
> 
> # Import RevitAPI
> clr.AddReference("RevitAPI")
> import Autodesk
> from Autodesk.Revit.DB import *
> 
> # Import DocumentManager and TransactionManager
> clr.AddReference("RevitServices")
> from RevitServices.Persistence import DocumentManager
> 
> doc = DocumentManager.Instance.CurrentDBDocument
> 
> allProjParam = []
> 
> collector = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_ProjectInformation).ToElements()
> for projPar in collector:
>     allProjParam.append(projPar.Parameters)
> 
> 
> 
> OUT = allProjParam

From here I would like to have a list of all parameter names, not just revit objects, anyone knows how to? :slight_smile: THANKS

@Ernesto_Pellegrino try this way;

thanks @jean but it seems that .Parameters has no definition attribute :confused:

@Ernesto_Pellegrino Or just copy paste from here,

import clr

#Import Revit Nodes
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)

# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *

# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
from RevitServices.Persistence import DocumentManager

doc = DocumentManager.Instance.CurrentDBDocument
allProjParam = []

collector = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_ProjectInformation).ToElements()

for projPar in collector:
    for parameter in projPar.Parameters:
        allProjParam.append(parameter.Definition.Name)

OUT = allProjParam
4 Likes

awesome! thanks @jean

I was trying to search “something to do that” with the dir() function but I didn’t see .Definition

:smiley:

have a great day!