CD - Canvas Draw

CD_DGN - MicroStation Design File Driver (cddgn.h)

This driver allows generating a MicroStation design file. The file name usually has an extension .DGN. The driver supports only MicroStation version 4.0 or later. The format's copyrights are property of Bentley Systems.


Use

The file is created and opened by calling function cdCreateCanvas(CD_DGN, Data), in which Data contains the filename 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 [widthxheight] [resolution] [-f] [-sseedfile]" or in C "%s %gx%g %g %s"

Only the parameter filename is required. The filename must be inside double quotes (") if it has spaces. Width and height 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.8". Width, height and resolution are real values. Parameter -f modifies the polygon filling's behavior. Just as in MicroStation, you can specify a seed file using parameter -s. Width, height and resolution are used only by cdGetCanvasSize 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 file properly.

Images and Colors - The DGN format does not support server images and works with an indexed-color format. Color quality is limited to 256 colors, and the format uses a uniform palette to convert RGB colors into palette indices. If you configure a palette, the color conversion process will become slower.

Filling - Up to version 5.0, MicroStation presents some limitations for polygon filling. You can disable filling by means of string "-f" in the Data parameter. Filled polygons can only have around 10,000 vertices; if the value is larger, the polygon style changes to closed lines.

Seed - In the seed file, several DGN parameters can be defined to be used in the drawing. The library offers a default seed file, called "SEED2D.DGN". The file's location depends on the environment variable CDDIR.


Behavior of Functions

Control

Coordinate System and Clipping

  • cdClip: does nothing (no clipping function is supported), returns CD_CLIPOFF.
  • cdClipArea: does nothing.
  • cdGetClipArea: does nothing, returns CD_CLIPOFF.
  • cdUpdateYAxis: does nothing. The axis orientation is the same as the CD library.
  • Complex Regions: not supported.

Primitives

  • cdBegin: if parameter CD_CLIP or CD_BEZIER are specified, does nothing.
  • cdMark: is simulated.
  • cdChord: does nothing.

Attributes

Font Mapping
CD Fonts MicroStation Fonts
CD_SYSTEM / CD_HELVETICA #0 - Standard
CD_COURIER #43 - Low_res_filled
CD_TIMES_ROMAN #2 - Fancy

Colors

Client Images

Server Images

  • All functions do nothing.