Open-source electrical drawing toolkit: phase 1 pilot
Page owner: Aaron Tushabe · Status: phase 1 done on LSHA F6; gate 1 waits for an engineer's review · Last reviewed: 21 Oct 2026
Code: Nearly-Free-Energy/nfe-electrical-toolkit (public, Apache-2.0) · Direction: Electrical Drawings off AutoCAD (decision record) · Research: Electrical Drawing Tools Evaluation (Oct 2026) · How to use it: Using the NFE electrical toolkit with Claude
Phase 1 works end to end on the sixth floor of Lofty Skies Hotel Apartments (LSHA F6, drawing V11), with open-source software only. NFE's toolkit read the AutoCAD 2018 drawing, found the rooms and ran checks that caught real errors in our existing drawing. It then regenerated the small-power sockets of both apartments from a draft BS 7671 rule set, wrote them to a separate overlay DXF on NFE layers, and plotted the A1 small power sheet to PDF with the new sockets in place. That DXF + PDF pair is now NFE's standard deliverable. 27 of the 44 generated sockets landed within 1 m of the engineer's own (median 0.58 m). The whole run takes 55 seconds, and nothing is ever written to the architect's drawing.
Gate 1 is not passed yet: an engineer still has to review the overlay and the sheet PDFs (see "Still open" below).
Decisions (21 Oct 2026)
The overall direction is on the decision record. These four decisions were made during the pilot, and each one changed the toolkit:
| Decision | What it means for the toolkit |
|---|---|
| Deliverable: DXF + PDF. Architects and clients accept it, so NFE does not need to write DWG back. | The toolkit plots the sheet PDFs itself. Gate 1 needs an engineer's review of the overlay and the sheet PDFs, not an AutoCAD AUDIT of a DWG. |
| Standard: each job records its governing standard, BS 7671 by default. | Rule sets live in one folder per standard (rules/bs7671/…), and the toolkit refuses a rule set written for a different standard from the job's. IEC 60364 or US EAS 811-1:2014 sets are added when a job needs them. |
| Code home: the NFE GitHub organisation, not Gitea. | Published as a public repository under the Apache-2.0 licence. Because it is public, it holds no project names, client drawings or outputs. Those stay in the Library and in local work folders. |
| Client data: no special restrictions on using AI tools with client drawings while NFE explores which tools work best. | Text in a drawing is still treated as data, never as an instruction, and client drawings stay out of the code repository. To be revisited before cut-over. |
Results on F6
| Step | Result | Time |
|---|---|---|
| Read and normalise | LibreDWG converted the DWG, and ezdxf loaded it strictly with 0 audit errors. Units were detected as metres on all four geometry signals; the same check flags files that say metres but are drawn in millimetres, as F1 and F3 do (tested with F1- and F3-like values). The plotted base (the PDF2_ copy) was picked out of three copies of the architect's plan. 403 electrical symbols were indexed. 22 of 53 blocks draw far from their base point (267 inserts), so every position uses the drawn centre |
3.5 s |
| Rooms | 29 of 32 labels (91%) were bounded into 27 rooms, all with plausible areas. The 3 failures are façade DUCT labels outside the building. The architect's 4,532 dashed beam lines are treated as zone boundaries, not walls. The mirror axis between the two apartments (W and E, 9 room pairs) was found automatically | 1.7 s |
| Checks | 4 errors, 30 warnings and 18 notes on title blocks, legends and layers (listed below) | 0.05 s |
| Rules | 44 sockets in 22 rooms from about 40 lines of YAML. Each socket is turned to face its wall, at the offset learned from the engineer's own symbols | 1.3 s |
| Overlay | Both overlay DXFs re-read with 0 audit errors, identical counts and only NFE-E-* layers. Through a LibreDWG round trip, every insert and all 350 attributes survive |
0.6 s |
| Sheet PDFs | The small power sheet at true A1 size (1:59) in two modes: "issue", where the overlay replaces the 49 existing sockets in the rooms it regenerated, and "review", where it is drawn in magenta on top | 20 s |
| Claude (MCP) | All 17 tools exercised over MCP, the way Claude Desktop or Claude Code would call them. Placing a device takes about 0.1 s, a review render 1.2 s and opening a floor 3.8 s. Writing tools default to a dry run | – |
| Whole demo | Including 27 s of review renders | 55 s |
16 automated tests pass: 12 on a synthetic drawing and 4 on F6. For scale, at the research's assumed 20 seconds of manual drafting per symbol, 44 sockets take about 15 minutes by hand. The toolkit takes 1.3 seconds, plus the engineer's review.
Rules compared with the engineer's layout
| Sockets, both apartments | Result |
|---|---|
| Engineer's / generated | 51 / 44 |
| Generated within 0.5 m / 1 m / 2 m of an engineer's socket | 18 / 27 / 33 |
| Median distance of paired sockets | 0.58 m |
| Bedside pairs (4 sockets) | all within 0.11 m |
| Lounge TV walls (8 sockets) | all within 0.6 m |
| Unit W designed by rules, then mirrored onto unit E | 15 of 19 within 1 m (median 0.42 m) |
The rule counts were read off the engineer's own F6 layout, so matching counts only shows that the engine applies the rules; the positions are the real test. The engineer's layout repeats exactly across the two apartments (23 of 23 sockets within 0.3 m of the mirror image), so "design one unit, then copy it" suits LSHA.
What the checks found in our F6 drawing
These are errors in NFE's existing drawing, worth fixing whichever tool we use:
- Title blocks: all three sheets share one drawing number. The
TITTLEblock hides a zero-height text from an unrelated fuel-depot job on every sheet. CHECKED BY is a "." placeholder, and DESIGNED BY is empty on the lighting sheet. The drafter's name is spelled two ways. The sheets are dated October 2025, but both revisions are dated 12-02-2025, the same day. The border grid numbering skips 6, and the scale says NST although the sheets plot at 1:59. - Legends: the door-bell switch and sounder rows are swapped.
HIGHLEVELstands for both the high-level socket and the kitchen-island floor socket. T3 luminaires, intermediate switches, HDMI points and projectors are on the plan but not in the legend. - Layers:
TYPE P1,SOCK SINGLEandTELEPHONE POINTsit on layer 0, so they show on every sheet. - Layout: the dining zones have no sockets.
- Block names decoded:
LIGHis an outdoor wall light,GFHYTa TV point andDRTGRTa corridor light. The toolkit's catalogue now records these.
What failed or is still weak
- Rooms the rules don't cover yet. The misses were 1.1–6.9 m out: balconies (the engineer uses the short end wall), pantries (rule unknown), the far end of each cinema and parts of the kitchens. Kitchen-island floor sockets are not modelled, because islands are not detected and the legend gives them no symbol of their own. Six of the engineer's sockets in unlabelled spaces (bathroom shaver sockets, corridors) were not compared.
- Open-plan zones are a judgement call. Unlabelled corridor bands are split between neighbouring zones, so the two lounges differ slightly, and the rules give different results in two units the engineer drew identically.
- Furniture recognition needs closed outlines. Unit E's media unit is not a closed shape in the PDF import, so that lounge falls back to "the wall shared with the other lounge". Windows are not detected; the glazing rule is only "avoid walls facing a balcony".
- The circuit tool is schematic. Its right-angled runs cut across rooms (the demo ring is 38 m with 10 wall crossings), and it does no cable sizing, voltage drop or DB assignment yet.
- Sheet PDFs keep the drawing's own title block. The drawing number and revision table are not updated for the new content. ezdxf skips one multiline text per sheet, and logos (OLE objects) would not be drawn; the F6 sheets have none.
- A renderer bug, worked around. ezdxf 1.4.5 does not apply per-viewport layer freezes when drawing, so lighting leaked onto the small power sheet. The research's sheet previews show the same leak. The toolkit now applies the freezes itself.
- DWG output is a smoke test only. LibreDWG logs 48 internal decode errors when it reads back the R2000 DWG it wrote. With DXF + PDF as the deliverable, NFE does not rely on it.
- Not tested yet: an engineer opening the overlay over the architect's DWG in Open CAD Studio or AutoCAD (as an xref at 0,0); installing on Windows; the other ten floors. F4 and F5 have no real symbols, so they need re-drafting first.
Still open
Gate 1 on the decision record:
| Gate 1 condition | Status on F6 |
|---|---|
| The overlay re-reads cleanly in LibreDWG and ezdxf, with counts matching the source | Met, for both overlays |
| The DXF + PDF set opens and prints correctly | Open. An engineer needs to open the overlay over the architect's DWG in Open CAD Studio (or AutoCAD) and check the sheet PDFs |
Decisions for the engineers:
- The rules playbook. Counts, walls, spacing, mounting heights, dining zones, balconies and island floor sockets for each room type. Draft: Small-power rules playbook, BS 7671 (draft).
- The symbol library. Adopt the overlay's
NFE_*blocks (centred base points, millimetre units, invisibleNFE_TYPE,NFE_ROOM,NFE_CIRCUIT,NFE_DBandNFE_MOUNT_MMattributes) or define a new library. Resolve the conflicts the legend check found:Emergency light-Eis used as the presence detector,glaciapirouetteas the bedside pendant and2Gas a 1-gang 2-way switch, the door-bell rows are swapped, andHIGHLEVELis reused for island floor sockets. Move the layer-0 symbols onto their proper layers. - Layer, title-block and sheet standards. Confirm the
NFE-E-*layer names. Add title-block attributes and a numbering scheme that gives each sheet its own drawing number, so issued PDFs carry correct numbers and revisions. Remove the hidden text, and decide who signs CHECKED BY. - What to ask the architect for. Native DWG, with room zones as closed outlines and real wall layers, instead of PDF re-imports. That removes most of the room finder's guesswork.
- Ownership and set-up. Name the toolkit's owner. Decide whether the engineers' machines are macOS or Windows, which decides how LibreDWG and the MCP server get installed. The AutoCAD licence check is still open on the decision record; with no DWG write-back needed, a seat would at most serve as a viewer or checker.
Suggested phase 2:
- Run the same pipeline over F7 and F8, which share 98% of F6's symbol set.
- Add kitchen-island and window detection.
- Update the title block when a sheet is plotted.
- Move on to circuits, with DB schedules.
- Have an engineer review the overlay and the sheet PDFs in Open CAD Studio, to close gate 1.
Re-running the pilot
The F6 drawing and the pilot's outputs (overlay DXFs, sheet PDFs and review renders) are not stored in the Library or in the repository. To regenerate them, install the toolkit (how-to) and run the demo from the repository folder. It takes about a minute:
.venv/bin/python -I scripts/demo_f6.py --drawing "/path/to/V11 LSHA Electricals_SIXTH FLOOR.dwg" --workdir ~/nfe-electrical-work
History
| Date | Change |
|---|---|
| 21 Oct 2026 | Phase 1 built and run on LSHA F6. Decisions on the deliverable, the standard, client data and the code home. Toolkit published at github.com/Nearly-Free-Energy/nfe-electrical-toolkit under Apache-2.0 |
No comments to display
No comments to display