DemolishedPhaseId Property


Id of a Phase at which the Element was demolished.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 22.0.0.0 (22.1.0.0)
Since: 2013

Syntax

C#
public ElementId DemolishedPhaseId { get; set; }
Visual Basic
Public Property DemolishedPhaseId As ElementId
	Get
	Set
Visual C++
public:
property ElementId^ DemolishedPhaseId {
	ElementId^ get ();
	void set (ElementId^ value);
}

Remarks

After setting the property, DemolishedPhaseId regeneration can fail if CreatedPhaseId and DemolishedPhaseId are out of order with respect to their index in the property Document.Phases . Can be set to invalid element id.

Examples

Copy C#
void ShowPhaseDemolishedName(Element element)
{
    // Get the Phase Demolished property, and check whether it be null
    Autodesk.Revit.DB.Phase phaseDemolished = element.Document.GetElement(element.DemolishedPhaseId) as Phase;
    if (null == phaseDemolished)
    {
        TaskDialog.Show("Revit","This Element doesn't have Phase Demolished parameter.");
    }
    else
    {
        // Show the Phase Demolished name to the user.
        String prompt = "The phase demolished is: " + phaseDemolished.Name;
        TaskDialog.Show("Revit",prompt);
    }
}
Copy VB.NET
Private Sub ShowPhaseDemolishedName(element As Element)
    ' Get the Phase Demolished property, and check whether it be null
    Dim phaseDemolished As Autodesk.Revit.DB.Phase = TryCast(element.Document.GetElement(element.DemolishedPhaseId), Phase)
    If phaseDemolished Is Nothing Then
        TaskDialog.Show("Revit", "This Element doesn't have Phase Demolished parameter.")
    Else
        ' Show the Phase Demolished name to the user.
        Dim prompt As [String] = "The phase demolished is: " + phaseDemolished.Name
        TaskDialog.Show("Revit", prompt)
    End If
End Sub

Exceptions

Exception Condition
Autodesk.Revit.Exceptions ArgumentException When setting this property: The element does not allow setting the property DemolishedPhaseId to the value of demolishedPhaseId. -or- When setting this property: Invalid order of phases: An object cannot be demolished before it was created.
Autodesk.Revit.Exceptions ArgumentNullException When setting this property: A non-optional argument was null
Autodesk.Revit.Exceptions InvalidOperationException When setting this property: The element does not have properties CreatedPhaseId and DemolishedPhaseId. -or- When setting this property: The element does not allow setting the properties CreatedPhaseId and DemolishedPhaseId.

See Also