Millimetres vs Inches: Fixing Unit Mismatches in Gerber Files

There is a particular kind of wrong that only unit errors produce. The board shape is perfect. The proportions are perfect. Every feature is exactly where it belongs relative to every other feature — and the board is twenty-five times too large, or so small it hides under a single pad of the board you expected. If you meet that presentation in Gerbv, do not troubleshoot the geometry. Troubleshoot the units. A millimetre-versus-inch mismatch is the cleanest bug in fabrication data: one declaration, read the other way, scales the entire file by 25.4. This guide shows how to recognise the signature at a glance, where RS-274X files declare their units, why drill files fail in a companion way, and how to re-export so the whole set speaks one system. Measurement technique is covered in measure distances in Gerbv, and current builds are on the download page.

How a 25.4-times error looks in the viewer

Load a millimetre file under inch assumptions — or the reverse — and one of two scenes appears. In one, the board erupts past the window: a single corner, a few enormous traces and pads the size of dinner plates fill the view, because you are looking at a small region of a board drawn twenty-five times too big. In the other, the canvas looks empty at normal zoom, and only zooming far out or fitting the view reveals a miniature board, complete and correctly proportioned, sitting near the origin. Both scenes share the diagnostic gift of unit errors: relative measurements stay right while absolute ones are impossible. A footprint’s pads remain in the correct ratio to each other; the board outline remains the correct shape. The moment a measured dimension — check the outline against your known board size first — comes back at 25.4 times, or one twenty-fifth of, the intended value, you have the cause. Factors of ten alongside it suggest a coordinate-format problem as well, which the Excellon fixes guide treats for drill data.

Where units are declared in RS-274X

RS-274X files are self-describing in a way the older RS-274D format was not: the file itself carries parameter commands, set off by percent signs, near its head. The unit declaration is one of them — the MO (mode) parameter, written as %MOMM*% for millimetres or %MOIN*% for inches. Nearby, the format specification declares the coordinate digit layout used by the numbers that follow. You do not need to edit these by hand — you should not — but being able to open a Gerber file in a text editor and read its head tells you in seconds what the exporting tool actually declared, as opposed to what its dialog claimed. If the declaration says inches for a board you design in millimetres, the export preset is lying to you, and every downstream reader that trusts the file, Gerbv included, will draw the board at inch scale. Trust the file, then fix the preset.

Why the drill file often disagrees alone

A common partial version spares the Gerber layers and strikes only the drill data. Gerber and drill exports are separate operations in most CAD tools, often with separate unit settings on separate dialogs. Set millimetres on the Gerber page and forget the drill page, and the copper arrives correct while the holes arrive scaled or offset relative to it — positions right in shape, wrong in size or placement in exactly the patterns the drill guide describes. The lesson generalises: units are a per-output setting, not a project property, and a unit audit that only checks one output checks nothing. In Gerbv, the fastest audit is comparative: measure a known copper dimension, then a known drill dimension, and confirm both read true in the same session, overlaid as in load and align Gerber layers.

Stepwise fix

  1. Measure the outline. Compare it with the intended board size. A ratio of about 25.4, in either direction, confirms a unit mismatch.
  2. Read the file head. In a text editor, find the %MO..*% declaration in the Gerber file and note what it actually says.
  3. Check every output. Inspect the Gerber layers and the Excellon drill file separately — find which outputs declare which units.
  4. Fix the preset, not the file. In your CAD tool, set one unit system for all fabrication outputs, Gerber and drill, and save it in the preset.
  5. Re-export and re-measure. Reload the fresh set in Gerbv and repeat the outline measurement before any other inspection.

Which unit should you export in?

Either — consistently. Board houses work in both systems, and RS-274X carries the declaration with the data, so a correctly declared inch file is not inferior to a millimetre file. The failures come from mixture and misdeclaration, never from the choice itself. Pick the system your design is native to, so the numbers you verify in the viewer are the numbers you think in, declare it on every output, and write it in the fabrication notes that travel with the set. If you inherit someone else’s files, read their declarations before assuming: a stranger’s inch board measured with millimetre expectations generates a support conversation that one look at %MOIN*% would have ended.

Prevention

Make units part of the pre-send ritual: one measured outline dimension, read against intent, on every set, every time. It takes seconds, it catches the entire family of unit and format scaling errors regardless of which output carries them, and it is the single highest-value measurement in this guide’s sibling, the measurement tutorial. A board that measures true at the outline can still have other problems — but it does not have this one.

Frequently asked questions

How can I tell a unit mismatch from other scaling problems?

Measure a dimension you know, such as the board outline. A ratio of about 25.4 to the intended value is the millimetre/inch signature. Relative proportions stay correct in a unit mismatch, which distinguishes it from a distorted or corrupt file.

Where do I check which unit a Gerber file uses?

Open the file in a text editor and read the parameter block at its head: the declaration appears as %MOMM*% for millimetres or %MOIN*% for inches. That declaration is what viewers, Gerbv included, honour.

Should I edit the unit declaration in the file by hand?

No. Fix the export preset in your CAD tool so every output — Gerber layers and the drill file — uses one declared unit system, then re-export the complete set and re-measure the outline in Gerbv.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *