Latest change:

If you came here by means of a search bot you'll probably like to start from the top and have a menu!

DXF Viewer



Improved Version available

There is a newer version of this program available.

Click here to go to the newer version...


DXF Viewer


About

The DXF Viewer is a Java program which shows you the content of DXF files.

DXF is a widely used file format for exchanging 3D CAD data. It's not an open format but owned by AutoDesk Inc. who used it for their program AutoCAD®. With every new version of AutoCAD® the definition of DXF is changed but nevertheless there are zillions of programs which are capable of reading and writing some form of DXF.

The latest version of the viewer is for Java version 1.1.x and newer. It is designed to run as a stand-alone application and as an Applet.
I've spent a lot time in the Xmas holidays 2001 trying to create workarounds for browser's bugs, so the browser should run better as an Applet nowadays (i.e. for Viewer versions starting with 1.20).


Features


Testing

Here you have the possibility to see the viewer in action.

Screenshots

  1. Screenshot: Standard look of viewer (about 20k)
  2. Screenshots: Moving a model (about 40k)
  3. Screenshots: Applet in Netscape (about 44k)
  4. Screenshots: Applet in MSIE with Java Plugin (about 38k)

Run it (needs Java)

There are two possibilities how the viewer is run: either directly in the browsers window or in an own window. And you can use the browser's own Java implementation or the Java plugin (available for Netscape and MSIE). Although it's possible to create a HTML code which will automatically call a Java implementation the following examples call the implementations directly to allow for better testing.

Applet in pageApplet in own window
Standard JVM Internal, with standard JVM In an own window, with standard JVM
Java Plugin Internal, with Java plugin In an own window, with Java plugin


Running the DXF Viewer as an application

The main prerequisites for this is a JRE (Java Runtime Environment) or a JDK (Java Development Kit) supporting at least Java version 1.1. First you download one of the jar file from the download section.

What happens than depends on your Java environment. It's easier if you use Java 1.2 or newer, but Java 1.1.x will work as well. Strongly recommended is the use of Java 1.4 (or newer) because performance is about twice as good compared to former Java versions.

Under Java 1.2 or newer you can start the viewer with the -jar switch, e.g.:

java -jar dxfviewer.jar dxffilename
      

Using Java 1.1.x you have to add the complete path where you stored the jar (including the filename) to your CLASSPATH environment variable. Then you call it with

java de.escape.quincunx.dxf.DxfViewer dxffilename
      

to view a DXF file. It is easier to put this in a batch file (for Windows) or in a shell script (sorry that I know nothing about Apple). Here is what they look like:

Windows batch file (save as DV.BAT)

@echo off
set CPBACKUP=%CLASSPATH%
set CLASSPATH=complete_path_of_dxfviewer.jar;%CLASSPATH%
java de.escape.quincunx.dxf.DxfViewer %1 %2 %3 %4 %5
set CLASSPATH=%CPBACKUP%
	    

Shell script for Unix systems (save as dv and make executable with chmod +x dv)

#!/bin/sh
CLASSPATH=complete_path_of_dxfviewer.jar
export CLASSPATH
java de.escape.quincunx.dxf.DxfViewer $@
	    

If you save the file in some of the directories in your PATH variable you can invoke the viewer with

dv dxf_filename
      

If you set the Java property dxfview.language to de_DE the viewer will start in German. I.e. change the java line in the scripts given above to

java -Ddxfview.language=de_DE de.escape.quincunx.dxf.DxfViewer $@
      

to invoke the German version directly.

That's all. The viewer as an application runs very stable on different systems.


Running the DXF Viewer as an Applet

Browser misery

The DXF Viewer is capable of running as an Applet. Because of lots of bugs in browser's Java Virtual Machine (JVM) implementations there was a long time where the applet had different problems, depending on the browser in which it was running. I hoped that the JVMs would improve with time, but that was partly wrong.

Today (January 2002) there are three mayor JVM implementations:

Here's a table of tests I've run, but your mileage may vary. Just point your browser to the examples and try it out.

Browser version Operation system Support of encapsulated applet Support of Applet in own window LiveConnect support
Sun appletviewer version 1.1 Linux correct correct n/a
Sun appletviewer version 1.2/1.3.x Linux correct correct n/a
Sun appletviewer version 1.2 Windows NT 4 (SP3) correct correct n/a
Netscape Communicator 4.76 with Netscape Java Windows NT 4 (SP5) correct correct correct
Netscape 4.76 with Java 1.2 plugin Windows NT 4 (SP5) correct correct not supported
MS Internet Explorer 5 with MS JVM Windows NT 4 (SP5) correct correct correct
MS Internet Explorer 5 with Java 1.2 plugin Windows NT 4 (SP5) correct correct not supported
Netscape Communicator 4.77 MacOS (9?) correct correct ?
Moziall 0.8 MacOS (9?) correct correct ?
Apple's Applet runner MacOS (9?) correct correct n/a

Another common problem is printing. Browsers can print pages with applets in them, but the very simple Java 1.1 printing model (a kind of hardcopy) produces coarse printings. Because the viewer has to stay with Java 1.1 for Applet compatibility reasons there's nothing much to be done about that. The users of the standalone version of the viewer may use the Save as PostScript feature to create better prints (especially useful on Unix where PostScript is standard so you can print directly to the printer). But unsigned Applets are not allowed to access the hosts file system or printer, so this feature is useless there.


Use it in an Intranet

If you need the Applet for an Intranet you are better off. If you install the Java plugin from Sun you can run the Applet with the original Sun Java 2 Virtual Machine in several modern browsers.


Download

There are two versions of the DXF Viewer available for download. The only difference is how things are packed together.

This is only necessary because of a problem in Netscape's Java implementation which makes it impossible to load resources from jar files. As a workaround the resources for the Applet are not packed in the jar file for the applet (making this jar smaller), but you have to install them on your server anyway (so the applet is able to find them). In the dxfapplet.zip below you'll find a file dxfapplet.jar which contains the applet code and two directories with necessary resources: resources and fonts (if you don't need/want DXF texts displayed just don't install the fonts dir). Install these under your codebase (as defined in the applet tag) on the server. Take a look at the HTML code on the example pages to see how the applet tag is written. It's not as difficult as it sounds here.
BTW: if you are interested how this workaround is implemented take a look at one of my de·caff pages where I explain some of the workarounds I was forced to invent to get around the problems of common browser's Java implementations.

The other package is just a runnable jar containing classes and resources. If you know that you are in an environment where no Netscape 4.x browsers will access your applet, you can use this file for your applet and don't have to install extra directories on your server.


License

The DXF Viewer in the form of the jar files/zip packages given above may be used and distributed freely. Use it on your own risk.

See Contact if you are interested in getting the sources.


Contact

My name is Rammi from the city Braunschweig in Germany and I make a living as a freelancer/consultant.

Sources

See the source code information page of the newer DXF viewer.

Bugs

It's my explicite wish that the reader part of the viewer is as stable as possible. It is already very stable because it is based on a series of DXF converters/input filters I have written so far.

But nobody is perfect.

If you have DXF files which the DXF Viewer refuses to load, or which look incorrect, and you are able to give them away, please take the time of writing me a short note including the file itself (be sure that it's not too large, pack it if possible), the content of the Info>Java Stuff window and the content of the Info>Message Log window.


Acknowledgements

DXF Viewer was for a long time developped on Linux with XEmacs using the no longer existing blackdown JDK empowered by tya. We are all standing on the shoulders of giants.
Today it's still developped on Linux, but uses the great IntelliJ IDEA IDE and various JVMs.

Thanks to all who took the time to supply test data and/or bug reports!

Special thanks to Frank Gerberding for raytracing the about image on his famous PPC powered Amiga and for introducing me to quaternions.

Many thanks to HP Knoll from Paris for supplying me with a binary DXF file and DXF files of AutoCAD® R13 and R14.

Thanks to Bernhard Giesa I know that the DXF Viewer is running well under MacOS at least as an Applet (in Netscape Communicator 4.77, Mozilla 0.8, and with Apple's Applet runner).

Thanks to Tim Niels van der Leeuw who gave me the idea that speeding up Java I/O is possible.

Thanks to Dietmar Rudolph/Thomas Stürznickel/Leo Weissenberger for writing the book "Der DXF-Standard" (ISBN 3-87686-246-9). It was really unrenounceable (and maybe one day I will have found all the errors ;-)
The book is out of print now, but Mr Rudolph has written a successor. It's called "DXF Intern". See www.crlf.de. The main problem is probably that it is written in German. It's available as book-on-demand, and I've bought a copy. If you really want to know about DXF as written by AutoCAD® until R12 you should definitely afford the Euro 100 (not quite cheap, and book-on-demands are paperbacks so I doubt that it will survive heavy using for long). It has a small chapter about DXF as written by newer versions of AutoCAD® and why the introduced changes makes it so difficult to read it (you can find that chapter under the web page mentioned above, too). The information available at the AutoDesk page (last time I looked I found it under http://www.autodesk.com/techpubs/autocad/acad2000/dxf but that may have changed in the meantime) is for AutoCAD® 2000's DXF, but not as deep and concise.


Links

Here you'll find some useful links.



See the preview of the next DXF Viewer version

Screenshot of new viewer version

Because many nice people encouraged me to go one with the DXF Viewer and add more useful features I sat down and started to implement them. Not everything is yet as complete as could be, but at least now there's a preview available:

Go to the new DXF Viewer page