Search code examples
c#revit-apirevit

How to get Type Parameters of structural beam


Can any one tell me how to get Type Parameters of structural beam? Parameters like section height, width, area?

I suppose I should start something like this:

    Selection sel = uidoc.Selection;

    Reference pickedRef = null;

    pickedRef = sel.PickObject(ObjectType.Element, "Please select beam");

    Element e = doc.GetElement(pickedRef);

    ElementType type = doc.GetElement(e.GetTypeId()) as ElementType;

    BuiltInParameter height = BuiltInParameter.FAMILY_HEIGHT_PARAM;

    Parameter h = type.get_Parameter(height);

    //OR
    Parameter hh = type.LookupParameter("Height");

    //Then don't know what to do
    double h1 = h.AsDouble(); //Or what?

But I don't get required type parameters, I get null exception.

Can anyone tell me what I am doing wrong? Am I using wrong BuiltInParamater, or something else?

Thanks! Milos


Solution

  • Your code seems correct, I believe the parameter is not available for this type of element. Try download the Revit Lookup and inspect the element.