private void sendcmd(string sCmd) { Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; string esc = ""; string cmds = (string)AcadApp.GetSystemVariable("CMDNAMES"); if (cmds.Length > 0) { int cmdNum = cmds.Split(new char[] { ‘\‘‘ }).Length; for (int i = 0; i < cmdNum; i++) esc += ‘\x03‘; } doc.SendStringToExecute(esc + "_." + sCmd + " ", true, false, false); }