改築などの建築プロジェクトはいくつかのフェーズを踏みながら進行します。フェーズには次の特性があります。
プロジェクトのすべてのフェーズはドキュメント オブジェクトから取得できます。フェーズ オブジェクトには、Name、ID、UniqueId の 3 つの有用な情報があります。残りのプロパティは、常に null または空の集合を返します。
プロジェクトに追加されているそれぞれの新しいモデリング コンポーネントには、Created Phase ID と Demolished Phase ID プロパティがあります。Element.AllowPhases()メソッドは、フェーズ ID プロパティが修正可能かどうかを示します。
Created Phase ID プロパティには次の特性があります。
Demolished Phase ID プロパティには次の特性があります。
図 65: フェーズを作成したコンポーネント パラメータの値
次のコード サンプルでは、現在のドキュメント内のサポートされるすべてのフェーズが表示されます。フェーズ名がメッセージ ボックスに表示されます。
|
コード領域 15-6: サポートされるすべてのフェーズを表示 |
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);
}
|