ElementType Parameters

Hello all,
I am trying to extract some info from ElementTypes.
I can easily do it in Dynamo, but found it hard to replicate it with Python.
Any help is appreciated

Capture

You can export to excel with Data.ExportToExcel

Hello @afshin1978 ,
Welcome to Dynamo Community,
Yes you can extract the information from element type, you can refer this article,

Or you want to extract the information in excel, the refer this article and trying to solve your problem,

Thank you for your help.
I mentioned that I was able to do it with Dynamo. My question is that how I can do it with python?

Maybe my question was not clear:

How can I extract ElementType Parameters in python?

It would be helpful to share your python as you currently have it so we can see what may not be working.

sorry.
elemtype.Parameters

Try this. You have to get the element type from the doc, not just GetType().

cols = UnwrapElement(IN[0])
i = cols[0]
elemtype = doc.GetElement(i.GetTypeId())

many thanks for your help.
the problem is I get this which I have no idea how to convert to actual


parameter values:

here is an example

import clr
import sys
import System
from System.Collections.Generic import IList, List
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
import Autodesk.DesignScript.Geometry as DS

#import Revit API
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument

toList = lambda x : x if hasattr(x, '__iter__') else [x]
lstelems = toList(UnwrapElement(IN[0]))

OUT = [['{} : {}'.format(p.Definition.Name, p.AsValueString()) for p in eType.Parameters] for eType in lstelems]

4 Likes