DXF Viewer & CAD Viewer

DXF Viewer & CAD Viewer for 2D Drawings, a VS Code extension by Zovo

Open .dxf drawings in VS Code and check sheets, layers, sizes and distances without leaving the editor or starting a CAD program.

Install in VS CodeOpen the Marketplace page

Free, MIT license. Needs VS Code 1.90.0 or newer. Extension ID zovo.dxf-viewer, version 0.2.1.

DXF Viewer showing the A-101 paper space sheet with its title block and a 1:100 viewport of the floor plan

Screenshot of VS Code 1.142 with house-sheets.dxf made by scripts/make_sheet_sample.py.

Quick start

  1. Install DXF Viewer & CAD Viewer for 2D Drawings.
  2. Click a .dxf file in the Explorer.

Questions people ask

Is DXF Viewer & CAD Viewer free?

Yes. DXF Viewer & CAD Viewer is free and MIT licensed.

How do I install DXF Viewer & CAD Viewer?

Click "Install in VS Code" above, or search for zovo.dxf-viewer in the Extensions view.

What you can do

ActionHow
Switch sheetPick Model or a layout in the Sheet list. Only drawings with paper space show the list
Find textType in Find text, or press Ctrl+F (Cmd+F). Enter goes to the next match and Shift+Enter to the one before. It searches the sheet on screen and skips hidden layers
PanDrag with the mouse, or use the arrow keys
ZoomScroll at the point you want, or the + and − buttons
Fit the drawingFit button, F, or a double-click
Hide a layerUntick it in the Layers panel. All and None switch every layer
MeasureMeasure button or M, then click two points. You get the distance in the drawing units, ΔX, ΔY and the angle. Copy puts the line on the clipboard
BackgroundDark like most CAD programs, or white like a printed sheet (B)
ExportExport PNG saves the view at twice the screen resolution. Export SVG saves the visible layers as paths and text
DXF Viewer showing a floor plan in model space with the layers panel, entity counts and the drawing
Find text: the tag V-7, a block attribute, found and framed in the floor plan
Measuring the outer wall of the sample floor plan

The side panel lists the layers with their colour and entity count, a table of entity types (model space and inside blocks), and the drawing facts. These are ASCII or binary, the DXF version, units, size and block count. Layers that are off or frozen in the file start hidden.

A binary DXF mechanical part with blocks, a spline, an ellipse, dashed centre lines and dimensions

What gets drawn

LINE, CIRCLE, ARC, ELLIPSE, LWPOLYLINE and POLYLINE (bulges too), SPLINE, POINT, SOLID, TRACE, 3DFACE, HATCH, TEXT, MTEXT, ATTRIB, INSERT with arrays and nested blocks, DIMENSION, LEADER and VIEWPORT. Dimensions use the block the CAD program saved with them, and when it's missing the viewer draws them from their definition points.

Pattern hatches use the pattern lines stored in the DXF file, with their angle, spacing and dashes. When you zoom out so far that the lines would sit less than 2 pixels apart, the hatch shows as a light tint until you zoom in again. A pattern with more than 4,000 lines in one hatch also shows as a tint, and the panel says so.

Paper space sheets come from the LAYOUT objects in the file, in their tab order. Each viewport shows model space at its own scale and twist, clipped to its frame, without the layers it freezes. Files with paper space but no layout list (R12) get one sheet.

Colours follow the layer, the block or the entity (ACI and true colour). Dashed and centre linetypes come from the file. Other entity types, such as 3DSOLID, IMAGE or XLINE, are counted in the table and marked as not drawn.

DWG files

DWG isn't supported. It's a closed binary format with no permissively licensed reader. When you click a .dwg file, DXF Viewer shows a short page with the DWG version and how to get a DXF copy.

If you use another extension for DWG files, the page has a button to reopen the file with it.

The DWG page with the version and the DXF export steps
The A-501 detail sheet: a 1:25 viewport with the furniture layer frozen and a key plan viewport, next to pattern hatches

Big files

The file is read in a worker thread, so VS Code stays responsive while it loads. A 24 MB drawing with 600,000 lines is read in about one second. Files over 500 MB show a message and are not read (setting dxfViewer.maxFileMB, up to 2048).

Settings

SettingDefaultWhat it does
dxfViewer.maxFileMB500Largest file to read.
dxfViewer.backgroundautoBackground when a file opens. auto follows the VS Code theme.
dxfViewer.liveReloadtrueRead the drawing again when the file changes on disk.
dxfViewer.askForRatingtrueAsk one time for a rating after a few days of use.

Privacy

DXF Viewer makes no network calls and sends no telemetry. The webview runs under a strict Content Security Policy, and text from the drawing is drawn as text, never as HTML. The only file it writes is an export you pick in the save dialog, and it refuses to write over a drawing.

Limits

License

MIT. DXF Viewer uses no third-party runtime code. The DXF reader, the renderer and the sample drawings were written for this extension.

Install DXF Viewer & CAD Viewer

Click the button to open VS Code and install it, or press Ctrl+P (Cmd+P on macOS) in VS Code and run ext install zovo.dxf-viewer.

Free, MIT license. Needs VS Code 1.90.0 or newer. Extension ID zovo.dxf-viewer, version 0.2.1.

Source code and issues are on GitHub.

All our VS Code extensions

Support this work

If this extension saves you time, you can support the work on GitHub Sponsors. Monthly tiers start at $5, and one-time tiers start at $15. Sponsorship is optional, and the tool works the same without it.