method DocumentLockModeChangedEventArgs.Veto() is missing

#1
Hi,

I would need to stop a particular command execution.

In AutoCAD by handling the event Application.DocumentManager.DocumentLockModeChanged and calling the event parameter DocumentLockModeChangedEventArgs.Veto() the command can be cancelled. (See for example https://www.keanw.com/2006/10/blocking_autoca.html)
However in the IntelliCAD implementation the Veto method is missing.
Would you able to recommend how to achieve the same in IntelliCAD?

Here is a code example. Args.Veto() can not be resolved

Code: Select all

private static void DocumentLockModeChanged(object sender, DocumentLockModeChangedEventArgs args)
		{
			_runCustomCommand = false;
			Editor editor = Application.DocumentManager.MdiActiveDocument.Editor;

			if (args.GlobalCommandName.Length > 0)
			{
				if (_selectedEntId != ObjectId.Null &&
					!string.IsNullOrEmpty(_customCmd) &&
					args.GlobalCommandName.ToUpper() != _customCmd.ToUpper())
				{
					editor.WriteMessage(
						"\nCommand {0} is vetoed!", args.GlobalCommandName);
					
					args.Veto(); <= can not resolve Veto
					_runCustomCommand = true;
				}
			}
		}

Kind regards
Geza

Re: method DocumentLockModeChangedEventArgs.Veto() is missing

#2
Hi,

Yes, it seems that the method DocumentLockModeChangedEventArgs.Veto() missing.
I saw the DocumentBeginCloseEventArgs having one.

Please try using the Document.CommandWillStart method to catch which command is active then do something as you want.

Document dwg = CadApp.DocumentManager.MdiActiveDocument;
dwg.CommandWillStart += new CommandEventHandler(Document_CommandWillStart);

Code: Select all

        private static void Document_CommandWillStart(object sender, CommandEventArgs e)
        {
            if (e.GlobalCommandName == "_LINE")
            {
                CadApp.ShowAlertDialog("Command LINE is starting.");

                // do something here
            }
        }