/// <summary> /// Returns the first selected drawing view, or lets the user select one in the active document. /// </summary> /// <param name="promptText">The text to display as prompt.</param> /// <returns>The selected drawing view, or <c>null</c> if the user didn't select one.</returns> /// <exception cref="InvalidOperationException">The active document isn't a drawing document.</exception> public static DrawingView GetDrawingView(string promptText) { if (ActiveDocument.DocumentType != DocumentTypeEnum.kDrawingDocumentObject) { throw new InvalidOperationException("The currently active document isn't a drawing document."); } return(SelectedDrawingViews.FirstOrDefault() ?? SelectDrawingView(promptText)); }
/// <summary> /// Returns the currently selected drawing views, or lets the user select one in the active document. /// </summary> /// <param name="promptText">The text to display as prompt.</param> /// <returns>The selected drawing view(s), or an empty list if the user didn't select one.</returns> /// <exception cref="InvalidOperationException">The active document isn't a drawing document.</exception> public static List <DrawingView> GetDrawingViews(string promptText) { if (ActiveDocument.DocumentType != DocumentTypeEnum.kDrawingDocumentObject) { throw new InvalidOperationException("The currently active document isn't a drawing document."); } var selectedDrawingViews = SelectedDrawingViews.ToList(); if (selectedDrawingViews.Count == 0) { var selectedDrawingView = SelectDrawingView(promptText); if (selectedDrawingView != null) { selectedDrawingViews.Add(selectedDrawingView); } } return(selectedDrawingViews); }