File size: 2,036 Bytes
63dfab5 ebc1b3a 63dfab5 ebc1b3a 63dfab5 ebc1b3a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | ---
title: WFreeCAD
emoji: ⚙️
colorFrom: yellow
colorTo: red
sdk: static
pinned: false
short_description: A tiny in-browser FreeCAD Part studio
---
# WFreeCAD
A tiny, static, in-browser FreeCAD Python playground. Pick a Part macro, orbit the result, edit the code, and run it again.
- Four instant examples: a spur gear, a desktop computer, a rocket, and a mug.
- Upload any `.py` macro that uses the supported `FreeCAD` / `Part` subset.
- Live execution happens locally in a Pyodide Web Worker; nothing is sent to a server.
- Results are rendered with Three.js and `three-bvh-csg`, with soft shadows and an optional edge overlay.
## How it works
Example scenes are precomputed with `cadshim.py` under CPython and stored as `scenes/*.json`, so the examples render immediately without downloading Python. Uploaded macros are executed by Pyodide in `worker.js`, serialized into the same scene JSON format, and displayed by `viewer.js`.
The shim supports a practical subset of FreeCAD's Part API:
- `FreeCAD.Vector`, `Rotation`, `Placement`, and `ActiveDocument`
- `Part.makeBox`, `makeCylinder`, `makeSphere`, `makeCone`, `makeTorus`, `makePolygon`
- `Part.Face`, `Shape.extrude`, `Shape.cut`, `Shape.fuse`, `Shape.common`
- `Part.show`, `ViewObject.ShapeColor`, and `ViewObject.Transparency`
It is intentionally not a full FreeCAD distribution. Unsupported API calls return a clear error in the preview panel.
## Local development
```bash
cd wfreecad
python3 -m http.server 8123
```
Open <http://127.0.0.1:8123/>.
Examples are generated by:
```bash
python3 tools/build_scenes.py
```
Thumbnails are rendered from `tools/thumb.html` through the same Three.js viewer, so their materials and lighting match the main preview.
## Stack
- [Three.js](https://threejs.org/) + [three-bvh-csg](https://github.com/gkjohnson/three-bvh-csg)
- [Pyodide](https://pyodide.org/)
- [CodeMirror 5](https://codemirror.net/5/)
- Custom FreeCAD Part shim and static scene format
No backend, database, or build step is required at runtime.
|