Conversational CAD Architecture
A maker describes a part, inspects its geometry, then requests a change in the same conversation. An edit can add or remove a feature. The downloadable result is an editable FreeCAD document. The maker can slice any saved revision with an installed profile.
Product boundary
The assistant writes Python against FreeCAD’s native modeling API. It can compose sketches, constraints, pads, pockets, revolutions, patterns, and Boolean operations as a design requires. The response format describes actions and artifacts. It has no part-name enum or dispatch table that selects a builder by shape.
The first release targets single printable solids in a self-contained document. Multiple construction features can contribute to that solid. If a document contains several independent solids, explain the ambiguity before slicing. This milestone ends at downloadable G-code. External MCP access and device dispatch remain separate milestones.
Build on the active-source interface and Boolean import work in PR #2. Its plate and cup cases become regression fixtures. Existing files, revision IDs, imports, jobs, profiles, and viewer access must survive the change.
A turn in the studio
- A maker describes the part, its use, and any dimensions that matter. Use millimeters internally. If a missing dimension affects fit or intent, ask a focused question. State reasonable cosmetic assumptions.
- For a revision, start from the document the maker selected. Inspect its feature tree, named parameters, measurements, and final solid. An edit to an older revision creates a child of that revision.
- The assistant supplies a Python edit to an isolated worker. On a new design it starts with an empty document. On an edit it changes a working copy of the parent. Prefer native, named, dimensioned features that a person can edit in FreeCAD.
- A separate inspection pass reopens the candidate, recomputes it, and produces geometry and measurements. The assistant can inspect these observations and correct a build or dimensional error within the turn budget.
- Show the actual shape, the changed features, and the dimensions relevant to the request. Label any assumption or unmeasured dimension. Only a successful inspection creates a revision.
- The maker selects a revision and profile and chooses Slice model. Job review identifies the exact source and profile. Changing the active source clears that result. Job history remains available separately.
If a maker requests a new feature, retain the useful parent sketches, constraints, and dimensions. A single mesh or a featureless copy of the finished solid fails the editability test. If the requested change requires an intentional feature replacement, it is valid and must be identified in the change summary.
Interfaces and ownership of evidence
| Component | Input | Output and responsibility |
|---|---|---|
| Conversation controller | User text, selected parent ID and digest, bounded feature summary, previous observations | Ask a question, request inspection, or submit an edit program. Keep the existing server-side API key and provider configuration here. |
| CAD executor | Run ID, attempt ID, pinned runtime, generated Python, and optional read-only parent document | Run the program on a private working copy. Return a staged candidate or bounded diagnostics. |
| Independent inspector | Candidate FCStd and requested geometric test rules | Reopen in a fresh process and sandbox, recompute, and inspect the final solid. Return a normalized feature tree, measured bounds and volume, preview geometry, a slicable mesh, and their digests. |
| Project store | Tested files, observations, and the original turn and parent IDs | Publish one immutable revision. Record the parent and source digests, private edit program and digest, runtime identity, changed features, measurements, and preview/mesh digests. |
| Browser and slice worker | Published revision ID, selected profile, verified artifacts | Show the measured model. Bind the slice to its FCStd digest, the mesh derived from that document, and the profile snapshot. |
The provider receives only the conversation and the modeling context needed for that turn. For edits, this can include earlier generated code and selected feature parameters. The visual reviewer receives rendered images of the candidate and any selected parent. The planner can also receive the selected parent image and rejected candidate views during repair. Disclose this before enabling the assistant. Keep FCStd binaries, credentials, machine profiles, unrelated projects, and raw runtime logs local. Use the existing access rules for project data.
Geometry and repair
Give native objects stable names and retain references between features. An inspection result identifies the relevant objects and what FreeCAD measured. Generic observations include feature type and dependencies, component count, bounds, volume, analytic surface dimensions, distances, and cross sections. Extend inspection by measurement type. A new product name must never require a new tool.
A maker’s dimensions are requirements. Record units, the measured value, the applicable tolerance, and the feature or faces used. When present, use the stated tolerance. Publish the numerical comparison tolerance used for CAD checks. Physical manufacturing tolerance is a separate quantity. Derive measurements from the saved geometry independently of the script. A bounding box alone cannot establish the diameter of a bore or the thickness of a floor.
For each attempt, start from the same parent. Return the failed operation, a short error category, and useful observations to the assistant. Start with one build and up to two repair attempts. Apply per-run deadlines and token limits across the whole turn. When attempts run out, explain the failure and preserve the last usable revision. A clarification uses no CAD attempt. A deliberate new request can continue after the maker answers.
Durable turns and compatibility
Introduce an asynchronous API beside the existing synchronous message endpoint. Preserve the old endpoint’s request and response contract for existing callers. Route both through one admission queue and one commit path. The old handler waits for its admitted run and formats the legacy response. A concurrent old and new request must obey the same busy-project rule.
| Request | Contract |
|---|---|
POST /api/projects/{id}/runs |
Maker supplies a client request ID, message, and optional parent revision ID. Persist the request before returning HTTP 202 with the run ID and status URL. |
GET /api/projects/{id}/runs/{run} |
Authorized project readers can see state, bounded progress and any resulting revision ID. Refreshing the page resumes polling. |
| Existing model download and slice routes | Resolve the selected committed revision. Reject a mismatched digest or unpublished result. Preserve historical downloads and profile snapshots. |
Persist the run states queued, working, needs_input, ready, failed, and interrupted. While working, expose the phase and attempt number. A question ends the current turn. The answer starts a linked request. Permit one active edit per project initially. A duplicate request ID with identical inputs returns its existing run. Return a conflict for a reused ID with different inputs or a different edit while the project is busy.
Use the project lock for state transitions. Release it during provider and CAD work so reads can continue. Stage files outside the visible revision list. Commit the result and its run reference under the same project lock. On restart, reconcile by run ID: finish publication of an already tested result once, or mark the interrupted run and discard its private scratch. A replay must never create a second revision or silently repeat a paid provider call.
Legacy parameter records remain readable. Editing a legacy revision uses its saved FCStd as the parent. Derive a missing feature summary on demand. Keep the existing import-to-slice path. Editing arbitrary imported documents in conversation can follow as a separate change. On mobile, ignore responses for a source the user has left and allow a return to the active run after reconnecting.
Worker boundary and release gate
Treat generated Python, its output document, and its logs as untrusted. Start with a disposable Linux worker using a pinned FreeCAD runtime. A local installation can use a Linux VM or container backend. If the isolated backend is unavailable, explain the setup requirement and keep saved designs accessible. Never fall back to running generated Python inside the web process or directly on the host.
- Give a small local supervisor one operation: start a job with the fixed worker profile. Only it can launch the runtime. The API and generated program cannot choose images, mounts, host paths, commands, or runtime flags.
- Start each attempt as an unprivileged user with a read-only runtime, no network, no host devices, no host control socket, and no inherited secrets. Copy in only the requested program and parent. Give it bounded scratch space.
- Enforce limits on wall time, memory, CPU, processes, document expansion, output bytes, and log size. Kill the entire job on timeout. Reject symlinks, unexpected files, and oversized outputs before collecting artifacts. Use the current 32 MiB FCStd upload limit for candidate files. Start with 120 seconds of CAD time per attempt. Lane B records and tests every other limit on the target runtime before enabling generated code.
- Before any FreeCAD reopen, screen the FCStd archive with a bounded, non-executing reader. Check archive paths, expansion, object types, properties, and references. Reject executable content, scripted proxies, external links, unrecognized active content, and expressions outside the qualified passive subset. Apply this screening to parent inputs as well as candidates.
- In a fresh inspector sandbox, reopen only screened bytes with automatic execution disabled. Demonstrate this behavior for the pinned runtime with inert fixtures. If the policy cannot establish that a document is passive, withhold that candidate. A qualified native object list describes FreeCAD features that can be combined freely.
- Generate a bounded browser preview and a separate slicing mesh from the inspected solid. Keep generated documents inside the isolation boundary for every later reopen or export. Give OrcaSlicer the inspected mesh and profile snapshot. Exclude the provider key from both processes.
- On disabling the feature, stop admission, finish or interrupt outstanding runs, and retain published documents and receipts. A rollback rehearsal must open pre-upgrade records and export qualified revisions without running a stored edit script.
Pass only fixed filenames for the edit, parent, and collected document. When returning observations to the provider, treat feature labels, program output, and diagnostics as data. The inspector owns geometric evidence. The application owns digests, file collection, and publication. Neither trusts measurements or a success message written by the generated program. A security review of the launcher, document handling, and deployment permissions gates the first build that executes provider-generated code.
Jev implementation lanes
One integration owner freezes the contracts and owns the final branch. Recheck PR #2 before implementation and integrate its reviewed interfaces. The spec can merge independently. Jev is a contributor tool. The deployed application has no dependency on it.
Each row below was classified with jev lane classify --task for its stated scope. All six returned jev-lane-high. At dispatch, classify the actual work order again and use target.agent. The file names below assign ownership. New modules are proposed names.
| Order | Owner and files | Deliverable and deterministic gate |
|---|---|---|
| A | Protocol owner: workbench/cad_protocol.py, protocol fixtures and tests |
Define run states, request identity, tool messages, artifact manifest and limits. Exercise success, question, refusal, malformed evidence, duplicate request, and interrupted publication using fixed fixtures. |
| B, after A | Worker owner: workbench/cad_worker/, launcher, runtime configuration and worker tests |
Run a hand-written native feature edit in isolation. Independently reopen and measure it. Prove resource bounds, denied capabilities with benign probes, cleanup, active-content rejection, and parent immutability. Obtain independent boundary review. |
| C, after A | Assistant owner: workbench/adviser.py, assistant loop and provider tests |
Use a fake worker and recorded synthetic provider replies. Exercise clarification, feature creation, a failed edit followed by repair, exhaustion, and an edit to a selected older parent. A new shape requires no change in schema or router. |
| D, after A | Integration owner: workbench/projects.py, web.py, pipeline.py, persistence and API tests |
Implement run admission, role checks, receipts, restart recovery, compatibility and exact-source slicing. Start with fake B and C. Repeat with both real implementations before handing off. |
| E, after A | Interface owner: workbench/static/index.html, browser tests |
Develop against A’s fixtures. Test phone navigation, reconnect, honest build status, actual geometry, failed edit, explicit history, revision selection and a single slice action. Repeat against D. |
| F, after B to E | Qualification owner: end-to-end fixtures, installation and recovery docs, release evidence | Run the full suite and browser flows on the candidate. Freeze the candidate digest and conduct the owner acceptance below. Publish the evidence or record the failed criterion. |
B, C, D, and E can proceed against the same contract as capacity allows. Keep worker and controller changes on separate file ownership. After each cycle, run the scoped tests, compilation and diff check. Pass the commands and owned paths to jev lane step. Retry or escalate one lane on evidence. The integration owner resolves cross-lane contracts and runs the real workflow before marking delivery complete.
From the checkout root, run the scoped test with python3 -m unittest discover -s tests -p '<test file>'. Run git diff --check on the owned changes. Use jev lane step --task "<work order>" --lane high --attempt 1 --run "<test command>" --scope "<owned path>" for the classified high lane. Record the test outcome separately from the routing decision. For integration, run the full unittest suite with the real FreeCAD test paths configured. Run the browser regression with Playwright and WebKit, then run the live provider, CAD, and slicer flow. A skipped CAD check does not qualify that runtime.
Acceptance after implementation
- Freeze the candidate commit, worker image, provider model, instructions, and qualification profile. Record the identifiers before asking the owner for a part.
- The owner then chooses a previously unseen printable part. Before the first provider call, the owner records the prompt, essential dimensions, tolerances, intended function, and which details the assistant can decide. The owner defines the pass criteria. Keep private prompts and artifacts in local evidence.
- Start from an empty project in a phone browser. Allow ordinary clarification. Inspect and download the first model. Independently measure the agreed features in the saved document.
- The owner requests a change that adds, removes, or combines a feature. Agree on the new measurements and which earlier features must survive before running the edit. Inspect the child feature tree and exercise a native parameter edit on a disposable copy. Recompute and make sure that the intended geometry changed.
- Select both revisions in turn. Make sure that the original bytes and hash stay unchanged. Slice the child and match its job to the saved FCStd, inspected mesh, selected profile, and downloaded G-code.
- Record whether the owner accepts the geometry and workflow. Save attempt counts, elapsed time, any repair diagnostics, and the pass or failure for each agreed requirement.
Do not change source, instructions, builders, fixtures, or worker policy to fit the chosen part during acceptance. If a product change is needed, record the failure, freeze the next candidate, and ask for a different unseen part. Plate, cup, Boolean import, multiple-solid rejection, failed repair, disconnect, replay, and role tests remain repeatable regression gates. The release requires both the automated gates and the owner’s held-out test.
Reuse and distribution
Reuse the project store, profile snapshots, authorization, active-source UI, and existing FreeCAD export and Orca review logic where their contracts still hold. The FreeCAD runtime supplies native modeling operations. Keep inherited export attribution intact. Before copying any external worker, agent, or modeling code, record its source revision, license and required notices. If an image bundles CAD or slicer binaries, review binary redistribution separately. FreeCAD project · Existing third-party notices
Review the shape
For a new design, the assistant considers two ways to build the shape. If the first composition reads as another subject, the planner can use the alternate composition. The assistant records the accepted design brief with each new revision. The brief describes the use, proportions, and features that identify the part. The next edit starts with the brief from the selected revision. Earlier revisions without a brief still support edits.
After FreeCAD passes its geometry and dimension checks, Enmesh renders side, end, and opposing three-quarter views of the actual shape in one color. The configured model identifies the candidate from the views alone. A separate review compares that observation and the views with the conversation. For a revision, the reviewer can also compare the selected parent image. If the shape misses the request, the planner receives the observation and can try again within the repair limit. If a turn encounters both CAD and visual failures, it can use a fourth attempt within the original time limit. If review fails, Enmesh leaves the last accepted revision available.
The workspace shows the same image the reviewer accepted. Use the view selector to inspect the model from another angle. The visual review judges appearance. The CAD worker supplies the measurements.
Design references
The text2scad generator pairs a small modeling library with guidance on where features attach. Enmesh supplies native FreeCAD helpers and can measure whether two intended neighbors intersect. text2scad generator instructions
The cad-agent project separates generation from critique and lets the generator inspect geometry. Its repair instructions preserve good parts of a previous draft. Enmesh distinguishes a local correction from a new composition. For a local correction, it replays the working source and applies the edit to named features. cad-agent prompts
The CADGenBench baseline returns a render and solid measurements after export. Enmesh uses both kinds of evidence and asks a separate reviewer to identify the shape before it sees the brief. CADGenBench baseline
BlenderAlchemy compares candidate renders with an earlier visual state during editing. Its experiments concern Blender graphics. Enmesh keeps the uploaded or accepted FreeCAD parent intact and uses its image as a comparison for revisions. BlenderAlchemy, ECCV 2024