Revit二次開發--設定檢視工作集可見性
阿新 • • 發佈:2018-12-04
由於要遍歷設定工作集然後做響應的處理,下面是主要的程式碼:
UIApplication application = commandData.Application; UIDocument uiDoc = application.ActiveUIDocument; Document doc = uiDoc.Document; FilteredWorksetCollector worksetCollector = new FilteredWorksetCollector(doc);//過濾工作集 worksetCollector.OfKind(WorksetKind.UserWorkset); IList<Workset> worksetList = worksetCollector.ToWorksets(); View view = doc.ActiveView;//取得當前檢視 view.SetWorksetVisibility(worksetList[i].Id, WorksetVisibility.UseGlobalSetting);//設定為全域性可見 view.SetWorksetVisibility(worksetList[i].Id, WorksetVisibility.Hidden);//隱藏