1
    public IList<Parameter> GetAllParameters(Reference reference, Document doc, IList<ElementId> elementIds)
    {
        Element element = SelectElement(doc, reference);

        ParameterSet pSet = element.Parameters;

        IList<Parameter> param = new List<Parameter>();

        foreach (Parameter p in pSet)
        {
            if (p.Definition.Name.Equals(element.Name))
            {
                element.GetParameters(element.Name);

                param.Add(p);
            }
        }

        return param;
    }

I am supposed to get all parameters from an element in Revit, although, this isn't just working. How can I fix this?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131

1 Answers1

1

Basically, you already did it. You only need to get the parameter value. Something like this:

foreach (Parameter p in element.Parameters)
{
    switch (p.StorageType)
    {
        case RvtDB.StorageType.Double:
            double value = p.AsDouble();
            break;

        // ...

        default:
           string txt = p.AsValueString();
           break;
    }
}
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
ManuelSL
  • 126
  • 5
  • I highly recommend using RevitLookUp developed by @JeremyTammik, where you can see all the parameters and their values. See: https://github.com/jeremytammik/RevitLookup – Mbanch Nov 27 '21 at 18:59