Administration Guide : Command-line manual pages

DGN2JPG(1M) manual page


dgn2jpg - responsible for generating Web previews of DGN CAD files.


dgn2jpg [ -version ] [ -help ] [ -widthWidthInPixels ] [ -heightHeightInPixels ] [ -mrmode [,mode ] ] [ -bgBBGGRR ] [ -path path [;path ] ] [ -out filename ] [ -outmeta filename ] [ -outtxt filename ] [ -maxtxtnum ] [ input file ]


The movsync (1M) program passes 2D and 3D DGN CAD files on to the dgn2jpg (1M) program so that it can generate previews for DGN formats. It supports V7 and V8 files, with V8 XM and V8I files fully supported.

The dgn2jpg (1M) program uses Open Design Alliance libraries to render and rotate 3D DGN CAD files, coupled with the Mesa 3D OpenGL software renderer. How files are rendered depends upon the render-mode parameter (-mr ) and the file itself. The dgn2jpg (1M) program will render all visible views within the default View Group. If the object being rendered in any visible view is 3D, it will draw the object as wireframe, shaded and finally shaded with wireframe, capturing three separate images, with duplicate images being removed. If the rendered object in a visible view is 2D, dgn2jpg (1M) will override the render modes supplied, draw the object in wireframe, and capture a single image. Any views that are not visible in the default View Group are not rendered.

The dgn2jpg (1M) program can also extract text (any strings with three or more alpha and/or Unicode characters) from within CAD documents (along with position and sizing details of the text) via the -outtxt command-line parameter

The dgn2jpg (1M) program determines whether to render a drawing as 2D or 3D by subtracting its maxz and minz points to see if the object has any depth. Previews of objects with depth will be rendered in 3D. If the maxz and minz points are the same, the object has no depth and thus will be considered 2D.

Command Options

The flags are defined as follows:
Displays the current version and exits.
Shows the command line arguments.
Default width of the canvas, in pixels, to which the DGN file will be rendered.
Default height of the canvas, in pixels, to which the DGN file will be rendered.
-mrmode [,mode ]
List of modes in which to render the objects. Default 1,4,6. See below. If object is 2D, the supplied modes will be overridden and it will be rendered as 2D optimized only.
Blue,Green, Red values in Hex for the background color or the rendered canvas, e.g., -bg7F7F7F . Default is white for Paper Space and black for Model Space.
-path path [;path ]
";" delimited path used to specify search paths for dgn2jpg (1M) to look for additional resources such as fonts, e.g., -path "/home/bentley/fonts/;home/system/fonts" . (Quotation marks required if you have spaces in the path(s).)
-out filename
Name of output snapshot file(s) to generate, e.g., out%04d.jpg .
-outmeta filename
Name of output metadata file(s) containing proprietary information on how the output file was generated; e.g., metaout%04d.txt . This information is stored in te database and allows a capture to be faithfully reproduced.
-outtxt filename
Name of output file used to store extracted text from file; e.g.,txtout%04d.txt .
Limit the number of text entries extracted from any file.
input file
Last parameter should always be the input file being processed.

This list does not include additional arguments required for zooming. Currently, zooming functionality is only accessible via the imageorder CGI.

Global Settings

A global vsp.conf (5) settings file has been installed in the ...venture/var directory. For dgn2jpg (1M) this file can contain the following options settings: CADBGColor , CADSearchPaths , and CADMaxTextEntries . Each of these is shared with cad2jpg (1M) . Refer to vsp.conf (5) for further details.

Render Modes

The default render mode is the string 1,4,6 representing wireframe , Gouraud shaded and Gouraud shaded with wireframe .

  1. = Standard display. Optimized for 2D.
  2. = Standard wireframe display. Uses 3D pipeline.
  3. = Wireframe display. Hidden lines removed.
  4. = Faceted display. One color per face.
  5. = Smooth shaded display. Colors interpolated between vertices.
  6. = Faceted display with wireframe overlay.
  7. = Smooth shaded display with wireframe overlay.


The following shows an example of movsync (1M) calling dgn2jpg :

dgn2jpg -width1600 -height1200 -mrl,4,6  
-path "/Volumes/fonts1;/Volumes/AutoCAD/fonts2" -out cadframes%04d.jpg  
-outmeta cadframes%04d.txt -outtxt extractedtext%04d.txt 
-maxtxt500 /Volumes/AutoCAD/Building.dgn  

When a WebNative Portal user zooms using mview , the imageorder CGI calls dgn2jpg (1M) to request that a portion of the file be rendered. The cropped portion of the image is written to stdout and ingested by the imageorder CGI.