0

Actually, the error doesn't raise if I just run (Command ^C^C) from a lisp script. The case is, my app is a .NET app, and I call some SendStringToExecute to use some lisp code. To be sure to end the lisp routine, I put at the end:

doc.SendStringToExecute("(Command ^C^C)", True, False, True)

The result of Forge Design Automation is: failedinstruction

Though I can easily find another way to get around this, it cost me more than a day to figure out that it was the (Command ^C^C) cause the failedinstruction, while everything else was working fine. Hope this bug will be fixed as well as anything similar won't raise up again somewhere else.

I isolate the case like this:

  1. Make a .NET bundle, or just reuse any of your existing one in debug mode
  2. Add the following lisp define function (or it can be a custom command, whatever):
<LispFunction("l+SendStringToExecute")>
        Public Shared Function lsp_SendStringToExcute(args As ResultBuffer) As Object
            Dim script$ = Nothing
                For Each arg As TypedValue In args.AsArray
                    script = arg.Value
                    Exit For
                Next
                script = script.Trim()

                If script <> "" Then 
                   Document doc = 
                    AcadApplication.DocumentManager.MdiActiveDocument
                    doc.SendStringToExecute(script + vbCr, True, False, True)
                End If
                Return New TypedValue(LispDataType.T_atom)
        End Function
  1. Upload the bundle to Forge, create a dump activity and just run the custom lisp solely:
(l+SendStringToExecute "(Command ^C^C)")
  1. The result log is here like this:
...
[02/01/2021 17:23:26] Command: (l+SendStringToExecute "(Command ^C^C)")
[02/01/2021 17:23:26] T
[02/01/2021 17:23:26] Command: (Command ^C^C)
[02/01/2021 17:23:26] *Cancel*
[02/01/2021 17:23:26] Command: nil
[02/01/2021 17:23:27] End AutoCAD Core Engine standard output dump.
[02/01/2021 17:23:27] Error: AutoCAD Core Console failed to finish the script - an unexpected input is encountered.
[02/01/2021 17:23:27] End script phase.
[02/01/2021 17:23:27] Error: An unexpected error happened during phase CoreEngineExecution of job.
[02/01/2021 17:23:27] Job finished with result FailedExecution
[02/01/2021 17:23:27] Job Status:
{
  "status": "failedInstructions", ...
  • What are you trying to accomplish by doc.SendStringToExecute("(Command ^C^C)", True, False, True)? Are you trying to exit your script? – Albert Szilvasy Feb 05 '21 at 18:17
  • Thanks. There are many way to work around it. But the issue is it is a hidden error, I never doubt that send command can be the cause. Just want someone tell Autodesk team that it is there, and check if it can be somewhere else. If I run my app, and the above test, in local accoreconsole, no error. It happens only over Forge. – Pham Vu Hong Linh Feb 06 '21 at 13:32
  • @PhamVuHongLinh - can you provide a exact steps to reproduce the behavior? – Madhukar Moogala Feb 08 '21 at 03:18
  • I've edited my post to show the steps better. I use a custom define lisp so that I can test the SendStringToExecute method with other lisp thing to see if any other err. The main thing is, if use pure lisp, it is ok. But use .NET SendStringToExecute to send that ^C^C, looking like some kind of Esc Key sent and cancel the Forge ending process – Pham Vu Hong Linh Feb 09 '21 at 06:07

1 Answers1

0

Thanks for reporting, I'm not sure if we allow command expression in accoreconsole. The suggestion is to use following way.

[CommandMethod("CANCELOUTSTANDING")]
public void TESTCANCEL()
{
var doc = Application.DocumentManager.MdiActiveDocument;
string cmd = string.Format("{0}", new string((char)03, 2));
doc.SendStringToExecute(cmd, true, false, true);
}
Madhukar Moogala
  • 635
  • 1
  • 5
  • 11