Administration Guide : Command-line manual pages

CAD2JPG(1M) manual page

Name

cad2jpg - responsible for generating Web previews of AutoCAD files with support for DWG, DXF, Binary DXF, and some versions of ACIS.

Synopsis

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

Description

The movsync (1M) passes 2D and 3D CAD files on to the cad2jpg (1M) program to generate previews. The cad2jpg (1M) program then renders previews for DWG, DXF, BDXF and a number of ACIS SAT formats. (Xinet tested ACIS SAT versions 1.0 through 8.0, 10.0, 11.0, 20.0 and 21.0.)

The cad2jpg (1M) program uses Open Design Alliance libraries to render and rotate 3D AutoCAD files, coupled with the Mesa 3D OpenGL software renderer. How files are rendered depends upon the render-mode parameter (-mr ) and the file itself. A CAD file can contain multiple layers; one layer in 3D-model space and the remaining layers in 2D paper space. The cad2jpg (1M) program renders the default active layer first (the default layout view with which the file was saved), followed by the remaining layers in tab order (the order within AutoCAD). Typically this means that when the active layer is 2D-paper space, cad2jpg (1M) renders this first, followed by the 3D-model space layer and any remaining paper space layers. When the active layer is 3D-model space, cad2jpg will render it first, followed by all the reamining paper space layers.

When rendering a 2D-paper space layer, cad3jpg (1M) will override the render modes supplied, draw the object in wireframe, and capture a single image. When rendering the 3D-model space layer, it will draw the object, by default, as wireframe, Gouraud shaded, and Gouraud shaded with wireframe, capturing three separate images. In addition, for a 3D-layer, it can rotate its camera around the X axis in 90-degree increments, captuing the left (90 degrees), back (180 degrees) and right (270 degrees) faces, followed by rotation around the Y axis, capturing the top (90 degrees) and bottom (270 degrees). How the object is rendered during the rotation depends upon the -cr mode specified on the command line.

The cad2jpg (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 program requires access to font files in order to vectorize (render) text and calculate text extents which convey positioning information. It supports both SHX and TrueType fonts; however, correct font files must be installed on the system before it can render fonts and find the extents of the particular font. One of the most common causes for incorrect text is a missing font file. In such cases, cad2jpg (1M) will substitue a new font for the missing font, but this often causes differences in appearance and positioning, as the dimensions of the characters in the substituted font will likely be different from those in the missing font.

When cad2jpq (1M) requires access to a file such as a font file, a template file, etc., the following search order is used: 1) Access the file as-is (without adding or modifying the path), 2) Access the file in the current directory, 3) Access the file in the same directory where the current drawing resides (for SHX fonts, image and xref files), 4) The Windows fonts directory (only for TrueType fonts on Windows), 5) The search paths supplied in the vsp.conf (5) file via CADSearchPaths (case sensitive file name search), and 6) The search paths supplied in the vsp.conf (5) file via CADSearchPaths (case insensitive file name search).

If you receive a font file with a drawing and do not expect to use it again, or you do not want to clutter your fonts directory, you may locate the font files in the same directory as the drawing file. If a font is to be used by multiple drawings, then it should be re-located to one of the search paths referenced in your vsp.conf (5) file via CADSearchPaths. Note: If you do not have AutoCAD installed, you may need to download fonts accordingly.

The cad2jpg (1M) program also works with movsync (1M) to create low-resolution videos of the object as it rotates around its X and Y axes. Low resolution video options must be enabled in the nativeadmin GUI for these to be viewed and requires use of WebNative Portal. The -outmov flag can be used to generate the individual frames that movsync (1M) will use to make the movie.

The cad2jpg (1M) program uses two methods to determine whether a layer to be rendered is two-dimensional or three-dimensional. If a drawing layer is paper space, cad2jpg (1M) will render previews in 2D. (Paper space, introduced in AutoCAD R11, can be considered a parallel realm within an AutoCAD drawing, but one where the "world" is based on the sheet of paper on which the final drawing will be printed or plotted.) The default background color for paper space is white. If the drawing layer is model space, cad2jpg (1M) will subtract its maxz and minz points to see if the layer has any depth. A layer with depth will be rendered in 3D. If the maxz and minz points are the same, the layer has no depth and, thus, will be considered 2D. The default background color for model space is black.

Note: Often a 2D drawing such as an engineering plan, will be created in model space. If this drawing has even a single line with depth, cad2jpg (1M) will recognise this file as 3D.

Command Options

The flags are defined as follows:
-version
Displays the current version and exits.
-help
Shows the command line arguments.
-widthWidthInPixels
Default width of the canvas, in pixels, to which the CAD file will be rendered.
-heightHeightInPixels
Default height of the canvas, in pixels, to which the CAD 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.
-crmode
Rotate the camera around a 3D object using the specified render mode. (See below.) Captures, left, back, right, top and bottom views. Valid values are 1 through 6 .
-mmmode
Generate low-resolution videos as the camera rotates around an object using the specified render mode (See below.)
-bgBBGGRR
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 cad2jpg (1M) to look for additional resources such as fonts, e.g., -path "/home/acad/fonts/;home/system/fonts" . (Quotation marks required if you have spaces in the path(s).)
-out filename
Name of output snapshot file(s) to generatie, 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., out%04d.txt .
-outmov filename
Name of output snapshot files to generate for making movie, e.g., movout%04d.jpg .
-outtxt filename
Name of output file(s) used to store extracted text from file, e.g., txtout%04d.jpg.
-maxtxtnum
Limit the number of text entries extracted from any file.
input file
Last parameter should always be the input file being processed.

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.

Examples

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


cad2jpg -width1600 -height1200 -mrl,4,6 -cr4  
 
-path "/Volumes/fonts1;/Volumes/AutoCAD/fonts2" -out cadframes%04d.txt  
 
-outmov framesforlowresmovie%04d.jpg -outtxt extractedtext%04d.txt  
 
-maxtxt500 /Volumes/AutoCAD/Building.dwg 
 

Files

/usr/etc/venture/bin/cad2jpg

/usr/etc/venture/var/vsp.conf