AcEdCommand 直接发送CAD自身命令

来源:互联网 发布:靠谱的淘宝日代推荐 编辑:程序博客网 时间:2024/04/29 03:30

acedCommand全局函数。

可以用于向CAD直接发送命令。

 
直接举两个例子说明其使用方法(例子来自他人): 
1、调用Circle命令,设置中心点为(5,5) 然后暂停等待用户在屏幕上拖动半径, 用户选择一个点或者输入长度,函数继续,绘制一条从(5,5)到(5,7)的直线.
acedCommand(RTSTR, ".circle", RTSTR, "5,5", RTSTR, PAUSE, RTSTR, "line", RTSTR, "5,5", RTSTR, "7,5", RTSTR, "", 0);
 
2、调用 Rotate 命令,等待用户输入基点和旋转角度.
acedCommand(RTSTR, ".rotate", RTENAME, ss, RTSTR, "", RTSTR, PAUSE, RTSTR, PAUSE, 0);

其中 [RTSTR, ""]代表输入回车,

[RTSTR, PAUSE]代表暂停并等待用户输入。

其余RTSTR等参数含义请自行查阅帮助手册。

注:

在非模态对话框中使用该命令时将导致消息发送失败,返回值-5001。

该情况在Objectarx的文档中有记录:

Code Differences under the Application Execution Context
In the cases of modeless dialogs and external process-generated ActiveX requests, the code must lock the documents, including the current document. The use of the IAcadDocument methods StartUndoMarker() and EndUndoMarker() will apply a kWriteLock to the document.

如果在非模态对话框中需要发送信息,请使用SendMessage()或sendStringToExecute()代替acedcommand。

0 0
原创粉丝点击