Get Precast L shaped Beam Dimensions

Hello everyone,

I have a precast L-shaped beam, and I need to determine its detailed dimensions, including the height (h), height 1 (h1), seat, width (b), and length. How can I write a Python script to accomplish this?


Welcome Husam :slight_smile:

What you’re trying to do could be pretty easy.
I assume you’re working with a L-shaped beam family?
Then we should be able to get nearly all the parameters you need by using its type parameters. Except for the length, which is an instance parameter.
The key is to know how to read parameters from revit elements
That looks like this:

# this is how you get a number (double) from a parameter
parameter_value = element.LookupParameter("<insert parameter name here>").AsDouble()

This is a pseudo example on how to get the parameters you need

beam_element_type = beam_element.Symbol

# to get a paramer by name from anything , you can do this
beam_h = beam_element_type.LookupParameter("h").AsDouble()
beam_h1 = beam_element_type.LookupParameter("h1").AsDouble()
beam_seat = beam_element_type.LookupParameter("seat").AsDouble()
beam_width = beam_element_type.LookupParameter("b").AsDouble()

# length is different
length = beam_element.LookupParameter("Length").AsDouble() # <--- notice we're using the beam_element, not the type
# note 2: you might need to use Cut Length instead of Length depending on your needs

Finally, you may need to do some unit conversions if you’re not from America or the UK

metric_val = DB.UnitUtils.ConvertFromInternalUnits(revit_val, DB.UnitType.MetricMeters)

or something along those lines, there may be a type somewhere.

happy scripting