Get all Parameter Names and values(object-type)?

Hello,

how can all Parameters? i mean see by name like design script is doing it x.Parameters[0]

import clr
import sys
sys.path.append('C:\Program Files (x86)\IronPython 2.7\Lib')
import System
from System import Array
from System.Collections.Generic import *
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager 
from RevitServices.Transactions import TransactionManager 

clr.AddReference("RevitAPI")
clr.AddReference("RevitAPIUI")

import Autodesk 
from Autodesk.Revit.DB import *
from Autodesk.Revit.UI import *

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication 
app = uiapp.Application 
uidoc = uiapp.ActiveUIDocument

#Boilerplate Code
my_element = UnwrapElement(IN[0])
element_parameters = my_element.Parameters
OUT = element_parameters

f.e. when i want to see also the values and object type

Have i to do it parameter by parameter or is it possible to get all in one ?

KR

Andreas

The API method returns the parameter elements, which is what you’re seeing. In order to see the parameter name and/or value you’ll have to query them individually. The name you should be able to get just by param.Name. The values can be a little tricky because each parameter will be a different type and therefore require a different As[Type] method to return a “legible” value.

Look at what’s available from the Parameter class and it should make more sense.

1 Like

@Nick_Boyts , So i can go one by one

Well you’d just use a loop, but yes. You have to go through each parameter to get it’s name and value individually. Same as looping through each element to get its list of parameters.

@Nick_Boyts

my_element = UnwrapElement(IN[0])
element_parameters = my_element.Parameters
IfcGuid = my_element.LookupParameter("IfcGUID")
parameter_value = IfcGuid.AsString()
OUT = "IfcGUID: " + parameter_value

same issues with IsInstance …

2022-05-24_17h43_12

I don’t follow. Is that not what you’re after? The parameter name and it’s value?

yes and the object type finaly @Nick_Boyts

Take a look at the members available to Parameter elements in the link I sent you. I believe there are a couple of ways to get this information depending on what version of Revit you’re using and how you want to get it.

2 Likes

Just to clarify here, the x.Parameters[0] in design script is actually calling a method on the elements that is returning the Name and Value. The my_element.Parameters in your python is returning a list of Revit DB parameter elements that then need to be queried as @Nick_Boyts indicated. These two “Parameters” are not the same.

2 Likes