Revit中經常出現隔離和隱藏對象,通過API如何實現這些功能呢?主要用到View中的幾個關鍵函數
一、隔離元素
1、一個隔離多個類別
public void IsolateCategoriesTemporary(ICollection<ElementId> elementIds)
2、一次隔離一個類別
public void IsolateCategoryTemporary(ElementId elementId)
3、一次隔離多個元素
public void IsolateElementsTemporary(ICollection<ElementId> elementIds)
4、一次隔離一個元素
public void IsolateElementTemporary(ElementId elementId)
二、隱藏元素
1、隱藏多個類別
public void HideCategoriesTemporary(ICollection<ElementId> elementIds)
2、隱藏一個類別
public void HideCategoryTemporary(ElementId elementId)
3、隱藏多個元素
public void HideElementsTemporary(ICollection<ElementId> elementIdSet)
4、隱藏一個元素
public void HideElementTemporary(ElementId elementId)
三、判斷是否存在隱藏和隔離
通過調用以下函數,判斷當前視圖中,是否有隱藏和隔離對象,假如為true,則說明存在隔離和隱藏對象,假如為false則不存在
public bool IsTemporaryHideIsolateActive()
四、取消隱藏和隔離
調用以下函數,實現對隔離和隱藏對象的處理
public void DisableTemporaryViewMode(TemporaryViewMode mode)
TemporaryViewMode是一個枚舉,其枚舉的參數如下:
成員 | 表述 |
---|---|
RevealHiddenElements | The view is in reveal hidden elements mode |
TemporaryHideIsolate | 視圖是臨時隱藏和隔離模式 |
WorksharingDisplay | The view is in one of the worksharing display modes |
TemporaryViewProperties | The view is in the selected View Properties applied temporarily. |
Raytrace | The view is in the mode that shows the model in interactive raytracing |
ExplodedView | The view is in the mode that shows the model in exploded view and allows user changes/configurations |
RevealConstraints | The view is in the mode that reveals constraints between elements in the model. |
PreviewFamilyVisibility | The view is in the mode that shows visibility settings applied in the environment of a family document. |