/// <summary> /// Transfer information back to SelectViewsData class /// </summary> /// <returns></returns> private void GetSelectedViews() { m_selectViewsData.Contain3DView = false; foreach (int index in checkedListBoxViews.CheckedIndices) { String text = checkedListBoxViews.Items[index].ToString(); String sheetPrefix = "Drawing Sheet: "; if (text.StartsWith(sheetPrefix)) { text = text.Substring(sheetPrefix.Length); String sheetNumber; String sheetViewName; sheetNumber = text.Substring(0, text.IndexOf(" - ")); sheetViewName = text.Substring(text.IndexOf(" - ") + 3); foreach (Autodesk.Revit.DB.ViewSheet viewSheet in m_selectViewsData.PrintableSheets) { if (viewSheet.SheetNumber == sheetNumber && viewSheet.ViewName == sheetViewName) { m_selectViewsData.SelectedViews.Insert(viewSheet); break; } } } else { String viewType = text.Substring(0, text.IndexOf(": ")); String viewName = text.Substring(text.IndexOf(": ") + 2); foreach (Autodesk.Revit.DB.View view in m_selectViewsData.PrintableViews) { Autodesk.Revit.DB.ViewType vt = view.ViewType; if (viewType == vt.ToString() && viewName == view.ViewName) { m_selectViewsData.SelectedViews.Insert(view); if (vt == Autodesk.Revit.DB.ViewType.ThreeD) { m_selectViewsData.Contain3DView = true; } break; } } } } }
/// <summary> /// Checks if View Type is valid for checking if Element is visible in it. /// </summary> /// <param name="vt">View Type</param> /// <returns>True if view can have Elements.</returns> private static bool CheckType(Autodesk.Revit.DB.ViewType vt) { switch (vt) { case Autodesk.Revit.DB.ViewType.FloorPlan: case Autodesk.Revit.DB.ViewType.EngineeringPlan: case Autodesk.Revit.DB.ViewType.AreaPlan: case Autodesk.Revit.DB.ViewType.CeilingPlan: case Autodesk.Revit.DB.ViewType.Elevation: case Autodesk.Revit.DB.ViewType.Section: case Autodesk.Revit.DB.ViewType.Detail: case Autodesk.Revit.DB.ViewType.ThreeD: case Autodesk.Revit.DB.ViewType.DraftingView: return(true); case Autodesk.Revit.DB.ViewType.DrawingSheet: case Autodesk.Revit.DB.ViewType.Undefined: case Autodesk.Revit.DB.ViewType.Schedule: case Autodesk.Revit.DB.ViewType.Legend: case Autodesk.Revit.DB.ViewType.Report: case Autodesk.Revit.DB.ViewType.ProjectBrowser: case Autodesk.Revit.DB.ViewType.SystemBrowser: case Autodesk.Revit.DB.ViewType.CostReport: case Autodesk.Revit.DB.ViewType.LoadsReport: case Autodesk.Revit.DB.ViewType.PresureLossReport: case Autodesk.Revit.DB.ViewType.PanelSchedule: case Autodesk.Revit.DB.ViewType.ColumnSchedule: case Autodesk.Revit.DB.ViewType.Walkthrough: case Autodesk.Revit.DB.ViewType.Rendering: #if !Revit2018 case Autodesk.Revit.DB.ViewType.SystemsAnalysisReport: #endif case Autodesk.Revit.DB.ViewType.Internal: return(false); default: throw new ArgumentOutOfRangeException(); } }