GetEndTreatmentTypeId Method


Get the id of the EndTreatmentType to be applied to the rebar.

Namespace: Autodesk.Revit.DB.Structure
Assembly: RevitAPI (in RevitAPI.dll) Version: 17.0.0.0 (17.0.1090.0)
Since: 2009

Syntax

C#
public ElementId GetEndTreatmentTypeId(
	int end
)
Visual Basic
Public Function GetEndTreatmentTypeId ( _
	end As Integer _
) As ElementId
Visual C++
public:
ElementId^ GetEndTreatmentTypeId(
	int end
)

Parameters

end
Type: System Int32
0 for the start end treatment, 1 for the end end treatment.

Return Value

The id of a EndTreatmentType, or invalidElementId if the rebar has no end treatment at the specified end.

Examples

Copy C#
private void ListEndTreatments(Document doc, List<Rebar> bars)
{
    StringBuilder info = new StringBuilder();
    for (int n = 0; n < bars.Count; n++)
    {
        // get end treatment for both ends of bar
        for (int i = 0; i < 2; i++)
        {
            ElementId treatmentTypeId = bars[n].GetEndTreatmentTypeId(i);
            if (treatmentTypeId != ElementId.InvalidElementId)
            {
                EndTreatmentType treatmentType = doc.GetElement(treatmentTypeId) as EndTreatmentType;
                info.AppendLine(string.Format("End treatment for bar {0} end {1}: {2}", n, i, treatmentType.EndTreatment));
            }
        }
    }

    TaskDialog.Show("Revit", info.ToString());
}
Copy VB.NET
Private Sub ListEndTreatments(doc As Document, bars As List(Of Rebar))
    Dim info As New StringBuilder()
    For n As Integer = 0 To bars.Count - 1
        ' get end treatment for both ends of bar
        For i As Integer = 0 To 1
            Dim treatmentTypeId As ElementId = bars(n).GetEndTreatmentTypeId(i)
            If treatmentTypeId <> ElementId.InvalidElementId Then
                Dim treatmentType As EndTreatmentType = TryCast(doc.GetElement(treatmentTypeId), EndTreatmentType)
                info.AppendLine(String.Format("End treatment for bar {0} end {1}: {2}", n, i, treatmentType.EndTreatment))
            End If
        Next
    Next

    TaskDialog.Show("Revit", info.ToString())
End Sub

Exceptions

Exception Condition
Autodesk.Revit.Exceptions ArgumentOutOfRangeException end must be 0 or 1.

See Also

ArchiLabs Desktop

Put AI to work inside Revit.

Give Desktop your instructions and project files to build Revit families, update model elements, and create views and schedules. Works directly in Revit and AutoCAD.

Explore Desktop →