Transforming AutoCAD files into the CAVE using Performer


This page outlines how to transform AutoCAD *.dxf files into a CAVE Walkthru.

This is presently being developed on the SciViz Lab Octane (viz8.sv.vt.edu) for the length of this project. The transformation of AutoCAD files is very similar to AutoDesk 3D Studio files, except that we use different conversion utilities. The general procedure is as follows:

Step 1: Download the following conversion utility programs
You can place these files in your directory with the .dxf files, or somewhere more convenient in your PATH statement. These programs generate about 3-4 files for each .dxf file, so you're data directory might become rather cluttered. It's simply a matter of preference, but if you're going to be converting alot of files, we recommend placing the utilities somewhere in your PATH statement.
Step 2: Compile all the conversion utility programs

From the directory you placed all of the files: This compiles the three main conversion utilities: pfnav, pfbounds, pftransform. If you downloaded the scaleBounds program, compile it now.

Note: You may have to put scaleBounds in another directory temporarily to compile, seeing as there are 2 Makefiles required for compilation.

If you are using the DXFconvert shell script, skip to Step 3A

Step 3: Converting an AutoCAD .dxf file into an Inventor .iv file

For sake of continuity, we recommend you name the output filename the same root as the input filename. For example:

DxfToIv car.dxf car.iv

This will convert the car.dxf file into a car.iv file. The original car.dxf file will still exist, but a new Inventor file, car.iv, will be created in the same directory.

Step 4: Converting an Inventor .iv file into a VRML file

For sake of continuity, we recommend you naming the output filename the same root as the input filename. For example:

ivToVRML -o car.wrl car.iv

This will convert the car.iv file into a car.wrl file. The original car.iv file will still exist, but a new VRML file, car.wrl, will be created in the same directory.

Step 5: Check the Boundaries of the Inventor .iv file

If you do not wish to scale .iv files whatsoever, then you don't need to calculate a scale factor. However, for things to fit nicely into the CAVE, it is recommended. Here's an example output from the pfbounds utility:

X:  35.2029  - 164.796997
Y:  85.0000  - 115.000000
Z: -14.9181   - 14.917437

This shows the x-range from 35.2 to 164.7, the y-range from 85.0 to 115.0, and the z-range from -14.9 to 14.9. You can take these values and scale as you see needed. It is NOT required to scale, but is recommended. You must apply what is best for your application.

The VT CAVE is approximately a ten foot (120 inches) cube in dimensions, with the origin in the center of that cube. It is our recommendation to keep the overall range of values for each dimension at approximately 100. The .dxf files used have dimensions of inches, and 100 inches for each range assures that moving the object around in 3D space will fit nicely into the CAVE.

For our example above, our suggested scale factor is: 0.77164
Step 6: Convert an Inventor .iv file into a Performer .pfb file

Say we knew our drawing was rotated from previous conversions. Instead of trying to fix the AutoCAD drawing, we just rotate it before importing into the CAVE. Again, we recommend using the same root of the filenames for clarity. Using our previous example and scaling factor we would do the following:

pftransform -r -90 0 0 -s 0.77164 car.iv car.pfb

This would convert the Inventor .iv file, car.iv, into Performer .pfb format. Again, the car.iv file still exists and the car.pfb file was created. The image was rotated -90 degrees across the x-axis, and wasn't rotated at all about the y-axis and z-axis. The image was scaled down by a factor of .77164.
Step 7: View the Performer .pfb file in the CAVE or CAVE Simulator

This loads the input.pfb file into the CAVE/Simulator. You should see your AutoCAD drawing now. If it is not in view, rotate the point-of-view. Your image is most likely there but generated out of view due to the differing coordinate systems between AutoCAD and the CAVE. You can use the Pftransform rotations if you wish to reorient the image without fixing your .dxf file in AutoCAD.
If you have already followed Steps 1 through 7, you need not follow these steps

Script Author: Heath Beres

Step 3A: Using DXFconvert

Following Steps 3 through 7 for each AutoCAD .dxf file works fine, but after many conversions it becomes tedious to do this. Therefore, I have written a C-shell script to automate these procedures. This means you must be running on a UNIX-based machine (which I can't see why you wouldn't for the CAVE), and check to make sure you have /bin/csh (C-shell). The variables are the same used in Steps 3 through 7, simply put into one command-line. The benefit of using this script is that the command-line parameters are all optional (except the input file) and are configurable. The default script values are:
Rotation Angles
You can specify the rotation angles on the command-line, or if you find that you are always rotating your drawings by a given angle then reset the defaults. By resetting the defaults, you don't have to specify the angles every time you run the script. Angles are specified in degrees.

Scale Maximum Values
These are the maximum values to scale your images to, if you are using the scaleBounds program to generate a scale-factor. If you are specifying your own scale-factor, then these values have no meaning. They are set at 100.0 (inches) which is a good number for the VT CAVE, which is 120.0 inches cubed. If your CAVE has different dimensions in each direction, then specify them as you need.

Scale-Factor
By default, the scale-factor is set to 0, which means the scaleBounds program will calculate a proper scale-factor with the information from Pfbounds and automatically scale your image for you. If you specify a scale-factor on the command-line, or change the default value to something other than 0, the scaleBounds will not be run and the value you specified will be used.

Output
The script generates 4 separate files, not including the original .dxf file. It generates an Inventor .iv file, a VRML .wrl file, a Performer .pfb file, and a Pfbounds .bounds file. Upon completion of conversion, the script will notify you of the files it created, the scale-factor used, and specified rotation-angles. The files created all have the same root as the .dxf file you specified.

A Few Examples

DXFconvert car.dxf

This uses the default angles of 0 degrees, and scaleBounds will generate an appropriate scale-factor and use it during conversion. This outputs the following files:

DXFconvert car.dxf 0.80

This uses the default angles of 0 degrees, however scaleBounds does NOT generate a scale-factor. The script uses 0.80 as its scale factor during conversion. It outputs the same filenames as the first example.

DXFconvert car.dxf 0.80 90

This uses the specified X-Rotation Angle of 90 degrees, and uses the default Y-Rotation Angle of 0 degrees and the default Z-Rotation Angle of 0 degrees. It uses the given scale-factor of 0.80 during conversion. It outputs the same filenames as the first example.

DXFconvert car.dxf 0.80 90 10

This uses an X-Rotation Angle of 90 degrees, a Y-Rotation of 10 degrees, and the default Z-Rotation Angle of 0 degrees. It uses the given scale-factor of 0.80 during conversion. It outputs the same filenames as the first example.

DXFconvert car.dxf 0.80 90 10 -90

This uses an X-Rotation Angle of 90 degrees, a Y-Rotation of 10 degrees, and a Z-Rotation Angle of -90 degrees. It uses the given scale-factor of 0.80 during conversion. It outputs the same filenames as the first example.


Written By:Heath Beres

Page Last Updated: 1/27/98