从Windows窗体应用程序打开任何版本的Autocad [英] Opening any version of Autocad from windows form application

查看:134
本文介绍了从Windows窗体应用程序打开任何版本的Autocad的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我当前正在创建一个需要打开autocad的Wi​​ndows窗体应用程序.我已经为Autocad 2014完成了此工作,有什么方法可以使此任务不仅适用于单个版本,而且适用于任何版本.已经创建了dll 对于2014年来说效果很好.通过更改引用acmgd.dll和acdbmgd.dll,我也可以在2007年使用它.除此以外,还有什么办法可以创建所有版本的dll.感谢您.

I am currently creating a windows form application that needs to open autocad .I have done it for Autocad 2014.Is there any way we can do this task workable not just for single version but for any version.In addition to this I have created dll for 2014 which worked fine.By altering the references acmgd.dll and acdbmgd.dll i got it worked on 2007 too.Is there any way except this to create a dll orking in all version.Thanks in advance.

推荐答案

第一个问题,以下是一些建议:

For your first question, here are some suggestions:

  1. 通过COM API的AutoCAD,您可以在其中启动和控制应用程序. 这是一个不错的教程,请注意,可以在运行时更改版本字符串,但要支持多个版本,您需要后期绑定(在C#上是动态的).
  2. AutoCAD控制台(又名通过命令行的AutoCAD)是从另一个应用程序自动执行AutoCAD的最佳方法.
  3. Forge设计自动化API 是AutoCAD的云端"最好,如果您没有在自己的计算机上或客户的计算机上安装AutoCAD.
  1. AutoCAD via COM API, where you can launch and control the application. Here is a nice tutorial, note the version string can be changed on runtime, but to support multiple versions, you'll need Late-binding (dynamic on C#).
  2. AutoCAD Console (aka AutoCAD via command line), available since version 2013, is the best way to automate AutoCAD from another application.
  3. Forge Design Automation API is the AutoCAD "on the cloud", best if you don't have AutoCAD installed on yours or on the customer's machine.

如果使用#1,最好的方法是通过后期绑定,因此您的应用程序上没有任何引用(不要使用AcMgd,AcDbMgd或AcCoreMgd,请仅使用Autodesk.AutoCAD.Interop库).对于#2,您将需要所有三个引用(因为该控制台自2013版以来可用).对于#3,您只需要调用Web服务,就根本没有Autodesk参考(最干净).

If you go with #1, the best way is via late-binding, so you don't have any reference on your app (don't use AcMgd, AcDbMgd or AcCoreMgd, use only the Autodesk.AutoCAD.Interop libraries). For #2 you'll need all three references (as the console is available since version 2013). For #3 you just need to call a webservice, so no Autodesk reference at all (cleanest).

对于第二个问题,您至少需要编译两次应用程序:对于AutoCAD 2012及更早版本,以及AutoCAD 2013及更高版本.第一个使用AcMgd和AcDbMgd,第二个仅添加AcCoreMgd.

For your second question, you'll need to compile your application twice, at least: for AutoCAD 2012 and older, and again for AutoCAD 2013 and newer. The first with AcMgd and AcDbMgd, and the second just add AcCoreMgd.

这篇关于从Windows窗体应用程序打开任何版本的Autocad的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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