DGN viewer: open a MicroStation V7 drawing and save it as SVG
Open a .dgn without MicroStation: a road or rail plan from a highways agency, a survey from a contractor, an old site drawing from an archive. You see the drawing in the file's own colours, every level with a switch to hide it, the units and global origin, and you can save it as SVG or PNG.
The file is read on your device. It is not uploaded, and nothing in it is fetched or run.
What it shows
- The drawing. Fit to the screen; drag to move, pinch or scroll to zoom, double-click (or Fit) to see all of it again. Lines, line strings, shapes (filled when the file gives them a fill colour), complex chains and complex shapes, arcs, ellipses and circles, curves, point strings, text and text nodes at the height, width and angle stored in the file, and cells, drawn from the copy of their parts that every placed V7 cell carries.
- The file's own colours. Each element's colour number (0 to 255) is looked up in the colour table stored in the drawing, or in MicroStation's default table when there is none. MicroStation draws on black, so colour 0 is white: on a light page white and pale yellow lines are darkened to stay visible, and the “Black background” button shows the drawing the way MicroStation does. Line weights 0 to 31 are drawn thicker as they grow, and the eight standard line styles as dash patterns.
- Levels. Every level used (V7 has 63, numbered 1 to 63) with how many elements sit on it and a switch to hide or show it. The SVG you save holds only the levels that are on.
- Units and position. The master and sub-unit names (for example “m” and “mm”, or “ft” and “in”), how many sub-units make a master unit, how many UORs make a sub-unit, the global origin, and the extents of what is drawn, all in master units. For a 3D file, the z range too.
- What is in it. Element counts by type (Line, Shape, Arc, Text, Cell…), the cell names, the names of any reference files attached, deleted elements skipped, and a plain list of anything not drawn, such as B-spline curves or dimensions.
- Export. Save as SVG: the visible levels, one SVG group per level, with 1 SVG unit = 1 master unit, so the drawing keeps its scale in Inkscape or Illustrator. Save as PNG: the whole drawing, 3,000 pixels on its longer side.
How a V7 file stores a position: a worked example
A V7 design file does not store metres or feet. Every coordinate is a whole number of UORs (units of resolution), a 32-bit integer, and the file header says how UORs turn into real units: how many sub-units make one master unit (at byte 1112) and how many UORs make one sub-unit (at byte 1116).
Take smalltest.dgn, the sample file in GDAL's test suite. Its header gives 10 sub-units (“su”) per master unit (“mu”) and 1,000 UORs per sub-unit, so 10,000 UORs per master unit. Its text element “Demo Text” stores its origin as x = 7,365 and y = 42,198 UORs: that is 0.7365 and 4.2198 master units. Its height is stored as 1,666,667, a number in steps of 6/1,000 of a UOR: 1,666,667 × 6 ÷ 1,000 = 10,000 UORs (to the nearest UOR), which is 1 master unit. This page reads those same numbers, and its test checks them.
The 32-bit integer is also why V7 drawings have a size limit: the whole design plane is 232 = 4,294,967,296 UORs across. At 1,000 UORs per metre that is about 4,295 km, enough for a country; at 100,000 UORs per metre (0.01 mm resolution) it is only 42.9 km, and a long road scheme can run off the edge. Moving that edge is what the global origin is for.
V7 or V8? Telling them apart
- MicroStation V7 (this page opens it)
- The format of MicroStation/J and earlier versions, back to Intergraph's IGDS. It starts with the type-9 design file header: bytes
08 09 FE 02for a 2D file,C8 09 FE 02for 3D. Some highway, rail and survey offices still hand out V7 files, because so many programs read it. - MicroStation V8, XM, V8i and CONNECT (not opened here)
- Since MicroStation V8 in 2001 the .dgn name holds a different format: an OLE compound file, starting
D0 CF 11 E0, the container old Word and Excel files use. viewhack recognises it and says so. Bentley View (free, Windows) opens and prints V8 files, and QGIS opens them as map layers in builds that include GDAL's DGNv8 driver (it needs the ODA libraries, which not every QGIS download has). MicroStation itself can save a copy as V7, which opens here.
What this cannot do
- Open MicroStation V8 or later files. They are a different format inside an OLE container; see above. This page never claims to read them.
- Load reference files. A drawing that attaches other .dgn files as references shows only its own elements; the attached file names are listed if the file names them, but those files are separate and are not loaded.
- Show raster attachments. Scanned maps and aerial photos attached to a drawing are counted, not shown.
- Draw custom line styles or fonts. Lines are solid or one of the eight standard dash patterns, with weight shown as thickness; custom line styles from a resource file are drawn plain. Text is drawn in a generic font stretched to the width the file stores, not in MicroStation's own fonts.
- Draw everything. B-spline curves and surfaces, cones, 3D surfaces and solids, dimensions, multi-lines, shared cells and tags are counted and listed as not drawn. Curves are drawn as straight segments through their points.
- Show 3D. A 3D file is drawn in plan: seen from straight above, with z dropped. The page says so above the drawing.
- Edit. It only reads, and saves an SVG or PNG copy; the .dgn itself is never changed.