Accessing Dimension Line Weight

Today we share a quickie from the Revit API discussion forum thread on how to access the line weight for dimension lines:

Question: I want to programmatically access a dimension line's line weight.

Here is a screenshot of what I am after:

Dimension line weight

Dimension line weight

Answer: Before you do anything else whatsoever, install RevitLookup.

It is an interactive Revit BIM database exploration tool to view and navigate element properties and relationships.

Use that to discover the relationships between the dimension lines, their styles, and the properties you are looking for.

Once you have that installed, you will quickly be able to determine that the dimension line weight is stored in a parameter value on the dimension type.

You can access it like this using the built-in parameter enumeration value BuiltInParameter.LINE_PEN:

  ElementId dimTypeId = dimension.GetTypeId();
  Element dimType = document.GetElement( dimTypeId );

  Parameter lineWeight = dimType.get_Parameter( 
    BuiltInParameter.LINE_PEN );

Many thanks to Bardia Jahangiri for the precise detailed answer.