Skip to content

GPT4FreeCAD #111

Description

@revhappy

🔌 Repository

https://github.com/revhappy/GPT4FreeCAD

📑 Notes

GPT4FreeCAD generates parametric geometry from a natural-language description. The model returns a validated, structured CAD program (JSON against a fixed schema) which a deterministic interpreter turns into a normal, editable FreeCAD feature tree — box/cylinder/extrude/revolve/boolean/fillet/pattern/shell/hole and so on. There is also an "Engineering" mode that builds a part as an editable step timeline you can reorder and re-parameterise, and a template library of parametric starters that needs no API call at all.

Licence: MIT. package.xml present and valid; loads on FreeCAD 0.20+ and is developed against 1.1.1. Repository is tagged freecad and addon, and there is a v2.8.0 release.

Four things I would rather state up front than have you find them:

  1. It talks to third-party LLM APIs. Gemini, OpenAI, Anthropic, xAI and OpenRouter are supported, each with the user's own key, entered in Settings and stored in FreeCAD's preference system (BaseApp/Preferences/Mod/GPT4FreeCAD) rather than a plaintext file. Nothing is sent anywhere until the user presses Generate, and only to the provider they picked. There is no telemetry and no phone-home.

  2. It does not require the cloud. A local provider runs a GGUF model on the user's own machine via any llama.cpp-compatible server (including Ollama and LM Studio) — no key, no network. Structured output there is enforced with a compiled GBNF grammar, so a small local model cannot emit a malformed program.

  3. There is an opt-in Python mode that execs model output. It is not the default path and not how the addon is meant to be used — the structured interpreter is. When it is used, the code is shown in an editable box for review before it runs, screened against a denylist of obviously-wrong-for-CAD calls (subprocess, socket, open(, __import__, …) and run inside an undo transaction. The module says plainly in its own docstring that this mitigates rather than eliminates the risk. If the index would prefer that path gated further or removed, I am happy to comply.

  4. No dependencies. Standard library only — no bundled or pip-installed packages. Qt access goes through a PySide2/PySide6 shim so it works on both the 0.2x and 1.x lines.

The FreeCAD-free core (schema, providers, engine, prompt assembly, geometry inspection) is unit-tested without FreeCAD: python tests/test_core.py is 173 tests, with a further 32 and 17 that run under freecadcmd.

Metadata

Metadata

Assignees

No one assigned

    Labels

    +Addition of something new.💿 𝗔𝗱𝗱𝗼𝗻In the context of an addon.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions