Results 1 to 9 of 9

Thread: Suppressing print warning dialogs

  1. #1
    Member
    Join Date
    2010-06
    Location
    Brisbane, Australia
    Posts
    25
    Login to Give a bone
    0

    Default Suppressing print warning dialogs

    Hi all,

    When I export to DWF using the API I get the following warnings (screenshots attached):

    Adobe PDF cannot be used with A1 to A2 print
    settings. The <in-session> print settings will be
    used.

    (see Print Settings Warning.png)

    and:

    Revit will use raster printing because this view
    uses shading, shadows, or gradients.

    (see Force Raster Printing.png)

    The first warning occurs when I access the PrintSetup (Document.PrintManager.PrintSetup). Even if I do:

    Document.PrintManager.PrintSetup.CurrentPrintSetting = Document.PrintManager.PrintSetup.InSession;

    I understand the reason for the warning, but since I'm creating my own PrintSetting for the export the warning is irrelevant and annoying, and prevents the process from being fully automated.

    The second warning about Revit forcing raster printing only seems to be an issue when exporting via the API. I've modified my Revit.ini with the following setting so that the dialog should be suppressed:

    [Messages]
    SuppressForceRasterPrintingWarning=1

    This works when I export through Revit's GUI, but as soon as I call Document.Export() Revit changes this setting back to 0 and the warning is displayed if the sheet uses any of the above mentioned elements. My first thought here was something to do with UAC / VirtualStore, but I've verified that that is not the case. This really seems like a bug in the API, but I'm wondering if anyone knows of a way to work around this?

    Does anyone have any advice on how to deal with either of these two warnings?

    Thanks.
    Attached Images Attached Images

  2. #2
    Active Member
    Join Date
    2008-02
    Posts
    58
    Login to Give a bone
    0

    Default Re: Suppressing print warning dialogs

    You may be able to use the DialogBoxShowing event as discussed at the Building Coder here in order to "click" through for the user, otherwise you may be able to use a warning swallower of some kind to suppress the messages. Here is some code I use to suppress all the warnings the API throws when I do an automatic wall replacement, which I've modified from code supplied once again by the Building Coder.

    Code:
    public class WarningSwallower : IFailuresPreprocessor
    {
      public FailureProcessingResult PreprocessFailures(FailuresAccessor a)
      {
          // inside event handler, get all warnings
          IList<FailureMessageAccessor> failures
            = a.GetFailureMessages();
          foreach (FailureMessageAccessor f in failures)
          {
              // check failure definition ids 
              // against ones to dismiss:
              if (f.GetSeverity().ToString() == "Warning")
              {
                  a.DeleteWarning(f);
              }
          }
          return FailureProcessingResult.Continue;
      }
    }

  3. #3
    All AUGI, all the time
    Join Date
    2006-08
    Posts
    636
    Login to Give a bone
    0

    Default Re: Suppressing print warning dialogs

    this Failure API is great, and yet i still have to figure out how to override w/ other option instead of default one (see attached jpg)
    Attached Images Attached Images

  4. #4
    Active Member
    Join Date
    2008-02
    Posts
    58
    Login to Give a bone
    0

    Default Re: Suppressing print warning dialogs

    Hrmm, have you tried an IDYES value instead of an IDOK? I'm thinking it might be a YESNOCANCEL dialog with the buttons relabeled so "ok" means "no".

  5. #5
    Member
    Join Date
    2010-06
    Location
    Brisbane, Australia
    Posts
    25
    Login to Give a bone
    0

    Default Re: Suppressing print warning dialogs

    Thanks for the suggestion Abe. I've just tested it and unfortunately these dialogs bypass the Failures API.

    I might see if I can do something with UI Automation...

  6. #6
    Member
    Join Date
    2010-06
    Location
    Brisbane, Australia
    Posts
    25
    Login to Give a bone
    0

    Default Re: Suppressing print warning dialogs

    In case anyone is interested, I've been able to use the UIApplication.DialogBoxShowing event to dismiss these dialogs.

    The 'force raster printing' dialog has an ID I can use to identify it but it still changes the setting in Revit.ini back to 0.

    The dialog about the print settings doesn't have an ID so I have to match the text. This is easy enough with regular expressions, but might take some effort to localise - anyone know how to get the localised format strings out of Revit?

  7. #7
    Member
    Join Date
    2012-08
    Location
    Bristol UK
    Posts
    3
    Login to Give a bone
    0

    Default Re: Suppressing print warning dialogs

    did you get anywhere with this? I've been trying to deal with the same issue myself..

  8. #8
    AUGI Addict truevis's Avatar
    Join Date
    2004-07
    Location
    Massachusetts, USA
    Posts
    1,191
    Login to Give a bone
    0

    Default Re: Suppressing print warning dialogs

    Worse comes to worst, one can make an AutoHotKey app that waits for the dialog(s) and closes them. Hacky, I admit.

    Reference: http://www.autohotkey.com/board/topi...ine-2-waitwin/

  9. #9
    Login to Give a bone
    0

    Default Re: Suppressing print warning dialogs

    It's been some time so these other guys may have figured this out but I think the following works, which is based on the Building Coder's code mentioned above. Add this method:

    Code:
    private void DismissDialog(object sender, DialogBoxShowingEventArgs e)
    {
         TaskDialogShowingEventArgs te = e as TaskDialogShowingEventArgs;
         if (te != null)
         {
             if (te.Message.Contains("print settings will be used"))
             {
                 // task dialog, 1001 maps the first button in this dialog to click "Close" 
                 int iReturn = 1001;
                 e.OverrideResult(iReturn);
             }
         }
    }
    Add this event to the UIApplication before going into the print settings or accessing ViewSheetSets:
    Code:
    uiApp.DialogBoxShowing += new EventHandler<DialogBoxShowingEventArgs>(DismissDialog);

Similar Threads

  1. Suppressing Mapoptions Dialog Box
    By ziko30 in forum AutoLISP
    Replies: 3
    Last Post: 2008-12-12, 07:05 PM
  2. Suppressing Undo flags
    By ccaron in forum AutoLISP
    Replies: 0
    Last Post: 2007-08-09, 04:37 PM
  3. Suppressing layer when printing
    By rolibolibo in forum AutoCAD General
    Replies: 9
    Last Post: 2006-06-09, 08:25 PM
  4. Recurring Warning Dialogs
    By jsr13 in forum ACA General
    Replies: 6
    Last Post: 2004-09-19, 03:45 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •