Re: Extending VRML, politely

Scott Nelson (snelson@canopus.llnl.gov)
Wed, 22 Feb 1995 10:29:55 -0800


>
>Jan C. Hardenbergh asked:
>
>P.S. What you are writing translaters, VRML would get a good shot in the arm
>from a DXF to VRML widget.
>

There already is a converter called DxfToIv which does a good
job of converting a DXF file into an Inventor file. I converted
the Starship Enterprise and a few DXF files that we created and
it seems to work OK.

Here's the man page, not sure where I got it -- ask archie.

---------------------------------------------------------------------------

DXFTOIV(1) UNIX System V DXFTOIV(1)

NAME
DxfToIv - convert DXF files to Inventor

SYNOPSIS
DxfToIv [-b] [-h] [-v] file.dxf

DESCRIPTION
DxfToIv reads a model file in AutoCAD's DXF format, and
constructs an Inventor scene graph, which is written to
stdout.

The following command line options are allowed:

-h Prints a help message summarizing the options.

-b Write out the scene graph in binary Inventor format.
The default is to write out the files in Inventor's
ASCII format.

-v Verbose mode. Traces the various phases of the
conversion process (see below).

NOTES
Each "layer" of the autocad model has its own corresponding
SoSeparator node in the constructed scene graph. Within a
layer, if there are multiple objects that do not touch each
other, each is grouped under its own separator.

Each use of a "block" in the autocad model has its own
corresponding SoSeparator node, which is inserted as a child
of the layer that the block is used in. All elements of a
block are children of the block's SoSeparator node (unlike
AutoCAD, in which elements of a block can reside in layers
other than the one the block is inserted in).

Text is created using Inventor's default font; the AutoCAD
font information is ignored. Text is sized and oriented to
approximate the placement in the AutoCAD model, but the
aligment may be slightly off.

AutoCAD models do not include surface normals nor do they
have a well-defined notion of front and back sides of a
face. DxfToIv computes normals on a per-vertex basis,
giving connected faces of a body consistent, smoothly
varying normals (subject to a crease angle of 30 degrees
between adjacent faces). The normals are chosen to point
"outward" relative to the volume enclosed by the surface;
for flat surfaces, the choice of normal direction is
arbitrary. Open surfaces are given SoShapeHints values of
SURFACE|ORDERED to enable two-sided lighting so that they
will appear correct from either side.

The conversion process takes place in four phases: read the
DXF file and construct the initial scene graph; identify and
detach separate bodies within each layer; compute the
normals for the face sets; and write the resulting graph.
For large DXF files, the conversion may take some time.
Progress of the conversion can be traced by specifying the
-v option to DxfToIv ; processing of face sets is counted by
50's.

-- 

+---------------------------------------------------------+ |Scott D. Nelson B131 Rm2074 3-1250 | |Lawrence Livermore National Laboratory | |7000 East Ave., L-153 Livermore CA 94550 | |email: nelson18@llnl.gov http://www-dsed.llnl.gov/ | +---------------------------------------------------------+