3

I am hope to write a C# application take takes some numbers as input and export in a format that can ultimately be editable as dwg files.

I read that exporting directly to dwg is difficult, but I can accept if I can export to imtermediate format which autocad can open and subsequently convert natively and edit as autocad dwg.

side note: I am generating the "drawing" as vectors and points with OpenTK on winforms.

Any solutions?

Jake
  • 11,273
  • 21
  • 90
  • 147
  • Would an EPS file do? If so check this post http://stackoverflow.com/questions/243068/how-can-i-create-eps-files-in-c – Ben Robinson Nov 29 '11 at 10:22

4 Answers4

3

My suggestion is to write to DXF format, witch is an ASCII text file. AutoCAD, as well as other CAD software read it natively.

DWG is a proprietary binary format, used by AutoCAD only (well, not exactly, there are other software that can write DWG format that is compatible to AutoCAD dwg).

EPS is not supported in AutoCAD, and even if there were a way to import it, you would miss many DWG features (line types, layers, blocks, etc.)

The DXF reference is available on:

http://usa.autodesk.com/adsk/servlet/item?siteID=123112&id=12272454&linkID=10809853

blablatros
  • 733
  • 1
  • 7
  • 21
2

There is a C# library that might be of use called Cadlib:

http://www.woutware.com/cadlib.html

I'm not affiliated, spotted a similar question on MSDN and this was the response. I'm also not sure if it supports editing.

Adam Houldsworth
  • 63,413
  • 11
  • 150
  • 187
1

You can use DXFLib to manipulate dxf files (old AutoCAD file format, still supported). You can then open the files in AutoCAD and save it in dwg format.

Luchian Grigore
  • 253,575
  • 64
  • 457
  • 625
0

If another format can be written to, such as SVG or EPS, you can use this API to convert it to a DXF file:

https://vector.express

Requires an internet connection, though.