Every AI drawing reader demo uses a clean plan exported from CAD. Your project folder is different. It has scans, superseded sheets and a symbol legend somebody invented years ago.
This post is the engineer's version of our guide on AI for construction drawings. It turns the first two checks from that guide into scripts you can run before any vendor sees your files.
A vector PDF still carries text as text and lines as objects with coordinates. A scanned sheet is an image, so every word has to come back through OCR. A quick way to sort them is to ask the PDF for its text layer.
import fitz # PyMuPDF
from pathlib import Path
def has_text_layer(pdf_path, min_chars=200):
with fitz.open(pdf_path) as doc:
page = doc[0]
return len(page.get_text().strip()) >= min_chars
sheets = list(Path("drawings").glob("*.pdf"))
vector = [p for p in sheets if has_text_layer(p)]
print(f"{len(vector)} of {len(sheets)} sheets have a text layer")
The min_chars cut-off is a guess you should tune. A title block alone can carry some text, so open a few borderline sheets by hand. Sample around thirty sheets across disciplines. If most come back as images, budget for a recovery step and ignore any quoted vendor accuracy.
If three revisions of M-101 sit side by side, a quantity extraction counts all three. That looks like a software bug. It is a file management problem, and a few lines find it.
import re
from collections import defaultdict
pattern = re.compile(r"^(?P<number>[A-Z]{1,2}-\d{3})[_-]?(?P<rev>[A-Z0-9]+)?")
by_number = defaultdict(list)
for p in sheets:
m = pattern.match(p.stem)
if m:
by_number[m["number"]].append(m["rev"])
dupes = {k: v for k, v in by_number.items() if len(v) > 1}
print(dupes)
Adjust the pattern to your own numbering. If it fails on half the files, that is your third finding: the drawing numbers do not follow a convention.
The full guide covers the 4 jobs AI is sold for and the 5 document problems behind most failed pilots: AI for construction drawings.