Skip to content

About

Fast, offline-first DXF viewer for Windows - WinUI 3 + Win2D, hand-written parser, layers, measuring and self-contained HTML export. No cloud, no account.

Topics

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

📐 SimpleCadViewer

A fast, offline-first DXF viewer for Windows — built with WinUI 3 and Win2D.

Open, inspect, measure and annotate DXF drawings entirely on your machine. No account, no cloud, no telemetry — your drawings never leave this computer.

.NET WinUI 3 Windows License: MIT Latest Release

⬇ Download · ✨ Features · 🛠 Build it · 🗺 Roadmap · 🤝 Contributing


🚀 Try It Now

No installer, no admin rights, no dependencies — just unzip and run:

  1. Download the latest portable release (SimpleCadViewer-vX.Y.Z-win-x64.zip)
  2. Extract the zip anywhere
  3. Run SimpleCadViewer.exe

You can also drag a .dxf file onto SimpleCadViewer.exe, or launch it from a terminal:

.\SimpleCadViewer.exe "C:\drawings\part-0042.dxf"

Requires Windows 10 (17763+) or Windows 11, x64. The app is fully self-contained — it ships its own .NET and Windows App SDK runtimes.

SimpleCadViewer showing an apartment floor plan with the layers panel, inspector and measurement status bar


✨ Features

  • True offline DXF parsing — ASCII and binary DXF (R12 → R2018+) parsed by a hand-written parser, entirely on this machine. DWG files are detected and explained with conversion guidance.
  • GPU-accelerated canvas — Win2D rendering with smooth pan, wheel zoom at the pointer, adaptive 1-2-5 grid and line-weight/dashed-linetype fidelity.
  • Layers — searchable panel with per-layer visibility, color swatches, state hints (frozen/locked), global All/None toggles and layer opacity.
  • Inspector — click any entity for its geometry: endpoints, radii, angles, areas, lengths and more, in drawing units.
  • Measure — two-click distance measurement with live amber readout, unlimited saved measurements in the inspector.
  • Select & erase — smallest-bounds-wins hit testing, multi-select with Shift+click, erase with full undo.
  • Object snap — endpoint, midpoint, center and quadrant snapping that stays correct under any pan/zoom transform.
  • Self-contained HTML export — one portable .html file with the drawing and a lightweight viewer embedded: anyone can open it offline in any browser, with pan/zoom, layer toggling and measuring included. No CAD app needed on their side.
  • PNG snapshot — export the current view straight to an image file.
  • Bundled samples — apartment floor plan, mechanical base plate with hatching and a site plan with splines, ready to explore from the welcome screen.
  • Theme aware — Light / Dark / System, with the DXF color palette (ACI 7) flipping white↔near-black so drawings stay readable in both themes.

🏗 Architecture & Technology Stack

Layer Technology
UI framework WinUI 3 (Windows App SDK), MVU-lite code-behind
Rendering Win2D (CanvasControl) via a dedicated canvas controller
DXF parsing Hand-written C# parser (Cad/Dxf/) — ASCII + binary, AC1015/AC1027 and friends
Geometry engine NURBS (de Boor), bulge arcs, arbitrary-axis OCS, hatch pattern synthesis
Export Self-contained HTML writer (embedded JSON + vanilla-JS viewer), PNG via Win2D
Persistence Newtonsoft.Json settings/recent files under %LOCALAPPDATA%\SimpleCadViewer
SimpleCadViewer/
├── Cad/
│   ├── Dxf/            # DxfReader, DxfDocument, DxfEntities, DxfGeometry, DxfColor (full ACI palette)
│   ├── Rendering/      # GeometryBuilder (entity flattening), CadCanvasController (Win2D pan/zoom/hit-test)
│   └── HtmlExporter.cs # One-file interactive HTML export
├── Dialogs/            # Export dialog, Settings dialog
├── Services/           # AppData, AppSettings, RecentFilesService, SessionLogger, ThemeHelper, SampleLibrary
├── ViewModels/         # Layer list, entity inspector
└── Assets/Samples/     # Three bundled DXF sample drawings

The parser builds a document model (HEADER/TABLES/BLOCKS/ENTITIES, INSERT→ATTRIB chains, POLYLINE→VERTEX chains); GeometryBuilder flattens it into render-ready stroke/fill/text entities (resolving block inserts, BYBLOCK color and layer-0-inherits-insert semantics); the canvas controller renders and hit-tests that flat list. Roughly 12,000 entities parse and flatten in ~100 ms.

💻 Building from Source

Prerequisites

  • Windows 10 17763+ / Windows 11
  • .NET 8 SDK
  • Windows App SDK — restored automatically by NuGet
git clone https://github.com/uponatime2019/SimpleCadViewer.git
cd SimpleCadViewer

# build
dotnet build SimpleCadViewer.csproj -p:Platform=x64

# run
dotnet run --project SimpleCadViewer.csproj -p:Platform=x64

Or open SimpleCadViewer.sln in Visual Studio 2022 and press F5.

⌨️ Controls & Shortcuts

Mouse

Action Control
Pan Left-drag or middle-drag on canvas
Zoom Mouse wheel (zooms at pointer)
Select Click · Shift+click adds to selection
Measure M, then click two points

Keyboard

Shortcut Action
Ctrl+O Open drawing
Ctrl+N New blank drawing
Ctrl+E Export self-contained HTML viewer
F Zoom to extents
Ctrl + + / − Zoom in / out
↑ ↓ ← → Pan
M Toggle measure tool
Esc Cancel measure / clear active state
Delete Erase selected entities
Ctrl+Z Undo erase

🗺 Roadmap

  • DWG read support (via an open-source converter integration)
  • Paper-space layouts & viewports
  • Dimension entities rendered natively from DIMSTYLE
  • Annotation: add text and dimensions to a drawing
  • Redline markup layer with save-back to DXF
  • SVG and PDF export
  • Multi-document tabs
  • Compare two revisions of a drawing with highlight diff
  • ARM64 and x86 portable builds
  • Installer (MSIX) alongside the portable zip
  • Dark-canvas auto contrast per layer color

🤝 Contributing & Community Welcome

Contributions are very welcome — this is a young project with a clear roadmap, and there's a lot of fun engineering here for CAD, parsing, geometry and WinUI enthusiasts alike!

Ways to help, no contribution too small:

  • 🐛 Report bugs — open an issue with the DXF file (or a reduced version) and what you expected vs. saw. Parser edge cases are gold — real-world DXF files are gloriously messy.
  • 💡 Suggest features — propose anything, or pick an unchecked roadmap item and claim it.
  • 🔧 Submit pull requests — fork, create a feature branch (feat/dwg-preview, fix/hatch-edge-case…), keep the code style close to the surrounding code, and open a PR describing what and why. Small PRs land fastest.
  • 📁 Donate test drawings — DXF files that exercise weird entities, unusual linetypes or exotic codepages make the parser better for everyone.
  • 💬 Join discussions — questions about the codebase, the DXF format or WinUI 3 are welcome in Discussions.

If you find this project useful, a ⭐ on the repo helps others discover it!

🙏 Acknowledgements

  • Concept and UX inspired by the excellent open-source web viewer mlightcad/cad-viewer.
  • ACI color palette derived from the ezdxf project.

📄 License

Released under the MIT License — free for personal and commercial use.

SimpleCadViewer — your drawings stay on your machine.

About

Fast, offline-first DXF viewer for Windows - WinUI 3 + Win2D, hand-written parser, layers, measuring and self-contained HTML export. No cloud, no account.

Topics

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages