在过去的 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/