AutoCad Command Rejected “Undo” when using Application.Invoke()

随声附和 提交于 2019-12-02 09:23:01

I think it's because c:wd_insym2 is calling these commands. It fails because your own command is already active. You need to call this command asynchronously with SendStringToExecute or may be Editor.Command/CommandAsync. If you need to additional processing after the command has executed, add an handler to the CommandEnded event:

doc.CommandEnded += doc_CommandEnded;
doc.SendStringToExecute("(c:wd_insym2 "C:/ace_blocks/HT00_001.dwg" '(150 230) nil nil)", false, false, false);

[..]

void doc_CommandEnded(object sender, CommandEventArgs args)
{
    // Do what you need to do

    // Remove the handler
    doc.CommandEnded -= doc_CommandEnded;
}

You should also add an handler to the CommandFailed event in case of failure of the c:wd_insym2 command.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!