2

I am interested in developing an AutoCAD plugin and am trying to understand the relationships between several different types of AutoCAD plugin files:

  • Managed DLLs that ship with AutoCAD plugins
  • ARX files that ship with AutoCAD plugins
  • CUIX files that ship with AutoCAD plugins

From what I can tell these three files are all inter-related and work together to initialize and load a plugin, I'm just not seeing the forest through the trees as to what information each file type contains, which files loads or depends on the others, etc.

It sounds like a plugin's core functionality is supposed to go inside the ARX file, and written in C++ and compiled for the native/target platform.

It also sounds like, at startup, AutoCAD loads its plugin DLLs, which are all managed .NET libraries (typically written in C#), and in turn they invoke their native/compiled respective ARX files. As to where the CUIX file comes into play, I still have no idea.

Can anyone help explain the relatioships & dependencies of these files, and what types of code/logic/data goes inside of them? Thanks in advance!

4

1 回答 1

4

AutoCAD 核心库都是用非托管代码编写的(我相信是 C++)。最终,无论您选择何种 API 来开发您的插件,您都将通过其中一个 API 来操作这些核心库中的非托管 AutoCAD 对象。除了您提到的三种类型的文件之外,还有许多其他方法可以为 AutoCAD 创建插件。一些示例包括:Lisp 脚本、VBA 脚本、COM 客户端(VB、Java、Delphi)。其中大多数现在已经过时了,而现在 .Net 和 C++(ObjectARX) API 是最流行的。但是,由于遗留原因,其余的仍在使用中。如果您要开始一个新模块,您将使用 .Net 或 ARX。

.NET API是一组包装 ObjectARX API 的 .NET 包装库。您将引用的最常见的 dll 是accoremgd.dll,acdbmgd.dllacmgd.dll,但还有其他的。这些库允许您通过 .NET 语言操作本机 AutoCad 对象。如果你想用 C# 为 AutoCad 创建插件,那么你只需要用 C# 编写代码。这对开发速度很有帮助,但你的代码性能会比 ARX 插件差一些。话虽如此,我真的想强调它仍然非常快。由于性能问题,我还没有发现需要为 AutoCAD 编写 C++ 代码。总的来说,它非常强大且功能丰富。您可以仅使用 C# 对绘图做任何事情。

看看我最近给出的这个答案。它应该回答您在 .Net 中开始使用 AutoCAD 插件开发的大部分问题(如果不是全部的话)。

ObjectARX API与我为 .NET API 描述的非常相似,不同之处在于您使用 C++ 编写代码。一些库包括rxapi.libaccore.libacgiapi.lib以及acdrawbridge.lib其他一些库。使用 C++ 进行开发比使用 C# 时要麻烦得多,但 C++ 代码运行速度更快,尽管差距不大。

CUIX文件存在于完全不同的星系中。它们用于自定义 UI 以及其他相关内容。您可以在此处浏览 cuix 文件的各种用途

您的选择将真正归结为您正在做的事情。如果您正在编写尽可能快地批处理数十万张图纸的代码,您将需要探索 C++ API。如果您只处理数百张图纸或只是为用户创建一堆命令,我强烈建议您使用 C# API。用户几乎察觉不到的性能上的小幅打击是值得的。

有关更多信息,请转到此 AutoDesk 链接,然后向下滚动到培训实验室。我建议您至少通读 ObjectARX 和 .NET 培训实验室。一旦你选择了你想要使用的东西,就可以通过所有的实验室来选择你想要的。稍后您会感谢自己,因为您将节省无数小时的头痛和沮丧!

祝你好运!

于 2017-12-09T00:04:07.657 回答