从.Net流程启动AutoCAD 2015 [英] Launch AutoCAD 2015 from .Net process

查看:198
本文介绍了从.Net流程启动AutoCAD 2015的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图从.Net流程加载AutoCAD 2015,以便可以将命令发送到文档以创建/修改块。

I was trying to load AutoCAD 2015 from .Net process so that I can send commands to the document to create/modify blocks.

我尝试了这两种方法

第一种方法:

AcadApplication app = new AcadApplication();
app.Visible = true;

第二种方法:

var t = Type.GetTypeFromProgID("AutoCAD.Application", true);
dynamic obj = Activator.CreateInstance(t, true);

在两种情况下,我都遇到了COM异常。有帮助吗?

In both of the cases I am getting COM exception. Any help?

评论中没有提到,我已经尝试过此处

It's not a duplicate as mentioned in comments, I have tried both approaches mentioned in here.

COM异常-


使用CLSID
{0B628DE4-07AD-4284-81CA-5B439F67C5E6}检索COM类工厂失败由于以下
错误:80080005服务器执行失败(HRESULT异常:
0x80080005(CO_E_SERVER_EXEC_FAILURE))。

Retrieving the COM class factory for component with CLSID {0B628DE4-07AD-4284-81CA-5B439F67C5E6} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)).


推荐答案

最后,我能够使其运行起来。 (在这里张贴这样的内容必须像我一样浪费时间)

Finally I was able to make it run for me. (Posting here so on one had to waste time like I did)

虽然不确定确切的问题是什么。奇怪的是,以普通用户身份运行VS 2013可以正常工作,但是如果以管理员身份运行VS 2013,它总是会因上述COM异常而失败。

Not sure what was an exact issue though. Strangely, running VS 2013 as normal user worked fine but in case I run it as an administrator, it always fails with above mentioned COM exception.

这篇关于从.Net流程启动AutoCAD 2015的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆