Author Topic: stop the lisp program in c#.net  (Read 5239 times)

0 Members and 1 Guest are viewing this topic.

leo_li

  • Guest
stop the lisp program in c#.net
« on: March 14, 2006, 09:10:13 PM »
I "SendStringToExecute" a lisp program in c#.net. Now send the second lisp program in c#.net. Before I the second lisp want to stop the first lisp program just like press Esc key. Is it possible? Thanks a lot

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: stop the lisp program in c#.net
« Reply #1 on: March 14, 2006, 09:29:05 PM »
I haven't used SendStringToExecute() mainly because of it's asynchronous nature.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

leo_li

  • Guest
Re: stop the lisp program in c#.net
« Reply #2 on: March 15, 2006, 02:17:13 AM »
 You are right. It is a really big program. But I create a Dock Palette with C#.net. I add some buttons on it. I can load different lisp program by click each button. When I click one button, the lisp program will be running in the command. If you click another button at this time, the new lisp program won't be loaded because of the first lisp program is not finished. So when I click the second buuton, I want to stop the first lisp program before I load the second lisp program. Is it poosible in C#.net?

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: stop the lisp program in c#.net
« Reply #3 on: March 15, 2006, 03:05:09 AM »
I think I understand you.

I assume the net assembly ONLY creates the Palette with the buttons, everything after that would follow the "normal" acad rules, so I cant think of a way to consistantly do what you want. Have you tried adding ^C^C to the command string in the Palette command.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

leo_li

  • Guest
Re: stop the lisp program in c#.net
« Reply #4 on: March 25, 2006, 07:06:33 AM »
^c^c doesn't work. I see some command seems useful.
AcadApp.DocumentManager.MdiActiveDocument.CommandCancelled...
AcadApp.DocumentManager.MdiActiveDocument.LispCancelled...
But I don't know how to use it. Could anyone tell me, are those command can be used in this case?

Alexander Rivilis

  • Bull Frog
  • Posts: 214
  • Programmer from Kyiv (Ukraine)
Re: stop the lisp program in c#.net
« Reply #5 on: March 25, 2006, 11:00:20 AM »
^c^c doesn't work. I see some command seems useful.
AcadApp.DocumentManager.MdiActiveDocument.CommandCancelled...
AcadApp.DocumentManager.MdiActiveDocument.LispCancelled...
But I don't know how to use it. Could anyone tell me, are those command can be used in this case?
You can not call theese functions - it is a reactors function which called by AutoCAD if command canceled or lisp-function  canceled.
IMHO, thay can not help you. :(

I've not tested but you can try call finction acedCommandCancelled():

Code: [Select]
[System.Security.SuppressUnmanagedCodeSecurity]
[DllImport("acad.exe", CallingConvention = CallingConvention.Cdecl)]
extern static public acedCommandCancelled();

Another way is using Autodesk.AutoCAD.Interop.IAcadDocument.SendCommand(System.String Command);
This call is synchronous!
You need add to your project reference to AutoCAD COM library.
« Last Edit: March 25, 2006, 01:12:32 PM by Rivilis »