A .dxf file as a picture
A .dxf file (AutoCAD drawing exchange, ASCII) opens on its blob page as an
SVG picture of the drawing, with its entity counts and layers listed under it.
Source is one tap away.
src/web/render/dxf.tsparses and draws;kinds.tsmaps.dxfto thedxfkind;renderers.tsnames the renderer.- Drawn: LINE, CIRCLE, ARC and LWPOLYLINE, in one colour, y up, fitted to the drawing's bounds. Polyline bulges are drawn straight.
- Not drawn, only counted: every other entity (TEXT, DIMENSION, INSERT, ...).
- At most 50,000 shapes are drawn; the page says how many drawable ones were left out. Layer names and entity types are escaped.
- No ENTITIES section, no EOF, no drawable entity, or a file past the size cap: the source view, with the reason.
- Try it: commit a
.dxfto a repository and open its file page.
Measuring
Tap two points on the drawing and the distance reads under it, in the unit the
file names: $INSUNITS in the header (4 is mm, 1 inches, and so on, the
DXF reference's table in src/web/render/measure.ts). A file whose $INSUNITS
is absent or 0 says it names no unit and shows raw units. A third tap starts
over. The readout is text in a live region, so a screen reader hears it.
- Keyboard: focus the drawing, arrows move a crosshair, Enter or Space picks.
- Distance is d = sqrt(dx² + dy²) on the drawing's plane, seven significant
digits; the points come from the SVG's own fit back to drawing coordinates
(
toDrawing), so it is the file's distance, not the screen's. - Terminal:
mon an open.dxfasks forx y x yand answers in the same words (measureDxfTyped). - The script is
dxf-client.ts, bundled once as/assets/dxf-<hash>.jsand loaded only on a page with a drawing. The render caps are unchanged.