Skip to content

About

AI pre-delivery review for construction drawings (Gemini): 9 checks, issues pinned on the sheet, planted-defect benchmark

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

SheetCheck

AI pre-delivery review for construction drawings. Drop a set of sheets (multi-page PDF, PNG or JPG) and SheetCheck runs the nine checks a senior engineer does before issuing a set, then pins every problem on the sheet with a one-line fix:

  1. Title block completeness (project, sheet title and number, scale, date, revision, responsible engineer)
  2. Text and linework collisions
  3. Anything outside the border or over the title block
  4. Scale and north arrow
  5. Dimensions on main elements
  6. Text legibility for the plot size
  7. Legend, notes and symbols
  8. Revision table vs. title-block revision
  9. Brazilian standard NBR 6492 conventions

Each check returns PASS, FAIL or CHECK BY EYE. The model is told never to guess a PASS on something it cannot read.

Built with Gemini in Google AI Studio (React + Vite + Express). It was built and tested on Brazilian sheets (Portuguese text, NBR 6492 conventions).

What you get

For every uploaded page the app shows a PASS / FAIL / CHECK BY EYE result for each of the nine checks. Each FAIL is pinned on the sheet with a numbered marker and a one-line fix, and the set gets an overall "ready / not ready to issue" verdict. Example output of the model for a clean sheet and for a sheet with one planted defect is in bench/resultados/ (raw JSON).

The interface is bilingual: an EN / PT-BR switch sits in the header. Browsers set to Portuguese open in PT-BR, everyone else in English, and the choice is remembered. In PT-BR the model writes the reasons and fixes in Portuguese, and the punch list and PDF report come out in Portuguese too (strings live in src/i18n.ts).

Run locally

Requires a current Node.js LTS and a Gemini API key.

npm install
cp .env.example .env   # put your GEMINI_API_KEY in .env
npm run dev            # http://localhost:3000
npm run lint           # type check (tsc --noEmit)
npm run build          # production build of the UI

How it works

  • Each page is rendered at 4,000–6,000 px in the browser. The bottom-right corner, where Brazilian title blocks sit, is cropped and sent as a second image so the model gets more pixels per millimetre on the small text.
  • server.ts calls Gemini with ultra-high media resolution and a strict JSON schema. Each FAIL carries a bounding box ([ymin, xmin, ymax, xmax], 0–1000) and a fix.
  • The UI shows a set-level verdict ("ready / not ready to issue"), a pan/zoom viewer with numbered markers, the checklist, a copyable punch list and a printable PDF report.

Benchmark (bench/)

An AI reviewer is only useful if you know how often it misses, so the benchmark plants defects with a known answer.

  • bench/fonte/: four A3 sample sheets (architecture, structure, electrical, plumbing) of a 20 x 40 m steel warehouse, generated by a deterministic drawing engine, as DXF. The title block uses a placeholder client and address.
  • bench/make_cases.py: edits each DXF with ezdxf to plant exactly one defect per case (responsible engineer removed, revision bumped with no revision table, scale removed, dimensions removed, legend removed, level marks and section cuts removed, a label dropped on other text, a note pushed over the title block) and renders 4,000 px PNGs plus cases/gabarito.json (the expected answers).
  • bench/run_bench.mjs: sends every case through the app's /api/review-sheet, the same way the UI does.
  • bench/pontuar.py: scores a run against the expected answers. A case only counts when the clean sheet did not already fail that check.

Reproduce (the PNGs and the expected answers are already in the repo, so step 1 is optional):

pip install ezdxf pillow
python bench/make_cases.py          # 1. regenerate bench/cases/ from the DXFs
node bench/run_bench.mjs r1         # 2. review every case, writes bench/resultados/r1__*.json
python -I bench/pontuar.py r1       # 3. score the run

Heads-up on step 2: the script currently drives a browser tab over the Chrome DevTools protocol (port 9333, the AI Studio preview of the app), so it will not run as-is on another machine. Adapt it to POST each case to http://localhost:3000/api/review-sheet (body: imageBase64, mimeType, titleCropBase64) if you want to reproduce the run locally. Step 3 works offline on the committed results.

Status: partial run r1, 14 of 33 sheets (the rest hit the free-tier API quota). Scores from python -I bench/pontuar.py r1:

result
Planted defects caught (scorable cases) 8 of 8, all with a bounding box on the sheet
Cases not scorable (clean sheet already failed that check) 2
False alarms on the 4 clean sheets (8 checks each) 8 of 32 (scale/north arrow 3, text collisions 3, dimensions 1, outside border 1)
Real undersized text (< 1.8 mm on A3) found 0 of 4

On the clean sheets the "no north arrow" FAIL is correct (these sheets have none); the "text collisions" alarms are not yet checked by hand. Only 8 defects were scorable, so read these as a first signal, not as an accuracy figure. Results: bench/resultados/.

Limits

SheetCheck is a second reviewer, not a signature. The engineer of record still checks and signs the set.

  • The model can miss real problems (see the benchmark) and can raise false alarms; it reads raster images, so very small text is its weakest point.
  • The benchmark is small: one warehouse design, four disciplines, synthetic single-defect edits, one partial run.
  • It needs a Gemini API key; the free tier rate-limits large sets. Sheet images are sent to the Gemini API.
  • Tuned for Brazilian sheets (NBR 6492). Other drawing standards are not covered.

License

MIT, see LICENSE.

About

AI pre-delivery review for construction drawings (Gemini): 9 checks, issues pinned on the sheet, planted-defect benchmark

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages