使用 C# 创建 Autocad 文件
我目前正在探索 AutoCAD .NET API 以从 winform 创建 dwg 文件。 这是可能的还是我应该寻找另一个图书馆? 有这样做的新教程吗? 感谢
感谢您的所有回答...我将坚持使用旧的 DXF 实现,因为这是个人项目。
I am expoloring currently an AutoCAD .NET API to create a dwg files from winform.
Is this possible or should I look for another library?
Are there any new tutorials of doing so?
thanks
Thanks for all your answers .... I will stick with my old DXF implementation, since this is personal project.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我认为如果您想要 DWG,您唯一的选择是使用 OpenDesign。如果您不想支付这些费用,您可以编写 DXF。我使用过VectorDraw,它确实给出了合理的对象模型,并且可以导出DXF而不需要任何额外的组件(我认为),或者使用OpenDesign编写DWG。
I think your only choice if you want DWG is to use OpenDesign. If you don't want to pay what that costs, you can write DXF instead. I have used VectorDraw, which does give a reasonable object model, and can export DXF without any extra component (I think), or use OpenDesign to write DWG.
这里告诉您具体的操作方法。 AutoCad 包含一个用于执行此操作的 API。问题是您的应用程序所在的计算机需要安装 AutoCad。
Here you have exacly how to do it. AutoCad includes an API for doing that. The problem is that you need to have AutoCad in the computer where your application remains.
Autodesk 销售一个名为 RealDWG 的库,它允许您在不安装 AutoCAD 的情况下使用 C# 读取和写入 dwg 文件。 ~ 2500 欧元/年。
http://usa.autodesk.com/adsk/servlet/index ?siteID=123112&id=770257
您还可以使用DXF,它更易于读写(文本文件)。可以在此处找到参考:http:// usa.autodesk.com/adsk/servlet/item?siteID=123112&id=12272454&linkID=10809853
Autodesk sell a library called RealDWG which allow you to read and write dwg file with C# without AutoCAD installed. ~ 2500 € / year.
http://usa.autodesk.com/adsk/servlet/index?siteID=123112&id=770257
You can also use DXF, which is easier to read and write (text file). The reference can be found here : http://usa.autodesk.com/adsk/servlet/item?siteID=123112&id=12272454&linkID=10809853
正如其他人提到的,OpenDesign 是一种可能性。然而,对于小公司来说,它的成本却高得令人望而却步。我们已经开始使用 CadLib,它便宜得多,而且到目前为止似乎可以解决问题。它写入 DXF 或 DWG,并具有相当好的文档。
As mentioned by others, OpenDesign is one possibility. It is, however, prohibitively expensive for small companies; we have started using CadLib, which is far cheaper and seems to do the trick so far. It writes to DXF or DWG, and has fairly good documentation.
如果您计划在不运行 autocad 的情况下创建文件,则不能使用 .net API。使用 .net API 基本上需要运行 AutoCAD(或 CoreConsole)才能工作。 (您可以打开其他数据库,但您需要在 Autocad 的进程中执行此操作。
如果您不希望它在进程中运行,您可以使用 Interop API。
或者另一种选择是写入 DXF 格式,该格式可以然后导入到能够读取该格式的 AutoCAD(或任何其他 CAD 程序)中。
If you're planning to create the file without having autocad running, then you CANNOT use the .net API. The use of the .net API basically requires AutoCAD (or the CoreConsole) to be running for it to work. (You can open other databases but you'd be doing it in process from Autocad.
If you don't want it running in process you can use the Interop API.
Or the other alternative is to is to write to a DXF format which can then be imported into AutoCAD (or any other CAD program) which is capable of reading the format.