Element.parameter

#1

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

0 Likes

#2

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.

0 Likes

#3

what is in con? Elements?

0 Likes

#4

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

0 Likes