FR — Transformez n'importe quelle face plane en face compatible LEGO® (tenons ou creux) en deux clics, directement depuis le panneau Face Tools de Part Design.
EN — Turn any planar face into a LEGO®-compatible face (studs or sockets) in two clicks, straight from the Part Design Face Tools panel.
L'addon ajoute une entrée « Transformer en face de brique » (Transform to brick face) dans le panneau Face Tools (onglet Tâches) du workbench Part Design. Elle apparaît dès qu'une face plane est sélectionnée.
Un clic ouvre une fenêtre d'options, puis la géométrie est générée.
Via l'Addon Manager (recommandé, une fois l'addon indexé) : Outils ▸ Addon Manager ▸ rechercher BrickFace ▸ Installer.
Ou avec le script d'installation automatique (détecte le chemin Mod et la version de FreeCAD) :
git clone https://github.com/jacquesh82/FreeCAD-BrickFace.git
cd FreeCAD-BrickFace
./scripts/setup.sh # Linux / macOS
# Windows : powershell -ExecutionPolicy Bypass -File scripts\setup.ps1Le script installe l'addon par liens symboliques quand c'est possible (un git pull suffit alors pour mettre à jour), sinon par copie. Options : ./scripts/setup.sh --remove pour désinstaller, FREECAD_MOD=/chemin/Mod pour forcer la destination.
Ou manuellement — 1. Cloner le dépôt dans le dossier Mod de FreeCAD
git clone https://github.com/jacquesh82/FreeCAD-BrickFace.git \
~/.local/share/FreeCAD/v1-1/Mod/BrickFace
⚠️ Attention au chemin. Depuis FreeCAD 1.1, le dossier utilisateur contient un sous-dossier de version (v1-1). Pour connaître le bon chemin sur votre machine, tapez dans la console Python de FreeCAD :import FreeCAD; print(FreeCAD.getUserAppDataDir() + "Mod")
| Système | Chemin typique |
|---|---|
| Linux | ~/.local/share/FreeCAD/v1-1/Mod/ |
| Windows | %APPDATA%\FreeCAD\v1-1\Mod\ |
| macOS | ~/Library/Application Support/FreeCAD/v1-1/Mod/ |
2. Redémarrer FreeCAD. C'est tout — aucun workbench à activer, l'entrée apparaît automatiquement dans Part Design.
Alternative : lien symbolique (pour développer)
git clone https://github.com/jacquesh82/FreeCAD-BrickFace.git ~/dev/FreeCAD-BrickFace
ln -s ~/dev/FreeCAD-BrickFace ~/.local/share/FreeCAD/v1-1/Mod/BrickFace- Ouvrez un modèle contenant un corps (
PartDesign::Body). - Basculez sur le workbench Part Design.
- Cliquez sur une face plane dans la vue 3D.
- Dans le panneau Tâches à gauche → Transformer en face de brique (Transform to brick face si FreeCAD est en anglais).
- Réglez les options, puis OK.
L'interface suit la langue de FreeCAD (Édition ▸ Préférences ▸ Général ▸ Langue) : anglais par défaut, traduction française incluse. Les libellés ci-dessous sont ceux de l'interface française.
| Option | Description | Défaut |
|---|---|---|
| Mâle (tenons) | Ajoute des tenons en relief sur la face | Ø 4.8 mm × 1.8 mm |
| Femelle (creux) | Creuse des logements pour recevoir des tenons | Ø 4.9 mm × 1.8 mm |
| Impression FDM | Ajoute du jeu sur la partie femelle : +0.3 mm au diamètre, +0.2 mm à la profondeur | cochée |
| Colonnes (N) | Nombre de tenons en largeur — pré-calculé depuis la taille de la face | auto |
| Rangées (M) | Nombre de tenons en hauteur — pré-calculé | auto |
| Pas | Entraxe entre tenons (standard de brique) | 8.00 mm |
| Disposition | Pleine (toute la face), Répartie, Bordure (anneau extérieur) ou Côtés (colonnes gauche/droite) | Pleine |
| Densité | Pour la disposition Répartie : Dense (1 sur 2, damier), Moyenne (1 sur 4) ou Faible (1 sur 9) | Dense |
| Diamètre | Diamètre des tenons ou des creux | 4.8 / 4.9 mm |
| Hauteur / Profondeur | Hauteur des tenons ou profondeur des creux | 1.80 mm |
La grille est toujours centrée sur la face, quelle que soit la disposition. Le texte en bas de la fenêtre affiche le nombre réel de tenons (16 tenons (grille 6 × 4) sur 48.0 × 32.0 mm en Bordure, par exemple).
💡 À quoi sert la case « Impression FDM » ? En impression FDM, les trous sortent typiquement 0.2 à 0.4 mm plus petits que modélisés. La case (cochée par défaut) élargit les creux à Ø 5.2 mm (imprimé ≈ 4.9–5.0 mm, le jeu voulu autour d'un tenon de 4.8 mm) et porte la profondeur à 2.0 mm pour que les faces se plaquent. Décochez-la pour de l'usinage ou de la résine (cotes nominales). Si l'assemblage reste trop lâche ou trop serré, ajustez le diamètre par pas de 0.1 mm.
L'addon ne crée aucun objet exotique : uniquement de la géométrie Part Design native.
Body
├── BasePad
├── BrickSketch ← esquisse attachée à la face (MapMode = FlatFace)
└── BrickStuds ← Pad (mâle) ou BrickHoles = Pocket (femelle)
Conséquences :
- ✅ Tout reste modifiable : double-cliquez sur
BrickStudspour changer la hauteur, ou éditezBrickSketchpour déplacer un tenon. - ✅ Le fichier
.FCStds'ouvre sans l'addon sur n'importe quelle installation FreeCAD. - ✅ Compatible avec l'historique paramétrique et les répétitions (
LinearPattern,Mirrored…).
| Problème | Solution |
|---|---|
| L'entrée n'apparaît pas | Vérifiez le chemin d'installation (voir l'encadré |
| L'entrée est grisée | Sélectionnez une seule face, et qu'elle soit plane (les faces cylindriques ne sont pas gérées). |
| « La face n'appartient pas à un corps » | La face doit faire partie d'un PartDesign::Body. Une forme du workbench Part ne convient pas. |
| Erreur à la validation | La grille dépasse peut-être la face : réduisez N × M ou le pas. |
FreeCADCmd tests/headless_test.pyVérifie le calcul de grille, le nombre de cercles générés et les volumes résultants (mâle et femelle), sans interface graphique.
Gui.Control.addTaskWatcher() remplace la liste complète des task watchers — il n'existe pas d'API pour en ajouter un seul. freecad/BrickFace/watcher.py réplique donc la liste installée par PartDesignGui::Workbench::activated() (FreeCAD 1.1.3) en y insérant Brick_TransformFace, puis la réinstalle à chaque activation du workbench Part Design.
Si une future version de FreeCAD modifie son panneau Tâches, seul ce fichier est à mettre à jour. En cas d'échec, l'installation est protégée par un try/except : le panneau standard reste intact et la commande demeure accessible.
This addon adds a "Transform to brick face" entry to the Face Tools panel (Tasks tab) of the Part Design workbench. It shows up as soon as a planar face is selected.
One click opens an options dialog, then the geometry is generated.
Via the Addon Manager (recommended, once the addon is indexed): Tools ▸ Addon Manager ▸ search for BrickFace ▸ Install.
Or with the automatic setup script (detects the Mod path and the FreeCAD version):
git clone https://github.com/jacquesh82/FreeCAD-BrickFace.git
cd FreeCAD-BrickFace
./scripts/setup.sh # Linux / macOS
# Windows: powershell -ExecutionPolicy Bypass -File scripts\setup.ps1The script installs via symlinks when possible (a git pull is then enough to update), otherwise via copy. Options: ./scripts/setup.sh --remove to uninstall, FREECAD_MOD=/path/to/Mod to force the destination.
Or manually — 1. Clone the repository into FreeCAD's Mod folder
git clone https://github.com/jacquesh82/FreeCAD-BrickFace.git \
~/.local/share/FreeCAD/v1-1/Mod/BrickFace
⚠️ Mind the path. Since FreeCAD 1.1 the user folder contains a version subfolder (v1-1). To find the correct path on your machine, run this in FreeCAD's Python console:import FreeCAD; print(FreeCAD.getUserAppDataDir() + "Mod")
| OS | Typical path |
|---|---|
| Linux | ~/.local/share/FreeCAD/v1-1/Mod/ |
| Windows | %APPDATA%\FreeCAD\v1-1\Mod\ |
| macOS | ~/Library/Application Support/FreeCAD/v1-1/Mod/ |
2. Restart FreeCAD. That's it — no workbench to activate, the entry appears in Part Design automatically.
Alternative: symlink (for development)
git clone https://github.com/jacquesh82/FreeCAD-BrickFace.git ~/dev/FreeCAD-BrickFace
ln -s ~/dev/FreeCAD-BrickFace ~/.local/share/FreeCAD/v1-1/Mod/BrickFace- Open a model containing a body (
PartDesign::Body). - Switch to the Part Design workbench.
- Click a planar face in the 3D view.
- In the Tasks panel on the left → Transform to brick face.
- Adjust the options, then hit OK.
The UI follows FreeCAD's language (Edit ▸ Preferences ▸ General ▸ Language): English by default, French translation included.
| Option | Description | Default |
|---|---|---|
| Male (studs) | Adds raised studs on the face | Ø 4.8 mm × 1.8 mm |
| Female (sockets) | Cuts recesses that accept studs | Ø 4.9 mm × 1.8 mm |
| FDM printing | Adds clearance on the female side: +0.3 mm diameter, +0.2 mm depth | checked |
| Columns (N) | Stud count across the width — auto-computed from face size | auto |
| Rows (M) | Stud count across the height — auto-computed | auto |
| Pitch | Centre-to-centre spacing (brick standard) | 8.00 mm |
| Layout | Full face, Spread, Border (outer ring) or Sides (left/right columns) | Full |
| Density | For the Spread layout: Dense (1 of 2, checkerboard), Medium (1 of 4) or Sparse (1 of 9) | Dense |
| Diameter | Stud or socket diameter | 4.8 / 4.9 mm |
| Height / Depth | Stud height or socket depth | 1.80 mm |
The grid is always centred on the face, whatever the layout. The label at the bottom of the dialog shows the actual stud count (e.g. 16 studs (grid 6 × 4) on 48.0 × 32.0 mm with Border).
💡 What does the "FDM printing" checkbox do? FDM-printed holes typically come out 0.2–0.4 mm smaller than modelled. The checkbox (on by default) widens sockets to Ø 5.2 mm (prints at ~4.9–5.0 mm, the right clearance around a 4.8 mm stud) and deepens them to 2.0 mm so mating faces seat flush. Untick it for machining or resin printing (nominal dimensions). If the fit is still too loose or too tight, tune the diameter in 0.1 mm steps.
The addon creates no exotic objects — only native Part Design geometry.
Body
├── BasePad
├── BrickSketch ← sketch attached to the face (MapMode = FlatFace)
└── BrickStuds ← Pad (male) or BrickHoles = Pocket (female)
Which means:
- ✅ Everything stays editable: double-click
BrickStudsto change the height, or editBrickSketchto move a stud. - ✅ The
.FCStdfile opens without the addon on any FreeCAD installation. - ✅ Works with the parametric history and patterns (
LinearPattern,Mirrored, …).
| Issue | Fix |
|---|---|
| Entry doesn't show up | Check the install path (see the |
| Entry is greyed out | Select exactly one face, and make sure it's planar (cylindrical faces aren't supported). |
| "Face doesn't belong to a body" | The face must be part of a PartDesign::Body. A plain Part workbench shape won't work. |
| Error on confirm | The grid may overflow the face: lower N × M or the pitch. |
FreeCADCmd tests/headless_test.pyChecks grid computation, generated circle count, and resulting volumes (male and female) — headless, no GUI needed.
Gui.Control.addTaskWatcher() replaces the whole task-watcher list — there is no API to append a single one. So freecad/BrickFace/watcher.py replicates the list installed by PartDesignGui::Workbench::activated() (FreeCAD 1.1.3), inserts Brick_TransformFace into it, and reinstalls it on every Part Design workbench activation.
If a future FreeCAD release changes its Tasks panel, only that file needs updating. Installation is wrapped in a try/except: on failure the stock panel stays intact and the command remains reachable.
FreeCAD-BrickFace/
├── package.xml # Addon Manager metadata (manifest)
├── freecad/
│ └── BrickFace/ # modern namespaced layout (freecad.BrickFace)
│ ├── __init__.py # brick constants (PITCH, STUD_D, STUD_H…)
│ ├── init_gui.py # command registration + workbenchActivated hook
│ ├── commands.py # Brick_TransformFace command
│ ├── task_panel.py # options dialog (PySide)
│ ├── geometry.py # grid maths + Sketch/Pad/Pocket creation
│ ├── watcher.py # Face Tools panel injection
│ └── resources/
│ ├── icons/
│ └── translations/ # BrickFace_fr.ts / .qm (French UI)
└── tests/headless_test.py
scripts/
├── setup.sh # automatic install (Linux / macOS)
└── setup.ps1 # automatic install (Windows)
| Dimension | Value |
|---|---|
| Grid pitch / Pas de grille | 8.00 mm |
| Stud diameter / Diamètre tenon | 4.80 mm |
| Stud height / Hauteur tenon | 1.80 mm |
| Plate height / Hauteur plaque | 3.20 mm |
| Brick height / Hauteur brique | 9.60 mm |
MIT © 2026 Jacques HULLU
LEGO® is a trademark of the LEGO Group, which does not sponsor, authorise or endorse this project. LEGO® est une marque du groupe LEGO, qui ne sponsorise ni n'approuve ce projet.


