Home /Modules/autocad/FORMAT.md

FORMAT.md

autocad/FORMAT.md · 76 line(s) · markdown

AutoCAD Renderer — Plan Format & DXF Mapping

This is the contract between the SLeeLa renderer and any front end (the JavaFX GUI, a CLI, or an HTTP caller). It defines the input plan and how the renderer maps it to AutoCAD DXF output.

1. The plan (input)

A plan is UTF-8 text, one directive per line. Blank lines and lines starting with # are ignored. Tokens are whitespace-separated; coordinates and sizes are numbers in the drawing's units.

title   <text...>                 drawing title (placed as a header note)
units   <mm|cm|m|in|ft>           drawing units (metadata)
at      <x> <y>                   insertion point applied to the next `room`
room    <name> <w> <h>            rectangular room w x h at the current `at`
wall    <x1> <y1> <x2> <y2>       a single wall segment
door    <x> <y> <w>               a door opening of width w at (x,y)
dim     <x1> <y1> <x2> <y2>       a linear dimension between two points
note    <text...>                 a free-text annotation

Semantics the renderer evaluates (the "equation"):

2. DXF output (output)

The renderer emits a minimal but valid AutoCAD DXF R12 text file. R12 is the most widely interoperable DXF level and needs no handles or object database.

Structure:

0 SECTION / 2 HEADER                 units + extents
0 SECTION / 2 TABLES / LAYER table   layers: walls, dims, notes
0 SECTION / 2 ENTITIES               the geometry below
  LINE   (layer walls)   room/wall segments
  LINE   (layer dims)    dimension witness/extension lines
  TEXT   (layer dims)    measured dimension value
  TEXT   (layer notes)   notes + title
0 ENDSEC / 0 EOF

Layer conventions:

LayerColorContents
walls7Room and wall LINE entities.
dims1Dimension extension lines + measured text.
notes3Annotation and title TEXT.

The output is plain text and opens directly in AutoCAD, LibreCAD, and other CAD tools with no conversion step.

3. Front-end contract

A front end submits a plan (text) and receives DXF (text). In SLeeLa terms:

The JavaFX GUI mirrors these through SleelaJavaConnector and additionally asks for a lightweight entity list to draw the on-screen preview; it never computes geometry or writes DXF itself. See gui/.

Max Rupplin — MEARVK LLC — 2026