Element.parameter

how can retrieve the value of parameters by python. my code is below. Not sure what is wrong or missing.

import clr
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
clr.AddReference("RevitAPI")
import Autodesk
#from Autodesk.Revit.DB import *
from Autodesk.Revit.DB import Mechanical
from Autodesk.Revit.DB.Mechanical import DuctInsulation
from Autodesk.Revit.DB.Mechanical import DuctShape
from Autodesk.Revit.DB.Mechanical import DuctSettings
from Autodesk.Revit.DB import Connector
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application

el = UnwrapElement (IN[0])

cType =
shMlst =
shSlst =
co1List =

for cn in el:

con = cn.MEPModel.PartType

con = cn.Parameters
cType.append(con)

OUT = cType#,dir(cType[0])

image

You are only retrieving the Parameter objects. In order to get their values, you should first determine their StorageType and then use the proper method to retrieve their values. For example:

con_values = []
for parameter in con:
    storage = str(parameter.StorageType)
    if storage == 'String':
        con_values.append(parameter.AsString())
    elif storage == 'Double':
        con_values.append(parameter.AsDouble())

etc. etc.

what is in con? Elements?

Yes, it’s the variable you assigned to cn.Parameters