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
-
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.0 -
The CommandFlags.Session flag allows a command to run in application context ("session" context) with no document open.
0 -
@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 ?0 -
@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.0 -
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.
0 -
@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.
0