diff --git a/src/IFoxCAD.Cad/Runtime/CommandTool.cs b/src/IFoxCAD.Cad/Runtime/CommandTool.cs
new file mode 100644
index 0000000000000000000000000000000000000000..bb157c30b3e0a1154415808322dd1cf1095867fc
--- /dev/null
+++ b/src/IFoxCAD.Cad/Runtime/CommandTool.cs
@@ -0,0 +1,31 @@
+public static class CommandTool
+{
+ ///
+ /// 发送cmd指令
+ ///
+ /// 命令内容
+ /// 指示发送的字符串是否在命令行上回显
+ internal static void SendCommand(string CommandParameter, bool echoCommand = false)
+ {
+ Document mdiActiveDocument = Application.DocumentManager.MdiActiveDocument;
+ SetFocus(mdiActiveDocument.Window.Handle);
+ if (mdiActiveDocument == null)
+ return;
+ if (CommandParameter.StartsWith("'"))
+ {
+ mdiActiveDocument.SendStringToExecute(CommandParameter + "\n", true, false, echoCommand);
+ }
+ else
+ {
+ string Left = Application.GetSystemVariable("cmdnames").ToString();
+ if (Left == "")
+ mdiActiveDocument.SendStringToExecute("_" + CommandParameter + "\n", true, false, echoCommand);
+ else if (Left.Length >= 4 && Left.Substring(0, 4).ToUpper() == "GRIP")
+ mdiActiveDocument.SendStringToExecute("_" + CommandParameter + "\n", true, false, echoCommand);
+ else
+ mdiActiveDocument.SendStringToExecute("\u0003\u0003_" + CommandParameter + "\n", true, false, echoCommand);
+ }
+ }
+ [System.Runtime.InteropServices.DllImport("user32.dll")]
+ private static extern IntPtr SetFocus(IntPtr hwnd);
+}
\ No newline at end of file