在过去的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函数来自这里
( () (命令"undo“"b") )
(defun MARKPOS () (命令"undo“"m") )
(vl-acad-defun 'BIGUNDO)
(vl-acad-defun 'MARKPOS)
该命令可以到达AutoCAD,但我收到的错误提示是"AutoCAD命令被拒绝:"undo"“。我不知道如何让AutoCAD接受编程撤消命令。
发布于 2015-04-29 20:04:44
你需要用c:来定义
请尝试以下操作:
(defun :BIGUNDO()(命令"undo“"b”"Y"))
请注意结尾处的"Y“,因为它会询问这将撤消所有操作。好的?
https://stackoverflow.com/questions/29833564
复制相似问题