Public: anyone can read this; the crew can change it.

A .dxf drawing opens as a picture on its file page: lines, circles, arcs and polylines #11913

opened this

Check · Review · Land · Live — No review yet. Next: reviewer, no review yet.

Ready to land

A `.dxf` file now opens on its file page as an inline SVG drawing, with entity counts and layer names beside it. New tests pass, `tsc` is clean and `bun scripts/design-lint.ts` passes. I did not run the full suite. The before/after screenshots at 390 px and 1280 px are not in this pull, because the sandbox cannot take them. `scripts/gate.ts` printed only the pre-push hook message, and I did not ch…

8 files · +353 −1

look green — it answered, no tests were run, ready for a look deploy 426a8b3

Check passeddeploy 426a8b3

Website spec: 23 findings (report only)
opened this

A .dxf file now opens on its file page as an inline SVG drawing, with entity counts and layer names beside it. New tests pass, tsc is clean and bun scripts/design-lint.ts passes. I did not run the full suite. The before/after screenshots at 390 px and 1280 px are not in this pull, because the sandbox cannot take them. scripts/gate.ts printed only the pre-push hook message, and I did not check it passes.

What changed

  • Renderer: src/web/render/dxf.ts reads the ASCII ENTITIES section and draws LINE, CIRCLE, ARC and LWPOLYLINE. Everything else, TEXT included, is counted as an entity but not drawn. The picture is scaled to its bounding box with y flipped.
  • Numbers: a NaN, Infinity or beyond ±1e9 value is dropped, and every string is escaped. Past 50,000 entities, nothing more is drawn.
  • Kind and registration: kinds.ts adds the kind dxf with a 5 MB cap. It is recognised by the .dxf name or by a 0\nSECTION head, and renderers.ts registers it.
  • Fallback: a binary DXF is classed as binary by the existing NUL check. Empty, header-only, no-EOF, over-cap and nothing-drawable files fall back to the source view with a one-line reason; none throws.
  • Style and docs: .dxf-view has CSS in content.ts and a short entry in docs/design/areas/render.md. The Content-Security-Policy is untouched.
  • Tests:

- test/render-dxf.test.ts covers one of each entity, scaling and y flip, the fallbacks including a 10 MB file, NaN and Infinity, and escaping. - test/render-kinds.test.ts and test/fuzz-renderers.test.ts each gain a dxf case.

Not done

  • Polyline bulges (group code 42) are drawn as straight segments, and the page says so.
  • No layer colours, no TEXT, no INSERT blocks, no splines.
  • The file does not say what unit its coordinates are in, so the page states that rather than guessing.

How to try it: commit a .dxf file to a repository and open its file page. Open it on the pull's preview deployment (lab--<pr>--forge-trevato-apps.open-platform.sh).

I pushed an empty Try: commit because the pre-push hook required one.

🤖 Generated with Claude Code

Closes #11861

commented

A .dxf file now opens on its file page as an inline SVG drawing, with entity counts and layer names beside it. New tests pass, tsc is clean and bun scripts/design-lint.ts passes. I did not run the full suite. The before/after screenshots at 390 px and 1280 px are not in this pull, because the sandbox cannot take them. scripts/gate.ts printed only the pre-push hook message, and I did not check it passes.

What changed

  • Renderer: src/web/render/dxf.ts reads the ASCII ENTITIES section and draws LINE, CIRCLE, ARC and LWPOLYLINE. Everything else, TEXT included, is counted as an entity but not drawn. The picture is scaled to its bounding box with y flipped.
  • Numbers: a NaN, Infinity or beyond ±1e9 value is dropped, and every string is escaped. Past 50,000 entities, nothing more is drawn.
  • Kind and registration: kinds.ts adds the kind dxf with a 5 MB cap. It is recognised by the .dxf name or by a 0\nSECTION head, and renderers.ts registers it.
  • Fallback: a binary DXF is classed as binary by the existing NUL check. Empty, header-only, no-EOF, over-cap and nothing-drawable files fall back to the source view with a one-line reason; none throws.
  • Style and docs: .dxf-view has CSS in content.ts and a short entry in docs/design/areas/render.md. The Content-Security-Policy is untouched.
  • Tests:

- test/render-dxf.test.ts covers one of each entity, scaling and y flip, the fallbacks including a 10 MB file, NaN and Infinity, and escaping. - test/render-kinds.test.ts and test/fuzz-renderers.test.ts each gain a dxf case.

Not done

  • Polyline bulges (group code 42) are drawn as straight segments, and the page says so.
  • No layer colours, no TEXT, no INSERT blocks, no splines.
  • The file does not say what unit its coordinates are in, so the page states that rather than guessing.

How to try it: commit a .dxf file to a repository and open its file page. Open it on the pull's preview deployment (lab--<pr>--forge-trevato-apps.open-platform.sh).

I pushed an empty Try: commit because the pre-push hook required one.

🤖 Generated with Claude Code

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs