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
- scaleBounds_Makefile
Optional (Highly Recommended) - used to compile scaleBounds.c++
- scaleBounds.c++
Optional (Highly Recommended) - Scale Calculation Utility
- DXFconvert
Optional (Highly Recommended) - Automated Conversion Shell Script
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:
- make pfnav
- make pfbounds
- make pftransform
- make scaleBounds (Optional)
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
- DxfToIv (input.dxf) (output.iv)
- input.dxf
- the AutoCAD .dxf file you wish to convert
- output.iv
- Specify an ouput filename with the .iv extension you wish to use
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
- ivToVRML -o (output.wrl) (input.iv)
- output.wrl
- specify an output filename with the VRML .wrl extension you wish to use
- input.iv
- the input Inventory file you wish to convert to VRML
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
- input.iv
- the input Inventory file you wish to check the boundaries of
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
- pftransform -r (x-angle) (y-angle) (z-angle) -s (scale-factor) (input.iv) (output.pfb)
- x-angle
- number of degrees about x-axis to rotate the image
- y-angle
- number of degrees about y-axis to rotate the image
- z-angle
- number of degrees about z-axis to rotate the image
- scale-factor
- factor to scale the image
- input.iv
- input Inventor .iv file to be converted into a Performer .pfb file
- ouput.pfb
- specify an output filename with the Performer .pfb extension you wish to use
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
- input.pfb
- input Performer .pfb file to be viewed in the 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).
- DXFconvert (input.dxf) (scale-factor) (x-rotation angle) (y-rotation angle)
(z-rotation angle)
- input.dxf
- input AutoCAD .dxf file you wish to convert
- scale-factor
- factor at which to scale your AutoCAD image
- X-rotation angle
- angle around the x-axis you wish to rotate your image
- Y-rotation angle
- angle around the y-axis you wish to rotate your image
- Z-rotation angle
- angle around the z-axis you wish to rotate your image
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:
- X-rotation angle = 0
- Y-rotation angle = 0
- Z-rotation angle = 0
- Scale-Factor = 0
- scaleBounds automatically generates a scale-factor from the information
gathered from the Pfbounds utility
- XMAX = 100.0
- Scale maximum value to scale .dxf x-range to
- YMAX = 100.0
- Scale maximum value to scale .dxf y-range to
- ZMAX = 100.0
- Scale maximum value to scale .dxf z-range to
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:
- car.iv - the Inventor .iv file
- car.wrl - the VRML .wrl file
- car.pfb - the Performer .pfb file
- car.bounds - the Pfbounds .bounds file
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