Chapter 14
Import / Export

jDraft supports importing and exporting drawings created with other CAD applications in DXF format.

The very nature of DXF format makes it less than perfect for transferring data between applications. Nevetherless it is the most popular 2D CAD format and industry standard.

Without going in to the details too deeply, here are the main issues with DXF as they far as they affect jDraft, especially the importing.

DXF is text based This slows down reading and writing DXF files, althoug at +2GHz machines this is rarely a problem. What may be a problem is that, being text based, numbers are typically represented with a limited number of digits, thus reducing the accuracy. This is controlled by the exporting application and is most likely adjustable, but going from the typical 6 digit accuracy to the jDraft 16 digit accuracy could more than double the already bloated file sizes. In practice this means that DXF files have less precision than the actual CAD model/file from which it is created.

An other key obstacle is that DXF files are basically unitless, in other words some of the features are very AutoCAD specific, meaning that there cannot be one to one transfers of all aspects of a drawing unless the receiving application uses exactly the same data model and rendering method. This rarely is the case. There are numerous smaller problems, but at the end of the day it’s important to understand that DXF does not allow transfer of drawings with 100

It is also important to understand that the same issues plague export as well as import, but not symmetrically. Indeed the process of DXF import and export are notably unsymmertrical meaning that importing and exporting a drawing does not produce exactly the same DXF file nor will exporting and importing in DXF format produce exactly the same drawing.

DXF is scale/unit less There is no reliable way to find out the scale and units used in the DXF file. The DXF import function takes the scale and unit from the current coordinate system, so it is important to set it up properly before importing the file. Typically, DXF files are either mm based or inch based with 1 : 1 scale so typically it is enough to use one of the built-in default coordinate systems.

DFX has no concept of line widths Lines, arcs, circles etc. have a line style which defines the hatch pattern and and a color which in the old days was a reference to the pen plotter pen number, which in turn defined the line width, depending on which pen was loaded into the plotter.

So DXF import has little choice but to use a fixed width. By default, each line style has a width of 1/72 of an inch right after import. You can then edit them. The DXF format has no concept of fonts.

DXF has no concept of fonts Text in DXF files is in an ancient pen plotter font that has no correspondence in the modern font technology. jDraft circumvents this by scaling a 12 point Helvetica font as it best can. The result is not perfect, but it provides a visually reasonable result.

Having said the above, it is worth mentioning that jDraft does a reasonable job in importing DXF files. Exporting is slightly more limited.

14.1 DXF Import

DXF import is easy to use, just select ’Tools/Import DXF...’ and pick a file to import. One important thing to do before that is to ensure that the Scale and Paper Unit settings of the current coordinate system match those used in creating the DXF file.

14.2 DXF Export

The DXF Export is an almost identical procedure, just select ’Tools/Export DXF...’ and give the exported file a name. Here, again, it is necessary to ensure that the Scale and Paper Unit settings of the current coordinate system are correct so that they result in the desired scale and units for the outputted DXF values.