Phases Property


Retrieves all of the phases in the document.

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

Syntax

C#
public PhaseArray Phases { get; }
Visual Basic
Public ReadOnly Property Phases As PhaseArray
	Get
Visual C++
public:
property PhaseArray^ Phases {
	PhaseArray^ get ();
}

Remarks

The phases are returned in order from earliest phase to latest phase.

When Revit is running with UI activated, the default created phase for newly created elements is inherited from the phase of the currently active view.

When Revit is running without its UI, such as when Revit runs on Autodesk Forge Design Automation API for Revit, the default phase for newly created elements is the latest phase in the document.

Examples

Copy C#
void Getinfo_Phase(Document doc)
{
    // Get the phase array which contains all the phases.
    PhaseArray phases = doc.Phases;
    // Format the prompt string which identifies all supported phases in the current document.
    String prompt = null;
    if (0 != phases.Size)
    {
        prompt = "All the phases in current document list as follow:";
        foreach (Phase ii in phases)
        {
            prompt += "\n\t" + ii.Name;
        }
    }
    else
    {
        prompt = "There are no phases in current document.";
    }
    // Give the user the information.
    TaskDialog.Show("Revit",prompt);
}
Copy VB.NET
Private Sub Getinfo_Phase(doc As Document)
    ' Get the phase array which contains all the phases.
    Dim phases As PhaseArray = doc.Phases
    ' Format the prompt string which identifies all supported phases in the current document.
    Dim prompt As [String] = Nothing
    If 0 <> phases.Size Then
        prompt = "All the phases in current document list as follow:"
        For Each ii As Phase In phases
            prompt += vbLf & vbTab + ii.Name
        Next
    Else
        prompt = "There are no phases in current document."
    End If
    ' Give the user the information.
    TaskDialog.Show("Revit", prompt)
End Sub

See Also