Some architectural projects, such as renovations, proceed in phases. Phases have the following characteristics:
All phases in a project can be retrieved from the Document object. A Phase object contains three pieces of useful information: Name, ID and UniqueId. The remaining properties always return null or an empty collection.
Each new modeling component added to a project has a Created Phase ID and a Demolished Phase ID property. The Element.AllowPhases() method indicates whether its phase ID properties can be modified.
The Created Phase ID property has the following characteristics:
The Demolished Phase ID property has the following characteristics:
Figure 65: Phase-created component parameter value
The following code sample displays all supported phases in the current document. The phase names are displayed in a message box.
Code Region 15-6: Displaying all supported phases |
void Getinfo_Phase(Document doc) { // Get the phase array which contains all the phases. PhaseArray phases = doc.Phases; // Format the 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); } |