SetEndTreatmentTypeId Method


set the end treatment type id for the designated shape end

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

Syntax

C#
public void SetEndTreatmentTypeId(
	ElementId treatmenetId,
	int iEnd
)
Visual Basic
Public Sub SetEndTreatmentTypeId ( _
	treatmenetId As ElementId, _
	iEnd As Integer _
)
Visual C++
public:
void SetEndTreatmentTypeId(
	ElementId^ treatmenetId, 
	int iEnd
)

Parameters

treatmenetId
Type: Autodesk.Revit.DB ElementId
iEnd
Type: System Int32

Examples

Copy C#
#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
Copy VB.NET
#Region "Autodesk.Revit.DB.Structure.ReinforcementSettings"
Private Function SetEndTreatmentType(doc As Document, rebarShape As RebarShape) As Boolean
    Dim [set] As Boolean = False
    ' check if end treatments are defined by rebar shape
    Dim settings As ReinforcementSettings = ReinforcementSettings.GetReinforcementSettings(doc)
    If Not settings.RebarShapeDefinesEndTreatments Then
        Try
            ' can only be changed if document contains no rebars, area reinforcement or path reinforcement
            settings.RebarShapeDefinesEndTreatments = True
        Catch e As Exception
            ' cannot change the settings value
            TaskDialog.Show("Revit", e.Message)
        End Try
    End If
    If settings.RebarShapeDefinesEndTreatments Then
        Dim treatmentType As EndTreatmentType = EndTreatmentType.Create(doc, "Flame Cut")
        rebarShape.SetEndTreatmentTypeId(treatmentType.Id, 0)

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

        [set] = True
    End If

    Return [set]
End Function
#End Region

Exceptions

Exception Condition
Autodesk.Revit.Exceptions ArgumentException iEnd not a valid shape end
Autodesk.Revit.Exceptions ArgumentNullException A non-optional argument was NULL
Autodesk.Revit.Exceptions DisabledDisciplineException None of the following disciplines is enabled: Structural.

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 →