Get Value of Build-in-parameter drop-down list

Hallo dear Community,
to create a custom preflight check, I need to get parameter values. For regular parameters no problem, but if I do the same for parameters in drop-down list it returns “none”, eventhought it’s not none in the Revit Model.
How can I solve this? Thanks in advance.

#shared String parameter → works
addexp = wall.LookupParameter(“Expositionsklasse”).AsString()
print(addexp)
#Built in drop-down list parameter-> doesn’t work
addBetDeck = wall.LookupParameter(“Rebar Cover - Exterior Face”).AsString()
print(abbBetDeck)

Have you tried using Revit Lookup to check if it’s None or not?

Not with Revit Look up but I made a dynamo script that tells me, its not None.

image

I get the Parameter value like this, but when I try to convert it to string, it tells me, it’s none.

<Autodesk.Revit.DB.Parameter object at 0x00000000000005B8 [Autodesk.Revit.DB.Parameter]>

@LuiBache @Luffy11

grafik

i made this short time ago


import os, sys, datetime
from Autodesk.Revit.DB import *
from Autodesk.Revit.UI import *
from Autodesk.Revit.DB.Architecture import *
import time

# pyRevit

from pyrevit import forms, revit, script

# .NET Imports
import clr
clr.AddReference('System')
from System.Collections.Generic import List
# List_example = List[ElementId]()

from Autodesk.Revit.DB import *
import System

doc = __revit__.ActiveUIDocument.Document


time_start = time.time()

# 🏓 get doors
all_elements = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Doors).WhereElementIsNotElementType().ToElements()
src_element = list(all_elements)[0]

# Create a List of Parmaeter Names
p_names    = [p.Definition.Name for p in src_element.Parameters]

# Select Parameter
sel_p_name = forms.SelectFromList.show(p_names, button_name='Select Item')

for el in all_elements:
    p = el.LookupParameter(sel_p_name)

    if p:
        if p.StorageType == StorageType.String:
            value = p.AsString()
            print('Element[{}] {}: {}'.format(el.Id, sel_p_name, value))

time_end = time.time()
duration = time_end - time_start
print("\n The code took {} seconds to run.".format(duration))
# ✅END

you can modify the collector to walls

Thanks @andreasd811 for the hint to look at StorageTypes. So I solved my problem with

addBetDeck = wall.LookupParameter("Rebar Cover - Exterior Face").As**Value**String()
print(addBetDeck)
1 Like