CreatedPhaseId Property


Id of a Phase at which the Element was created.

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

Syntax

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

Remarks

After setting the property CreatedPhaseId regeneration can fail if CreatedPhaseId and DemolishedPhaseId are out of order, i.e. their index in the property Document.Phases.

Examples

Copy C#
void ShowPhaseCreatedName(Element element)
{
    // Get the Phase Create property, and assert it should not be null
    Autodesk.Revit.DB.Phase phaseCreated = element.Document.GetElement(element.CreatedPhaseId) as Phase;
    if (null == phaseCreated)
    {
        throw new Exception("Elements always have a phase for when they are created.");
    }
    else
    {
        // Show the Phase Create name to the user.
        String prompt = "The phase created is: " + phaseCreated.Name;
        TaskDialog.Show("Revit",prompt);
    }
}
Copy VB.NET
Private Sub ShowPhaseCreatedName(element As Element)
    ' Get the Phase Create property, and assert it should not be null
    Dim phaseCreated As Autodesk.Revit.DB.Phase = TryCast(element.Document.GetElement(element.CreatedPhaseId), Phase)
    If phaseCreated Is Nothing Then
        Throw New Exception("Elements always have a phase for when they are created.")
    Else
        ' Show the Phase Create name to the user.
        Dim prompt As [String] = "The phase created is: " + phaseCreated.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 CreatedPhaseId to the value of createdPhaseId.
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