CD_DXF - AutoCAD Image Exchange File Driver (cddxf.h)

This driver allows generating an AutoCAD image exchange file. The file name usually has an extension .DXF. This driver supports only AutoCAD Release 10 (AC1006) or AutoCAD 2000 (AC1015). The format's copyrights are property of Autodesk.


The file is created and opened by calling function cdCreateCanvas(CD_DXF, Data), in which Data contains the file name and canvas dimensions. This function opens the file and writes its header. Then, other functions in the CD library can be called as usual. The Data parameter string has the following format:

"filename [width_mmxheight_mm] [resolution] [-ac2000] [-limits xmin ymin xmax ymax]"    or in C "%s %gx%g %g %s %s %g %g %g %g"

Only the parameter filename is required. The filename must be inside double quotes (") if it has spaces. width_mm and height_mm are provided in millimeters (note the lowercase "x" between them), and their default value in pixels is INT_MAX for both dimensions. Resolution is the number of pixels per millimeter; its default value is "3.78 pixels/mm" (96 DPI). width_mm, height_mm and resolution are given in real values and are used only by cdCanvasGetSize and in pixel-millimeter conversion. 

Any amount of such canvases may exist simultaneously. It is important to note that a call to function cdKillCanvas is required to close the DXF file properly.

Images - The DXF format does not support client or server images and works with an indexed-color format (color quality is limited to 256 fixed colors).

Precision of Coordinates - The primitives use coordinates in real numbers.

Fill Area - Only with AutoCAD 2000 version. This adds support for filled primitives (solid and hatch style only). To use that support specify the "-ac2000" parameter. (since 5.7)

Limits - the default limits are 0, 0, width, height, but a custom limits can be specified using the "-limits" parameter followed by the limits coordinates. (since 5.7)

Layers - The format can work with several layers. It is necessary to draw the primitives of layer '0' first, then layer '1' and so on. Use function Flush to change the current layer.

Behavior of Functions


Coordinate System and Clipping



Font Mapping
CD Fonts AutoCAD Fonts
System STANDARD (sem arquivo)
Courier ROMAN (romanc.shx)
Courier + CD_BOLD ROMAN_BOLD (romant.shx)
Times ROMANTIC (rom_____.pfb)
Times + CD_BOLD ROMANTIC_BOLD (romb_____.pfb)
Helvetica SANSSERIF (sas_____.pfb)
Helvetica + CD_BOLD SANSSERIF_BOLD (sasb____.pfb)


Client Images

Server Images