viewhack

DXF viewer: see a CAD drawing, its layers and its size

Open a .dxf without installing a CAD program: a laser or CNC part, a floor plan from an architect, sign vinyl, a part from a supplier's website. You see the drawing, fit to the screen, every layer with its colour and how many entities it holds, the width and height in the file's own units, and which AutoCAD version wrote it.

The file is read on your device. It is not uploaded, and nothing in it is fetched or run.

What it shows

The number that goes wrong most: units

A DXF stores bare numbers. A line from 0 to 100 is 100 “drawing units”, and only the header variable $INSUNITS says whether that means 100 mm or 100 inches. Many programs leave it at 0 (unitless), and then the laser software, the CNC post-processor or the print shop guesses. Guessing inches for a part drawn in millimetres makes it 25.4 times too big: a 100 mm bracket becomes 2,540 mm, and the job is refused or quoted for a sheet two metres wide. Guessing millimetres for an inch drawing makes a 4-inch part 4 mm long.

This page shows the unit the file declares, or says plainly that it declares none (and, if it is there, what $MEASUREMENT says: metric or imperial). If the width shown is 25.4 times what you expected, the drawing is in the other unit. Check this before you send a file to be cut.

How a polyline stores an arc: a worked example

A rounded corner in an LWPOLYLINE is not an arc entity. It is two vertices and a bulge on the first: the tangent of a quarter of the arc's included angle, positive when the arc turns counter-clockwise. A 90-degree fillet has a bulge of tan(22.5°) = 0.41421.

Take the corner of the sample drawing, from (114, 0) to (120, 6). The chord is √(6² + 6²) = 8.485 mm. The arc bulges out from the chord's midpoint (117, 3) by bulge × chord ÷ 2 = 0.41421 × 8.485 ÷ 2 = 1.757 mm, to (118.243, 1.757). The radius is chord × (1 + bulge²) ÷ (4 × bulge) = 8.485 × 1.17157 ÷ 1.65685 = 6.000 mm. A viewer that ignores bulges draws a straight chamfer there instead of a 6 mm radius; this page draws the arc, and its test checks the arc's midpoint against this hand calculation.

Files it opens

ASCII DXF, any version
From AutoCAD R12 (AC1009, still the version many laser and CNC programs write because everything reads it) to AutoCAD 2018 and later (AC1032). The reader was written for this page from Autodesk's DXF Reference, with no CAD library. Line ends can be CR LF or LF, and group codes may carry leading spaces.
Binary DXF
The rarer binary form, which starts with “AutoCAD Binary DXF”: both the R12 layout and the R13 and later one are read.
Text in other languages
DXFs from AutoCAD 2007 on are UTF-8. Older ones are in the Windows code page named in $DWGCODEPAGE (ANSI_1252 for Western Europe, ANSI_1251 for Cyrillic, ANSI_932 for Japanese), and are read in that code page; \U+0416-style escapes are turned into their characters.
DWG files
Recognised from their first bytes (AC1015, AC1032 and so on) and refused by name. DWG is AutoCAD's own closed format, and the free programs that read it (LibreDWG, and LibreCAD, which uses it) are GPL-licensed, so viewhack does not include them. The free ODA File Converter (Windows, macOS, Linux) or LibreCAD can save a DWG as DXF, and that DXF opens here.

What this cannot do