Home/Modules/autocad

autocad

system module autocad

Examples

lib/examples/autocad

6 file(s)

<p align="center"><img src="https://github.com/mearvk/SLeeLa/blob/master/images/sleela-programming-language-002.jpg" alt="SLeeLa Marketing Logo" width="560"></p>

<img align="right" src="https://github.com/mearvk/SLeeLa/blob/master/images/debian/debian-logo.png" width="75" height="75" alt="SLeeLa">

SLeeLa AutoCAD Renderer

Take in descriptions, dimensions, plans, and notes, and have SLeeLa render the output as an AutoCAD drawing.

SLeeLa is authoritative: it parses a human plan (rooms, walls, dimensions, annotations) into a geometric model, evaluates it (the "equation" — layout math, offsets, dimension strings), and emits a real AutoCAD-compatible DXF drawing (the open AutoCAD Drawing Interchange Format, readable by AutoCAD, LibreCAD, etc.). A JavaFX GUI is provided as a thin surface for entering the plan and previewing the rendered geometry.

Architectural rule

JavaFX presents; SLeeLa decides.

The GUI never computes geometry or writes DXF. It collects the description, dimensions, plan, and notes, submits them to the SLeeLa renderer through the common Java connector (process / RMI / HTTP), and previews the geometry the renderer returns.

   Description + Dimensions + Plan + Notes
                     |
                     v
          SLeeLa AutoCAD Renderer            <-- authoritative
   (cad/*.sleela : parse -> model -> evaluate -> emit DXF)
                     |
         +-----------+-----------+
         |                       |
     drawing.dxf             live preview
   (AutoCAD / LibreCAD)           |
                              JavaFX GUI
                           (autocad/gui)

What goes in

A plan is a small, line-oriented description a person can type. Each line is a directive:

DirectiveExampleMeaning
titletitle Office FloorDrawing title (header note).
unitsunits mmDrawing units.
roomroom Lobby 6000 4000Rectangular room: name W H.
atat 0 0Insertion point for the next room.
wallwall 0 0 6000 0A wall segment: x1 y1 x2 y2.
doordoor 2000 0 900A door opening: x y width on a wall.
dimdim 0 0 6000 0A linear dimension between two points.
notenote Fire exit on north wallA text annotation.

Dimensions, plans, and notes together are the "equation" SLeeLa evaluates: it resolves room placement, derives wall rectangles, lays dimension strings off the geometry, and places notes — then emits the result as DXF.

What comes out

A single drawing.dxf file containing:

DXF is plain text and self-contained; it opens directly in AutoCAD and other CAD tools without conversion.

Layout

autocad/
  README.md                 This document.
  FORMAT.md                 The plan directives + DXF mapping in detail.
  Makefile                  Build/render helpers (dispatch into SLeeLa).
  cad/                      SLeeLa renderer (authoritative).
    model.sleela            Geometry model: points, rooms, walls, dims, notes.
    plan.sleela             Parses plan directives into the model.
    dxf.sleela              Emits the model as AutoCAD DXF text.
    render.sleela           Top-level: build a demo plan and render drawing.dxf.
  samples/
    office.plan             A sample plan (description + dimensions + notes).
  gui/                      JavaFX plan-entry + geometry preview surface.
    pom.xml
    src/main/java/module-info.java
    src/main/java/com/mearvk/sleela/autocad/gui/
      CadStudioApp.java             JavaFX application (presentation only).
      CadPlanModel.java             Presentation model + connector bridge.
      Entity.java                   Geometry primitive used by the preview.

Status

The SLeeLa renderer defines the full parse → model → evaluate → emit-DXF pipeline and a runnable demo (cad/render.sleela). The JavaFX GUI is a complete, buildable plan-entry shell wired to call the renderer through SleelaJavaConnector; the live connector transport is the next integration point and is clearly marked.

Max Rupplin — MEARVK LLC — 2026


AutoCAD Creator™

The AutoCAD Creator™ is the interactive sibling of the renderer documented above. Where the renderer turns a plan into a drawing in one shot, the Creator lets you create and alter a 2D AutoCAD document live — add walls, rooms, dimensions and notes, then move, relabel, re-layer, delete, and undo what you placed — and save the result as a real AutoCAD DXF drawing (R12 text, opens in AutoCAD / LibreCAD).

Both the editing engine and the graphical interface are written in SLeeLa. Unlike the renderer's JavaFX surface, the Creator's GUI is built on SleelaUI™, SLeeLa's own cross-platform UI toolkit (under /lib/user-interface) — not JavaFX — raising a real native window on X11 / Cocoa / Win32 with the signature Slick Black look.

Architectural rule

SleelaUI presents; SLeeLa decides.

The GUI never computes geometry and never writes DXF. Every tool issues a create / alter / delete / undo / save intent to the authoritative SLCadCreator; the Creator owns the editable document and the edit history, and the canvas only previews the geometry the Creator holds.

        Tools + property fields + plan text         (SleelaUI window)
                         |
                         v  create / alter / delete / undo / save
            SLCadCreator  ->  SLCadDocument          <-- authoritative
         (edit history)       (editable entities)
                         |
            +------------+------------+
            |                         |
       drawing.dxf              live preview
     (AutoCAD / LibreCAD)      (SLCadCanvas, Draw API)

Classes

The reusable editing engine lives in /lib/autocad:

ClassRole
SLCadEntityOne addressable, mutable 2D entity (line / text / dim): move, reshape, relabel, re-layer, soft-delete, emit DXF.
SLCadDocumentThe editable 2D document: indexable entity store with create / alter / delete, click hit-test, live extents, and DXF serialisation.
SLCadCommandOne recorded, reversible edit for undo + audit.
SLCadCreatorThe Creator facade: owns the document, selection, active layer, and command history.

The GUI shell and headless demo live under creator/: creator/creator.sleela (self-contained demo), creator/cad/CadCreatorApp.sleela (SleelaUI window), and creator/cad/SLCadCanvas.sleela (drawing surface).

Build & run

make creator          # from autocad/: run the Creator demo -> out/altered.dxf

On a display this opens the live editing window and drives the editing API; on a headless host it builds the drawing in memory, prints a report plus the DXF, and exits cleanly. See the Creator module README for the full tool list and editing API.


SLeeLa

<p align="center"><img src="images/sleela/sleela-wordmark.svg" alt="SLeeLa — The Now. The Ingredient." width="560"></p> <p align="center"><img src="https://github.com/mearvk/SLeeLa/blob/master/images/sleela-programming-language-002.jpg" alt="SLeeLa Marketing Logo" width="560"></p>

Files 14