Why a DXF opens at the wrong scale, and how to fix it
The part is 100 millimetres wide and the laser software says 2,540, or 3.94. The drawing is not damaged and nothing was rescaled by accident. A DXF holds bare numbers, and the program that opened it had to decide what one unit means.
Written · Updated
A DXF records coordinates as plain numbers with no unit attached. The unit is stated, if at all, in one header variable, $INSUNITS: 1 is inches, 4 is millimetres, 0 is "unitless". Many programs ignore it when they open a file, older R12 files cannot contain it, and plenty of exporters leave it at a default that does not match the drawing. When the receiving program guesses differently from the one that wrote the file, the drawing arrives off by the ratio between the two units, which is 25.4 for inches and millimetres. The fix is to find out what the numbers really are, and then either tell the receiving program or correct the header. Both can be done free in a text editor; Foundry, the 2D half of the Engineering Suite, does it with a menu.
Recognise the number
Measure one feature whose real size you know, and divide what the software shows by what it should be.
| Off by | What happened |
|---|---|
| 25.4 too big | Drawn in inches, read as millimetres |
| 25.4 too small | Drawn in millimetres, read as inches |
| 10 or 1000 | Centimetres or metres against millimetres; common from architectural drawings |
| 12 | Feet against inches |
| Anything else | A drawing scale, not a unit: it was drawn at 1:2 or 1:50, or exported from a scaled view |
Read what the file says
An ASCII DXF is a text file of pairs of lines: a group code, then a value. Open a copy in Notepad or TextEdit and search for $INSUNITS. You will find it in the HEADER section, like this:
9
$INSUNITS
70
1
The last line is the answer. The values that matter are 0 (unitless), 1 (inches), 2 (feet), 4 (millimetres), 5 (centimetres) and 6 (metres); the full list runs to 20 and includes microns (13), which is how chip and MEMS layouts are drawn.
If there is no $INSUNITS at all, look for $ACADVER. A value of AC1009 is an R12 DXF, the oldest format still in common use and the one many laser, CNC and CAM programs write because every reader accepts it. $INSUNITS arrived with AutoCAD 2000, so an R12 file has no way to state its units: the receiving program always guesses.
There is also $MEASUREMENT, 0 for imperial and 1 for metric. It chooses which hatch and linetype patterns apply, and some programs fall back on it for the unit; it is a hint, not a statement.
Fix it free
- If the receiving program asks for the unit on import, tell it what the numbers really are. Many laser, CAM and vector programs have a units choice or a scale factor in their DXF import dialogue. This fixes it without touching the file.
- If the header is wrong, change the value after
$INSUNITSand70in a copy of the file and save it as plain text. A millimetre drawing labelled 1 becomes correct when the 1 becomes 4. This only helps programs that read$INSUNITS, which not all do on opening. - If there is no header value, the receiving program's own setting decides. Set it to match the drawing, or scale by the factor in the table above after import.
Whichever route you take, measure the known feature again afterwards. That one check is worth more than anything the header says.
What Foundry does with it
Foundry reads $INSUNITS when it opens a DXF, converts the file's units into the drawing's, and says which units it opened in. If the file states none, or states "unitless", it says so rather than guessing quietly: The file does not say its units; it is shown as it stands.
For a file whose header is wrong, File → Drawing settings → Units changes what the numbers mean without moving anything, so a 100-wide plate labelled inches becomes a 100 mm plate. File → Export DXF then writes the file back with $INSUNITS set to match. If the geometry itself was drawn at the wrong size, the Scale command (SC) scales it by a typed factor such as 25.4.
We checked this on a 100 × 50 plate with a hole in it, written as an AutoCAD 2000 DXF whose header said inches. Foundry opened it as 100 × 50 inches, as the header told it to. Changing the drawing's units to millimetres kept every coordinate where it was, and the exported DXF said $INSUNITS 4. Writing this also found that Foundry did not know three of the documented unit codes, angstroms, nanometres and microns, and opened a micron drawing a thousand times too large while reporting that the file stated no units. It knows them now.
One thing to be straight about: Foundry writes R12 DXF, because every program reads it, and adds $INSUNITS to the header. A program that reads the variable gets the unit; one that treats the file strictly as R12 ignores it and guesses, like any other R12 file. Measure after import.
Foundry is part of the Engineering Suite, which is part of OBSCURA Pro; everything above it on this page is free and needs nothing but a text editor.
Questions people ask about Why a DXF opens at the wrong scale, and how to fix it
Why does my DXF open at the wrong scale?
Because a DXF stores bare numbers and the program opening it has to decide what one unit means. The unit is stated only in the optional $INSUNITS header variable, which many programs ignore when opening a file and older R12 files cannot contain. If the program's guess differs from the drawing's real unit, the drawing is off by the ratio, usually 25.4.
What does $INSUNITS mean in a DXF file?
It is the header variable that states the drawing's units: 0 unitless, 1 inches, 2 feet, 4 millimetres, 5 centimetres, 6 metres, 13 microns, among others up to 20. It appears in the HEADER section as $INSUNITS, then 70, then the number.
Why is my DXF 25.4 times too big or too small?
25.4 is the number of millimetres in an inch. Too big means a drawing made in inches was read as millimetres; too small means millimetres read as inches.
How do I change the units of a DXF file?
In a copy of the file, find $INSUNITS in the header and change the number after the 70 line, for example 1 (inches) to 4 (millimetres), then save it as plain text. Or tell the receiving program the unit in its import settings. In Foundry, Drawing settings changes the units without moving anything and Export DXF writes the header to match.
Does an R12 DXF store units?
No. $INSUNITS was added with AutoCAD 2000, so an R12 (AC1009) file cannot state its units and the receiving program always decides. Many laser and CNC programs write R12 because every reader accepts it.
What is the difference between $INSUNITS and $MEASUREMENT?
$INSUNITS states the drawing's unit. $MEASUREMENT only says imperial (0) or metric (1), which chooses hatch and linetype patterns; some programs use it as a fallback for the unit, but it is a hint rather than a statement.
My DXF is off by a factor that is not 25.4. Why?
A factor of 10 or 1000 is centimetres or metres against millimetres, and 12 is feet against inches. Any other factor is usually a drawing scale rather than a unit: the drawing was made at 1:2 or 1:50, or exported from a scaled view.
Can I fix a DXF's scale without CAD software?
Yes. An ASCII DXF is text: change $INSUNITS in a text editor, or set the unit in the receiving program's import dialogue. Then measure one feature whose size you know to confirm it.
Related
- Foundry2D drawings: DXF in and out, printed to scale
- Engineering Suite3D parts, and STL, OBJ and 3MF out
- Why an STL is the wrong size in the slicerThe same problem in 3D, where the file cannot say at all
- The units that are two different units with one nameTwo gallons, three tons
- Why a printed page comes out smaller than actual sizeThe same question on paper
- Opening a file without the software that made itMost files that will not open are a container your machine has no reader for. HEIC, .msg, winmail.dat, Word, Excel, zips and CSVs, opened in the browser tab.
- Why your .docx opens as XMLA Word file is a zip of XML, so the markup is not itself a fault. Four different problems look like this and their fixes have nothing in common, starting with whether the file is a Word document at all…
- Why your CSV opens in one columnA CSV does not record its own separator, so Excel guesses from a Windows regional setting rather than from the file.
- How to open a HEIC fileA photograph in a container most software cannot open: what the box is, what is inside it, and how to get a JPEG out without uploading it.
- Open a Word document without Word, without uploading itA .docx is a zip of XML a browser can read. Open it, change it, and save it back as Word or as PDF in the tab; what comes across, and what does not.
- Open an Excel file without Excel, without uploading itAn .xlsx is a zip of XML a browser can read in the tab. What comes across (sheets, values, formulas, formats), what does not (charts, macros, pivot tables), and how to save it back.
All 14 guides under “A file that will not open, or comes out wrong”.
A letter, now and then
An occasional letter when there is something worth reading: the new guides and what changed in the tools. Never more than once a month and nothing else, and you can leave at any time on the unsubscribe page.