SetEndTreatmentTypeId Method


Rebar Shape Set End Treatment Type Id Method

Sets the EndTreatmentType id at the specified rebar shape end.

Namespace: Autodesk.Revit.DB.Structure
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntax
public void SetEndTreatmentTypeId(
	ElementId endTreatmentId,
	int iEnd
)

Parameters

endTreatmentId ElementId
The id of an EndTreatmentType element, or invalidElementId if the rebar shape should have no end treatment at the specified end.
iEnd Int32
0 for the start end treatment, 1 for the end end treatment.
Exceptions
Exception Condition
ArgumentException iEnd not a valid shape end -or- the parameter endTreatmentId is not an EndTreatmentType element.
ArgumentNullException A non-optional argument was null
Example
#region Autodesk.Revit.DB.Structure.ReinforcementSettings
private bool SetEndTreatmentType(Document doc, RebarShape rebarShape)
{
    bool set = false;
    // check if end treatments are defined by rebar shape
    ReinforcementSettings settings = ReinforcementSettings.GetReinforcementSettings(doc);
    if (!settings.RebarShapeDefinesEndTreatments)
    {
        try
        {
            // can only be changed if document contains no rebars, area reinforcement or path reinforcement
            settings.RebarShapeDefinesEndTreatments = true;
        }
        catch (Exception e)
        {
            // cannot change the settings value
            TaskDialog.Show("Revit", e.Message);
        }
    }
    if (settings.RebarShapeDefinesEndTreatments)
    {
        EndTreatmentType treatmentType = EndTreatmentType.Create(doc, "Flame Cut");
        rebarShape.SetEndTreatmentTypeId(treatmentType.Id, 0);

        ElementId treatmentTypeId = EndTreatmentType.CreateDefaultEndTreatmentType(doc);
        rebarShape.SetEndTreatmentTypeId(treatmentTypeId, 1);

        set = true;
    }

    return set;
}
#endregion
See Also