i have a lsp app that select lines and get there proerties and save them to file
i want to run this app from c# code
but when i run it from c# code the c# countine working and when it read the txt file it found it empty
after while the file will have the lines properties from lisp file
Should others reading your post guess what your code does?
Post your code.
You have to define a C:XXXX command function in your LISP file that runs the operation, and then call it from the Application.Invoke() method. You also have to call (vl-acad-defun) to register your command function so that it can be called by Invoke().
Document doc = Application.DocumentManager.MdiActiveDocument;
Editor ed = doc.Editor;
try
{
doc.SendStringToExecute("(load \"test.lsp\") ", true, false, false);
doc.SendStringToExecute("test_to_start" + "\n", true, false, false);
doc.LispEnded += new EventHandler(OnLispEnded);
MessageBox.Show("it continue" );
}
catch (Autodesk.AutoCAD.Runtime.Exception ex)
{
MessageBox.Show(ex.ToString() );
}
i tried doc.LispEnded += new EventHandler(OnLispEnded);
but i did not help
(setq JS (SSGET (LIST '(0 . "LINE,ARC,POLYLINE"))))
so it give the Message ("it continue" ) before ssget
That code will not work (post code using the insert code button on the toolbar).
SendStringToExecute() does not execute the string until after the managed code that calls it returns. You can't wait for it. You can use Application.Invoke() to call the LISP if you define it as a C:XXXX command function and use (vl-acad-defun) to register it.
Can't find what you're looking for? Ask the community or share your knowledge.