ondreu81 downloadsSimple light DXF viewer and editor, capable of measuring lenght, area, diameter, angles, and more. Aswell as simple editing like lines, polylines, rectangles, circles, elipses, arcs, fill, hatches...
View and lightly edit .dxf CAD drawings directly inside Obsidian — as full
file views and as embeds in your notes — on desktop and mobile.
This is v1: DXF only. DWG is intentionally out of scope (see design doc §2).
⚠️ Early release. Editing is limited and the round-trip fidelity of saved files is still being hardened across CAD sources. Keep backups of important drawings before editing.
.dxf in the file explorer to open it in a tab,
the same way the built-in PDF viewer works..dxf and open it straight in
the editor; also available as the Create new DXF drawing command.![[drawing.dxf]] renders a read-only viewer inline.XLINE or a semi-infinite RAY — guides you can snap other geometry to,
especially at their intersections), polyline, rectangle, regular polygon
(any side count), text, a linear dimension, and fill/hatch. Drawn geometry
becomes real DXF entities written back to the file on save. Lines and
polylines get a soft angle assist near 0/90/180/270°; an Ortho toggle in
the top bar hard-locks to those angles, and pressing Enter after the start
point lets you type an exact angle and length instead of clicking. Text is
rendered from a built-in vector stroke font, so it stays crisp at any
zoom or entity scale instead of pixelating like a raster texture would
(lowercase reuses the uppercase letterforms).LINE, CIRCLE, ARC, ELLIPSE, LWPOLYLINE, HATCH,
TEXT, XLINE and RAY entities, with undo/redo.Ctrl/Cmd+click to add entities to the selection; drag a
box over empty space for a CAD-style window/crossing rubber-band select
(left-to-right catches only fully-enclosed entities, right-to-left catches
anything the box touches); move, copy, rotate, scale, mirror, delete or
recolour them all at once. A select-similar tool picks every entity
sharing the clicked one's type and layer; a layer isolate toggle hides
everything else (purely a view state — never touches the saved file or the
undo stack). Select and select-similar sit in their own always-visible
cluster next to the ribbon tabs, and a tool stickiness setting controls
whether a tool stays active after finishing an action or snaps back to
Select automatically (AutoCAD-modify-command style).HATCH entity (uses the
active layer/colour); Hatch fills the same kinds of region with parallel
lines (real LINE entities clipped to the boundary), prompting for line
spacing (scale) and angle. Both use the active layer/colour like every other
draw tool. A drawing's own pre-existing HATCH entities (pattern fills,
multiple loops, islands) are far more varied than v1 attempts to parse, so
they still round-trip as an unsupported placeholder, same as before.LINE/LWPOLYLINE/TEXT entities, not a parametric DXF DIMENSION) so it
renders identically everywhere and stays editable with the ordinary tools.LAYER table on save.(0,0,-1) normals) and
nested/array block INSERTs are transformed to world coordinates, so holes and
sub-parts land where AutoCAD puts them.SPLINE, real DIMENSION, a loaded file's own pattern
HATCH, …) is preserved on save and shown as an unsupported placeholder,
never silently discarded.Esc cancels the current tool operation, Enter finishes a
polyline (C closes it) or, mid-line, opens a prompt to type an exact
angle/length instead of clicking the end point; arrow keys nudge a
selection, Delete removes it, Ctrl/Cmd+S saves, Ctrl/Cmd+Z /
Shift+Ctrl/Cmd+Z undo/redo. Ctrl/Cmd+click extends the selection (also
works with a drag-select box).| Entity | View | Edit |
|---|---|---|
| LINE, CIRCLE, ARC, ELLIPSE, LWPOLYLINE, HATCH (solid fill only), TEXT, XLINE, RAY | ✅ | ✅ (move / rotate / scale / mirror / delete / layer / colour / dimensions) |
| POLYLINE, MTEXT, INSERT (flattened blocks) | ✅ | — |
| Everything else (including pattern/multi-loop HATCH from other CAD tools) | placeholder marker | preserved on save |
ELLIPSE editing covers full ellipses (the common case); a partial
elliptical-arc's trim isn't preserved correctly under mirror specifically
(everything else — move/rotate/scale, and mirroring a full ellipse — is exact).
Editing requires an entity to carry a DXF handle (group code 5). Files without handles remain fully viewable but are read-only.
The codebase keeps a hard boundary between the framework-agnostic core/renderer and the Svelte UI shell (design doc §3). They communicate only through a typed event emitter — the renderer never imports Svelte.
src/
core/ framework-agnostic: no Obsidian, no Svelte, no three.js
parser/ raw DXF tokenizer, dxf-parser wrapper, OCS transforms
model/ DxfDocument, entity types, ACI colours, raw passthrough store
command/ reversible command stack (move/delete/layer/colour/draw/batch)
serializer/ patches edited entities + injects newly drawn ones
geom/ pure 2D geometry (intersections, fillet/chamfer, hatch lines,
ellipse sampling, dimension layout) — independently unit-tested
render/ three.js 2D renderer (grid, overlay, pan/zoom/pick, vector-font text)
interaction/ snap engine, tool manager, select/measure/draw/edit tools
worker/ Web Worker host + inlined parse worker (design doc §6)
view/ Obsidian file view, note embed, view controller bridge
ui/ Svelte UI shell (tabbed ribbon + floating cards)
settings/ Obsidian Setting-API settings tab
The raw DXF is tokenized into (group code, value) pairs that are the source of
truth. An unedited document re-serializes to a structurally identical tag
stream; only entities you actually change are patched. This is verified by the
automated test suite (tests/roundtrip.test.ts, design doc §8.3):
npm test
npm install
npm run dev # watch build -> main.js
npm run build # type-check + production bundle
npm test # core + round-trip tests
npm run lint # eslint with Obsidian rules
Copy main.js, manifest.json and styles.css into
<vault>/.obsidian/plugins/dxf-viewer-editor/ to test in Obsidian.
fs), so the plugin runs
on mobile. isDesktopOnly is false.MIT. Depends on dxf-parser
(MIT) and three.js (MIT). No GPL
dependencies in v1 (design doc §12).