Latest change of this page: Saturday, 28-Aug-2010 18:26:09 CEST

de·caff DXF Viewer Version 2.00
(Preview Release)

DXF Viewer Splash

Introduction

This page introduces the first preview of the new version 2.00 of a Viewer for DXF files. Being a preview means that not everything is as perfect as could possibly be. An older and possibly more stable predecessor may be found on the quincunx DXF Viewer pages.

The DXF viewer is a Java program which displays DXF and SHX files. It runs under every machine which supports at least Java 1.4.

DXF is a file format which was introduced a long time ago by AutoDesk to work as an exchange format for their well-known AutoCAD program. SHX is the font format used by AutoCAD;.

Features

The viewer reads 2D and 3D ASCII and binary DXF files (which may even be packed with zip, gzip and bzip2, but you should prefer zip), and understands a noticable subset of the features of newer DXF versions. If you have ever tried other DXF viewers you have probably noticed that there are many problems with newer DXF files. Blame AutoDesk because they added lots of stuff when switching from AutoCAD R12 to AutoCAD R13, partly incompatible and even some parts which are written in a completely different format which is embedded in the DXF file in an encrypted form. There are many additions which are useless for any programs other than AutoCAD resulting in unnecessary file bloat.

The files are displayed as wireframe graphics similar to AutoCAD. A rendered Java3D version like the one from where the shuttle image displayed on top of this page was taken is currently implemented, but not yet publically available.

Several output formats are supported.

An Applet version of the viewer is also available.

Download

This is a preview release so please don't expect too much. There are still lots of useful features missing, but at least it is expected that the program runs quite stable. If you have DXF files which create errors feel free to send them to the author. Please pack the files to save bandwith (DXF packs very well).

Standard Wireframe version

The standard version of the viewer displays the files similar to the standard AutoCAD view. It runs as an application under every operation system with a Java 1.4 runtime environment or better.

Download: dxfviewer-swing.jar Preview Version 2.00p86 (1,177,212 Bytes, from Saturday, 28-Aug-2010 18:49:38 CEST)

The DXF Viewer in the form of the jar package as downloadable above may be used and distributed freely. This is beta software! Use it on your own risk!

Usage

Standard Usage

Under most operation systems you can run the program from your GUI just like any other program (eg. double-clicking on it's symbol on Windows). There is one drawback with this approach, though, because by this the viewer may not use more than 64 MBytes of memory which is not enough for really big files.

If you often run into memory problems you may want to increase the amount of memory the viewer is allowed to use. Read on to learn more.

Recognizing memory problems

There is a memory usage indicator in the status bar which shows you how many memory the viewer has allocated and how much of it it is using. If this indicator gets dark red the viewer's memory is nearly exhausted which will slow down performance dramatically.

Getting a error box displaying "java.lang.OutOfMemory" is the fatal sign. There's not enough memory available for the operation you are currently running (probably loading a file).

If you have several files open you can close some of them to free memory. The newly freed memory does not show directly in the memory indicator, but it will after the next garbage collection is run. Garbage collection is done automatically so you don't have to care.

Allowing for more memory

There are more than one way to allow for more memory. The one which is working on all platforms is to start the viewer with a script, i.e. a .cmd file on Windows or a shell script on Unix. It has to contain just one line:

java -mx256m -jar dxfviewer-swing.jar

Here 256m stands for the amount of memory allowed to the viewer (in this case 256 MByte). I'd recommend not to use more than 3/4 of the total amount of physical memory in your machine.

The following are two example scripts which you may enhance to your needs. Both start the viewer with a maximum amount of 256 MBytes whic should be enough in most cases. Just store them in the same directory as the jar file. Depending on your browser's settings it may be necessary to right-click and select "Save as" to get them stored.

Enhancements

Supporting more image output formats

Standard Java installations have only a rudimentary support for image formats. After installing the Java Advanced Imaging Image I/O Tools from the Java Advanced Imaging API you'll find some more output formats in the Save As menu. Just follow the installation instructions and install it as a Java extension.

Reference

DXF ENTITY support

Here's a table on which DXF entities are supported by the viewer:

DXF ENTITYSupport StatusComments
3DFACE supported
3DSOLID ignored Encrypted entity introduced in AutoCAD R13
ARC supported
ATTDEF/ATTRIB supported
BODY ignored Encrypted entity introduced in AutoCAD R13
BLOCK supported external (XREF) blocks are not yet supported
CIRCLE supported
DIMENSION supported
ELLIPSE supported introduced in AutoCAD R13
HATCH supported introduced in AutoCAD R13
AutoCAD 2000 has notorious problems with hatches, and is known to create files with broken hatches, which may look bad in the viewer (and in newer AutoCAD releases).
HELIX ignored introduced in AutoCAD 2007
IMAGE ignored introduced in AutoCAD R13
INSERT supported
LEADER supported introduced in AutoCAD R13
LINE supported
LWPOLYLINE supported introduced in AutoCAD R13
MLINE ignored introduced in AutoCAD R13
MTEXT supported introduced in AutoCAD R13
fonts may be substituted if not available
columns and background coloring are not yet supported
OLEFRAME ignored introduced in AutoCAD R13
OLEFRAME2 ignored introduced in AutoCAD R13
POINT supported only as dot
POLYLINE supported
RAY ignored introduced in AutoCAD R13
REGION ignored Encrypted entity introduced in AutoCAD R13
SECTION ignored introduced in AutoCAD 2007
RTEXT ignored introduced in AutoCAD R13
SHAPE ignored
SOLID supported
SPLINE supported introduced in AutoCAD R13
SUN ignored introduced in AutoCAD 2007
SURFACE ignored introduced in AutoCAD 2007
TABLE ignored introduced in AutoCAD 2006
TEXT supported fonts may be substituted if not available
TOLERANCE ignored introduced in AutoCAD R13
TRACE supported
UNDERLAY ignored introduced in AutoCAD 2006
VIEWPORT ignored
WIPEOUT ignored introduced in AutoCAD R13
XLINE ignored introduced in AutoCAD R13

Miscellaneous

Pack Formats and Read Performance

The short version:
Although the viewer can read various packed formats, you should pack your files with zip.

Somewhat longer:
I ran some tests and measured the overhead needed to unpack the files during the read process, and it seems that for gzip-packed files the standard library uses an algorithm implemented in Java, while for files packed with zip a faster local library implementation is used (the special package which is used for unpacking bzip2 files is implemented in Java). Because jar files are nothing else than zip files with some special content having a fast unzip algorithm in the standard library is something definitely needed, because it is to fear that a Java implementation would be a lot slower.

More than most people probably want to know:
Here's a PDF which shows the results of my tests.

Contact

My name is Rammi and I'm working as a freelancer. I'm living in the city Braunschweig in Germany.

If you can provide problematic DXF files, have questions, suggestions, or similar please click on the following link to send an eMail:

eMail 4 Rammi

If you send DXF files please pack them prior to sending to save bandwidth.

Acknowledgments

Thanks

DXF Sharp
	Viewer Screenshot I'm cooperating with Wout de Zeeuw who has written a 3D DXF Viewer and library for .NET based on C#.
Click on the screenshot to see it full size.
We have a friendly competition running who is providing the better DXF Viewer. The nice thing about this is that everybody is winning in this competition: we from our mutual feedback and you from the improvements.

The viewer makes use of the bzip2.jar extracted from the Apache Ant project by Kohsuke Kawaguchi. Thanks a lot!

The viewer uses the FileDrop class from Robert Harder. Thanks to him!

Lots of people helped with feedback, ideas and test data. Special thanks go to

Legal stuff

This product includes software developed by the Apache Software Foundation (http://www.apache.org/).

The DXF Viewer uses bzip2.jar extracted by Kohsuke Kawaguchi from the Apache Ant project to read files packed with the bzip2 algorithm.

Ant is distributed under the Apache Software License, Version 1.1:

 ============================================================================
                   The Apache Software License, Version 1.1
 ============================================================================

 Copyright (C) 2000 The Apache Software Foundation. All rights reserved.

 Redistribution and use in source and binary forms, with or without modifica-
 tion, are permitted provided that the following conditions are met:

 1. Redistributions of  source code must  retain the above copyright  notice,
    this list of conditions and the following disclaimer.

 2. Redistributions in binary form must reproduce the above copyright notice,
    this list of conditions and the following disclaimer in the documentation
    and/or other materials provided with the distribution.

 3. The end-user documentation included with the redistribution, if any, must
    include  the following  acknowledgment:  "This product includes  software
    developed  by the  Apache Software Foundation  (http://www.apache.org/)."
    Alternately, this  acknowledgment may  appear in the software itself,  if
    and wherever such third-party acknowledgments normally appear.

 4. The names  "Ant"  and  "Apache Software Foundation"  must not be  used to
    endorse  or promote  products derived  from this  software without  prior
    written permission. For written permission, please contact
    apache@apache.org.

 5. Products  derived from this software may not  be called "Apache", nor may
    "Apache" appear  in their name,  without prior written permission  of the
    Apache Software Foundation.

 THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
 FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
 APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
 INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
 DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
 OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
 ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
 (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

 This software  consists of voluntary contributions made  by many individuals
 on  behalf  of the Apache Software  Foundation. For more  information on the
 Apache Software Foundation, please see http://www.apache.org/.

Trademarks

Java is a registered trademark of Sun Microsystems, Inc.

AutoCAD is a registered trademark of AutoDesk, Inc.

Windows is a registered trademark of Microsoft, Inc.

All other registered trademarks are the property of their respective owners.

Version History

V 2.00p86 [Sat Aug 28 17:23:09 CEST 2010]

Feature/bugfix release.

Features

Bugfixes

V 2.00p85a [Fri Mar 12 13:56:00 CET 2010]

Bugfix release thanks to Enrico Gallo:

V 2.00p85 [Sun Jan 3 13:24:21 CET 2010]

Corrected bug in bigfont support where bigfonts were wronly mapped.

V 2.00p84 [Mon Dec 14 16:15:32 CET 2009]

Fixed several problems with text placement, especially for texts beginning or ending with spaces.

Improved bigfont support.

V 2.00p83 [Wed Dec 2 23:10:10 CET 2009]

Fixed bug when text was not displayed if one of the used font was broken.

Fixed minor problems with text placement.

V 2.00p82 [Thu Sep 10 16:08:14 CEST 2009]

Improve MTEXT and font support.

MTEXT was much enhanced in recent AutoCAD versions which appeared after the first support for MTEXT was added to the viewer. This release closes the GAP by supporting paragraph formats, tabulators and stacked text.

Furthermore the viewer will now try to locate and load TrueType fonts on the machine even if they are not supported by Java itself.

A Java internal bug meant that TrueType fonts were not always displayed in the correct size. This version tries to work around this bug.

V 2.00p81 [Wed May 6 11:57:27 CEST 2009]

Fixed a bug were static attributes (ATTDEF) were always displayed regardless of their visibility status.

Added Brasilian Portugese resources provided by Paulo Henrique de Medeiros. Thanks a lot!

V 2.00p80

not released.

V 2.00p79 [Thu Nov 27 15:47:08 CET 2008]

Improved picking support. Picking is now enabled by default (i. e. on new installations). If you are updating you may enable picking via the View tab in the Settings dialog (found in the Options menu).

V 2.00p78 [Fri Oct 17 16:04:15 CEST 2008]

Minor improvements when opening and saving files by adding file filters to restrict the choices.

V 2.00p77 [Mon Aug 11 18:50:14 CEST 2008]

This fixes a minor hatching bug.

V 2.00p76 [Fri Apr 11 15:24:24 CEST 2008]

This is mainly a bugfix release. The following issues are targeted:

V 2.00p75 [Tue Jan 1 19:29:29 CET 2008]

This fixes an error where texts were not displayed when the font location settings were empty.

V 2.00p74 [Sun Sep 30 20:46:03 CEST 2007]

I'm currently very busy with other things, but I discovered that using picking with Java 1.6 resulted in an IllegalArgumentException, so I fixed that at least. Picking is not enabled by default because it uses more memory.
Hopefully in about two months I'll have some time again to make more useful additions.

This also adds a switch to revert the reaction to mouse wheel rotation because somehow on Windows things usually get bigger when you turn the wheel away from you, while on Unix it's the other way round. To my feeling the Windows way is counter-intuitive, because I feel that when I drag something to me it shall become bigger, and smaller when I push it away (but it seems like Windows users seem to sit on their mouse). However: now you decide for yourself, while I can still have the "correct" feeling on both systems. Sorry that it only works after a restart, but I'm really much to busy for implementing this more smoothly (which was the reason I hesitated to release this earier although I wrote the code nearly half a year ago on a user request).

V 2.00p73 [Mon Mar 5 18:52:08 CET 2007]

Fixed a problem which kept settings in the print settings dialog from having a effect.

V 2.00p72 [Sun Nov 12 17:25:13 CET 2006]

Fixes a bug introduced in version 2.00p71 which kept horizontal and vertical lines from being drawn.

V 2.00p71 [Mon Nov 13 00:32:03 CET 2006]

Another bugfix release which adds slightly improvements in performance.

This release mainly addresses a problem when running the viewer with the upcoming Java 1.6 release which resulted in NoSuchMethods exceptions thrown in the conversion step of several (but not all) files. This is fixed now.

V 2.00p70

A bugfix and feature release.

On very rare occasions a POLYLINE was displaced completely. This is fixed.

In order to find the bug I had to implement picking (so I could pick on the incorrectly placed POLYLINE and see where it came from), and as a result the viewer now does allow picking, too. Because picking requires that the whole file is kept in memory it is switched off by default (so the viewer needs less memory). Please enable it in the view settings. It will not work at once (because the file is no longer available in memory) but for all files you load after that.

V 2.00p69

Another bugfix release:

Lines with a linetype scaling of zero were not displayed in former releases, but they are now.

V 2.00p68

Another bugfix release:

The viewer didn't like binary DXF written by recent AutoCAD versions. Binary DXF is a rarely used variety of DXF, which is usually in text format.

V 2.00p67

This is a bugfix release:

  1. Fixed some problems with special HATCH objects which resulted in incorrect rendering of these objects.
  2. Added the possibility to read incorrect DXF files where a floating point number is used at places where only integer numbers are acceptable.

V 2.00p66

Fixed problem with cached fonts not found.

Added internal debugging support.
Try to run with Java property debug.show.window set to true (i.e. -Ddebug.show.window=true).

V 2.00p65

This incorporates improvements for printing and PDF/Postscript save useful when handling bigger files. Printing and saving is done in a background thread and does no longer block the GUI.

V 2.00p64

Fixes -- once again (sigh) -- the bug which removed the history buttons from the 2d view toolbar.

V 2.00p63

Fixes the bug which removed the history buttons from the 2d view toolbar.

V 2.00p62

Fixes some problems which memory which is not released when a model view is closed.

V 2.00p61

Small changes:

V 2.00p60

Various minor improvements and a little bit of brush up for the new load mode introduced in p59.

V 2.00p59

Fixed i18n exception not allowing PDF and PostScript export.

Changed loading code so it's easier to load multiple files into one model. This will still need a little brush up.

V 2.00p58

Optimization is difficult. On some files reading became very slow as a result of the optimizations introduced in the previous version. This is fixed now.

V 2.00p57

This release adds a lot of improvements for drawing of large files. The achieved speed enhancements depend on the data contained in the DXF file, and they are mostly useful if the data contains lots of texts in TrueTypeFonts (TTF).

Usually the viewer draws TTF texts anti-aliased because they are better readable this way. But on some architectures anti-aliasing takes a lot of time. So now there's a possibility to switch off anti-aliasing but it's probably not necessary because there are some other optimizations which have a better effect. Here's some results from a 30 MByte DXF with 30000 texts (mostly TTF) and where info reports 1.1 million lines. The times are stopped on a Athlon XP 1600+ under Linux with an awful X setup which makes anti-aliasing very slow as you can easily notice.

Anti-Aliasingmin. Text HeightRedraw Time/s
ON031
off09.1
ON21.8
off21.8

When zooming into the model there is another optimization running in the background which does clipping of larger objects before they are dropped in the internal drawing routine which speds up drawing of the file used for the tests above (where it was always drawn completely) 5fold (from somewhat above 4.0 to 0.8 seconds).

Another improvement is for the reduced mode used during movements (eg rotation, panning, zooming). The reduced mode used until the previous version (now called static reduce mode) just draws every nth line. This gives useful results for standard files, but with large files something like every 100th line is drawn, which is good for an overview but does not leave much to be seen when zoomed deep into the model.

Now there's another reduced drawing mode called (guess what) dynamic reduce mode which tries to adapt to the number of objects really displayed.

You can set the reduce mode and other settings in the settings dialog.

V 2.00p56

Fixed problem with zoom indication rectangle missing in 3D view.

V 2.00p55

Another major reduce of jar file size by using proguard and by removing some duplicate entries introduced by ant's jar task:

Previous size:1,465,802 Bytes
Current size:896,509 Bytes
Difference (gain):569,293 Bytes

V 2.00p54

I used the time between Xmas and New Year's Eve to rearrange everything internally into clearly defined modules. For a mere user the only recognizable change is slightly reduced size of the jar file.

V 2.00p53

Fixed problem with too many spline fit points created.

V 2.00p52

Fixed problems which sometimes resulted in NullPointerExceptions.

V 2.00p51

Fixed ugly flickering during load.

Also added new versions of the starter scripts dv.cmd and dv.sh with special options which are helping the viewer loading files faster.

V 2.00p50

Added reduced drawing during mouse wheel usages.

Exchanged previous output routines for PS, PDF and SVG with optimized ones with improved speed and less memory footprint.

V 2.00p49

Fixed positioning of DIMENSION if it is offset in z direction.

V 2.00p48

Fixed NPE when codepage is undefined, and IllegalPathStateError on HATCH w/o boundary definition.

V 2.00p47

Fixed problem with unavailable codepage ANSI_869 when running Java 5 under Windows.

V 2.00p46

Enhanced AutoCAD 2004/2006 compatibility.

V 2.00p45

Fixes a problem with ARC entities where the start angle is the same as the end angle.

V 2.00p44

Cosmetic changes.

V 2.00p43

Fixes a class cast exception when adding a 3D file to a 2D view.

V 2.00p42

This release introduces some minor performance optimizations and fixes the following bugs:

V 2.00p41

This release only incorporates an internally refactoring needed for another project.

V 2.00p39

V 2.00p38

V 2.00p37

Added Recent Files feature.

V 2.00p36

Fixed bug resulting in sometimes incorrect HATCH placement.

V 2.00p35

Fixed bug resulting in sometimes incorrect 2D POLYLINE placement.

V 2.00p34

Fixed resource exceptions in PS/PDF output dialogs.

V 2.00p33

Added mnemonics and accelerators.

V 2.00p32

Fixed infinite loop with buggy DXF files.

V 2.00p31

Fixed memory problem with lines with too many dashes.

V 2.00p30

Fixed problem with underlined text in 3D view.

V 2.00p29

Added the possibility to always use the middle mouse button for panning which comes quite handy if ypu want to measure angles in the 2D view.

V 2.00p28

V 2.00p27

Added some bells and whistles for 2D rotation.

V 2.00p26

Fixed problem which resulted in line drawn to upper left corner of view window in rare circumstances.

V 2.00p25

Improved printing and vector format output by allowing floating point coordinates for these tasks.

V 2.00p24

Minor bug fixes.

V 2.00p23

Minor bug fixes.

V 2.00p22

Added rotation for 2D files.

V 2.00p21

Fixed various line type problems.

V 2.00p20

More drawing optimizations.

V 2.00p19

This release fixes a bug where the viewer allocates more and more memory on each redraw which occured in rare circumstances introduced in version 2.00p17 (not publically released).

V 2.00p18

This release adds support for the LEADER entity, fixed a problem with rotated MTEXT and includes first steps on improved drawing routines (15% faster).

V 2.00p16

This release fixes some problems with the placement of the model in PostScript and PDF export.

V 2.00p15

This was the first official preview. It was released on July 6, 2005, to celebrate the European Parliament's decision against software patents.