简体   繁体   English

使用C#创建Autocad文件

[英]Create Autocad file with C#

I am expoloring currently an AutoCAD .NET API to create a dwg files from winform. 我目前正在开发一个AutoCAD .NET API来从winform创建一个dwg文件。 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. 感谢您的所有答案....我将坚持使用旧的DXF实施,因为这是个人项目。

Here you have exacly how to do it. 在这里,你有办法如何做到这一点。 AutoCad includes an API for doing that. AutoCad包含用于执行此操作的API。 The problem is that you need to have AutoCad in the computer where your application remains. 问题是您需要在应用程序所在的计算机中安装AutoCad。

I think your only choice if you want DWG is to use OpenDesign . 我认为如果你想要DWG,你唯一的选择就是使用OpenDesign If you don't want to pay what that costs, you can write DXF instead. 如果您不想支付这笔费用,可以改为编写DXF。 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. 我使用了VectorDraw ,它提供了一个合理的对象模型,并且可以在没有任何额外组件的情况下导出DXF(我认为),或者使用OpenDesign来编写DWG。

Autodesk sell a library called RealDWG which allow you to read and write dwg file with C# without AutoCAD installed. Autodesk出售了一个名为RealDWG的库,它允许您在没有安装AutoCAD的情况下使用C#读取和写入dwg文件。 ~ 2500 € / year. ~2500欧元/年。

http://usa.autodesk.com/adsk/servlet/index?siteID=123112&id=770257 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). 您还可以使用DXF,它更易于读写(文本文件)。 The reference can be found here : http://usa.autodesk.com/adsk/servlet/item?siteID=123112&id=12272454&linkID=10809853 该参考资料可在此处找到: http//usa.autodesk.com/adsk/servlet/item?siteID = 123112&id = 12272454&linkID = 10809853

As mentioned by others, OpenDesign is one possibility. 正如其他人所说, OpenDesign是一种可能性。 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. 我们已经开始使用CadLib ,这个便宜得多,而且到目前为止似乎已经成功了。 It writes to DXF or DWG, and has fairly good documentation. 它写入DXF或DWG,并具有相当好的文档。

If you're planning to create the file without having autocad running, then you CANNOT use the .net API. 如果您计划在没有运行autocad的情况下创建文件,则不能使用.net API。 The use of the .net API basically requires AutoCAD (or the CoreConsole) to be running for it to work. 使用.net API基本上需要运行AutoCAD(或CoreConsole)才能使其工作。 (You can open other databases but you'd be doing it in process from Autocad. (您可以打开其他数据库,但是您将在Autocad中进行此操作。

If you don't want it running in process you can use the Interop API. 如果您不希望它在运行中,您可以使用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. 或者另一种方法是写入DXF格式,然后可以将其导入到能够读取格式的AutoCAD(或任何其他CAD程序)中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM