Command Execution When No drawing is Active

Is there a CommandFlag (or another method) I can make it so I can execute a command when no drawing is open? It almost seems like I can do that cause currently one of my command gives an error:
This command is available only when a drawing is open.

Comments

  • gile
    edited April 2019

    As far as I know, you cannot execute a command while no drawing is open.
    You could execute a method (which is not decored with a CommandMethod attribute) from some event handler for example, but you'd provide some more details on what you're trying to do and in which context.

  • The CommandFlags.Session flag allows a command to run in application context ("session" context) with no document open.

  • @Chili said:
    'cause currently one of my command gives an error:
    This command is available only when a drawing is open.

    That message response was associated with a ( Command "CLOSE") in AutoLisp when no drawing was open.

    More details required perhaps.
    Which command ; Yours or BricsCAD?
    If yours, how was it composed ?

  • @Owen Wengerd said:
    The CommandFlags.Session flag allows a command to run in application context ("session" context) with no document open.

    My mistake, I'm new to BricsCAD and didn't notice the command line was still active in no document state.
    With AutoCAD, it seems to me that defining a CommandMethod to be called in no document state is a non-sense because the user wont be able to call it.

  • Chili
    edited April 2019

    Session flag doesn't seem to do what you would think it would do. By the description YES it would do that. But in practice it does not and returns an error. Also, only reason I'm trying to add the command is so I can add a specific command to the File Menu.

  • @Chili apparently there is a bug in the managed command handling architecture when executing a managed command in no-document state. I recommend to submit a support request so this can be fixed. The flag does work for native BRX commands, at least.