.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Get result/response from console executed by document.SendStringToExecute

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
nwbos
305 Views, 2 Replies

Get result/response from console executed by document.SendStringToExecute

I'm currently converting an Lisp project to C# .NET.

Not al functionalities wil be merged at once. For this reason i still use some Autolisp commands in my C# implementation.

I have the following code to execute some Autolisp command. This command returns a string printed in the Autocad console.

 

public void GetCoordinateSystem()
{
   var document = Application.DocumentManager.MdiActiveDocument;
   var lispCommand = "(some_lisp_command) ";
   document.SendStringToExecute(lispCommand, false, false, false);
}

 My question is how can i catch te string that the Autolisp command returns in the console.

Labels (3)
2 REPLIES 2
Message 2 of 3
nwbos
in reply to: nwbos

I have found some working 

 

public void GetCoordinateSystem()
{
    var document = GetActiveDocument();
    string someLispCommandResult = "(some_lisp_command) ";
    document.SendStringToExecute(someLispCommandResult, false, false, false);
    System.Collections.Generic.List<string> result = Autodesk.AutoCAD.Internal.Utils.GetLastCommandLines(3, false);
    Application.ShowAlertDialog(result[2]);
}

 

this feels a bit hacky can this be implemented in a more proper way?

Message 3 of 3
hippe013
in reply to: nwbos

Keep in mind that SendStringToExecute runs asynchronously. 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report