4

Does anyone have any tips how I can generate AutoCAD drawings with Java? Is dfx a good interface or should we go for dwg files?

I can't find any useful information on this on the net. The Open Design Alliance have libraries for generating dwg, but I can't look at the API without becoming a member. And they don't seem to have a java interface either.

Henrik
  • 3,757
  • 1
  • 19
  • 18

1 Answers1

7

If you don't have to generate dwg, and you can represent what you want in dxf then I suggest going with dxf. It is fairly easy to write dxf manually from java without the need for an expensive library.

Unlike dwg which is the native application format of AutoCad, DXF is an interchange format, and as such Autodesk encourages you to use it. They publish the specifications here.

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

Anders Forsgren
  • 10,827
  • 4
  • 40
  • 77
  • 2
    +1 DXF is much more accessible and supports most of the AutoCAD objects you're likely to use. – CAD bloke Oct 04 '11 at 23:58
  • @CADbloke & Accepted answer: How did you wrote the DXF file? I couldn't find a proper way on doing so without paying loads of money... Thanks! – FranciscoBouza Nov 24 '15 at 16:51
  • I've never written a DXF. IMHO you're much better off paying the ransom and doing it properly than inventing your own AutoCAD, that's a false economy. – CAD bloke Nov 24 '15 at 20:23
  • A dxf is just a text format. If you can write a text file in java, and read the spec (see link), then you can create at least basic dxf:s too. Here is a simple example of how basic files look (for 3D). http://paulbourke.net/dataformats/dxf/min3d.html – Anders Forsgren Nov 25 '15 at 14:11