Parameter Relationships

Parameter Relationships

There are relationships between Parameters where the value of one Parameter can affect:

Additionally, some parameters are always read-only.

Some parameters are computed in Revit, such as wall Length and Area parameter. These parameters are always read-only because they depend on the element's internal state.

Figure 29: Wall computed parameters

In this code sample, the Sill Height parameter for an opening is adjusted, which results in the Head Height parameter being re-computed:

Code Region 8-6: Parameter relationship example

// opening should be an opening such as a window or a door
public void ShowParameterRelationship(FamilyInstance opening)
{
        // get the original Sill Height and Head Height parameters for the opening
        Parameter sillPara = opening.get_Parameter(BuiltInParameter.INSTANCE_SILL_HEIGHT_PARAM);
        Parameter headPara = opening.get_Parameter(BuiltInParameter.INSTANCE_HEAD_HEIGHT_PARAM);
        double sillHeight = sillPara.AsDouble();
        double origHeadHeight = headPara.AsDouble();
 
        // Change the Sill Height only and notice that Head Height is recalculated
        sillPara.Set(sillHeight + 2.0);
        double newHeadHeight = headPara.AsDouble();
        MessageBox.Show("Old head height: " + origHeadHeight + "; new head height: " 
                + newHeadHeight);
}