c# - AutoCAD 命令被拒绝 : "Undo" when calling undo from LISP

标签 c# .net lisp autolisp

在过去的 3 周里,我一直在尝试能够以编程方式调用撤消命令。我最近的尝试涉及从 C# 调用 LISP 代码。现在我的 C# 方法看起来像这样

[CommandMethod("TestLispFromC#", CommandFlags.Modal)]
    public void TestLisp()
    {
        ResultBuffer lispFunctionCallWithArguments = new ResultBuffer(new TypedValue((int)LispDataType.Text, "BIGUNDO")); // build the arguments list
        ResultBuffer resultOfLispFunction = Autodesk.AutoCAD.ApplicationServices.Application.Invoke(lispFunctionCallWithArguments); // call the LISP fuction anf get the return value
        _editor.WriteMessage(resultOfLispFunction.ToString()); //print the result
    }

我想调用的 Lisp 函数来自这里

(defun 比贡多 () (命令“撤消”“b”) )

(defun MARKPOS () (命令“撤消”“m”) )

(vl-acad-defun 'BIGUNDO)

(vl-acad-defun 'MARKPOS)

该命令已发送到 AutoCAD,但我收到一条错误消息“AutoCAD 命令被拒绝:“撤消””。我不知道如何让 AutoCAD 接受编程撤消命令。

最佳答案

你需要定义 c:

请尝试以下操作:

(defun c:BIGUNDO()(命令“撤消”“b”“Y”))

请注意末尾的“Y”,因为它询问这将撤消所有操作。好的?

关于c# - AutoCAD 命令被拒绝 : "Undo" when calling undo from LISP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29833564/

相关文章:

.net - 如何验证 Entity Framework Code First 对现有数据库的映射?

haskell - 惰性求值与宏

c# - 有人可以帮我将这个用 C# 编写的正则表达式转换为 JavaScript 吗?

c# - 在没有 Razor View 引擎的情况下在南锡进行本地化

.net - 通过 RS232 连接打开套接字

c# - 如何访问 ThisAddIn 类之外的 VSTO Outlook 加载项中的应用程序属性?

list - 在 LISP 中创建作为参数传递给函数的列表列表

lisp - 在闭合多段线上绘制多边形

c# - 如何使用 Experitest 检查 Android( native )应用程序的密码字段的屏蔽? -

c# - WebApi—— Controller 继承——方法的新版本