That's something I double checked. It does not appear to be in the launch of AutoCAD or the SendCommands I pass to it. It's well into the execution of the lisp that AutoCAD just stops drawing. And by "stop" I mean it makes no more lines on the model space window until I click the mouse. Then it picks up again. I've tested this setup with other LISP and it works well. This one is just kind of stumping me because I can't pin down what in the LISP code makes it stop only when .NET get's involved. But just in case, here is how AutoCAD is called from the class in C#. My first thought was there was an extra space in the SendCommands, but I've double checked that. I'm thinking there must be an extra "" somewhere in the LISP code, but it's hiding very stealth-fully if that's what it is.
class LaunchAutoCAD
{
private static IAcadApplication vAcadApp = null;
private static IAcadDocument vAcadDoc = null;
private static string vAcadID = "AutoCAD.Application.20";
public static void StartAutoCAD()
{
try
{
// Check for instance of AutoCAD
vAcadApp = (IAcadApplication)System.Runtime.InteropServices.Marshal.GetActiveObject(vAcadID);
}
catch (Exception) // None found so start a new instance of AutoCAD
{
Type AcadProg = Type.GetTypeFromProgID(vAcadID);
vAcadApp = (IAcadApplication)System.Activator.CreateInstance(AcadProg);
}
if (vAcadApp != null)
{
vAcadApp.Visible = true;
vAcadDoc = vAcadApp.Documents.Open(myDrawingTemplate.dwg", true);
vAcadDoc.SendCommand("(load \"" + LispPath + "myLisp.lsp\" \"The load failed\") ");
vAcadDoc.SendCommand(LISPVariables.PrepareAcadCmd() + " ");
vAcadDoc.SendCommand("(setq svPath \"" + (ReadDefaults.vsSaveAutoDwgPath).Replace("\\", "/") + "\") ");
vAcadDoc.SendCommand("(setq *erp 1) ");
vAcadDoc.SendCommand("startLisp ");
}
else
{
Console.WriteLine("ERROR: The drawing file is missing.");
}
}
}
}