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

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

问题描述

我目前正在创建一个需要打开 autocad 的 windows 窗体应用程序.我已经为 Autocad 2014 完成了它.有什么方法可以让我们不仅对单一版本而且对任何版本都可行.除此之外,我已经创建了dll2014 年工作正常.通过更改引用 acmgd.dll 和 acdbmgd.dll,我也让它在 2007 年工作.除了这个,还有什么方法可以在所有版本中创建一个 dll orking.提前致谢.

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. AutoCAD 通过 COM API,您可以在其中启动和控制应用程序.这是一个不错的教程,请注意版本字符串可以在运行时更改,但要支持多个版本,您需要后期绑定 (C# 上的动态).
  2. AutoCAD 控制台(又名 AutoCAD 通过命令行),自 2013 版起可用,是从其他应用程序自动化 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,你只需要调用一个网络服务,所以根本没有 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天全站免登陆