Extract quantities from construction drawings using vector data extraction combined with AI vision. Handles tag counting (light fittings, power outlets, fixtures), area/volume measurement (concrete, flooring), and linear measurement (cable trays, pipes). Use when user uploads construction drawings and needs quantity takeoffs.
Extract quantities from construction drawings by combining programmatic vector extraction with AI vision analysis.
This skill uses two complementary approaches:
Vector extraction — Programmatically extracts text, coordinates, dimensions, and shapes from PDF files. Provides precise measurements and reliable tag counts.
Vision analysis — AI interprets the drawing image to identify symbols, understand spatial relationships, and verify extracted data.
Use both together for best results. Vector extraction handles precision; vision handles interpretation.
When user uploads a PDF drawing, run the extraction script first:
pip install pymupdf --break-system-packages
python /mnt/skills/user/construction-takeoff/scripts/extract.py /path/to/drawing.pdf -o extracted.json --pretty
This outputs JSON containing:
Check the extraction output for:
Scale detection
"scale": {
"detected": true,
"factor": 100,
"method": "title_block",
"confidence": "high"
}
If scale wasn't detected automatically, look for it in the drawing image and apply manually.
Tag counts
"tag_counts": {
"L1": {"count": 12, "description": "Light fitting", "category": "electrical"},
"GPO": {"count": 24, "description": "General power outlet", "category": "electrical"}
}
These counts come from text extraction — they're reliable but may miss symbols without text labels.
Dimensions found
"dimensions_found": [
{"text": "6000", "value_mm": 6000, "x": 234.5, "y": 456.7}
]
Use these to verify scale and for manual measurements.
View the drawing image to:
Use extraction data as the foundation, vision analysis to verify and supplement:
| Data Type | Primary Source | Verification |
|---|---|---|
| Tag counts | Text extraction | Vision check for missed items |
| Dimensions | Extracted text | Vision confirms placement |
| Scale | Title block text | Dimension-to-line matching |
| Room areas | Vector rectangles | Vision confirms boundaries |
| Linear runs | Vector polylines | Vision traces cable routes |
| Symbol types | Vision recognition | Legend cross-reference |
Generate CSV output:
python /mnt/skills/user/construction-takeoff/scripts/takeoff.py from-json extracted.json -o takeoff.csv
Or create directly with final quantities:
Tag,Description,Count,Area (m²),Volume (m³),Length (m),Unit,Page,Notes
L1,LED downlight 10W,12,,,,EA,1,Kitchen and living
L2,Pendant light,3,,,,EA,1,Dining area
GPO,Double power outlet,24,,,,EA,1,
SLAB-01,Concrete slab 150mm,,,45.5,,m³,2,Ground floor - 303m² x 150mm
The extraction script recognises common construction tags:
L1-L99 Light fittings | LD LED downlight | GPO Power outlet | DB Distribution board | SW Switch | EX Exit light | EM Emergency light | SD Smoke detector | FAN/EF Exhaust fan
WC Toilet | WHB Wall hung basin | SHR Shower | SK Sink | FL/FD Floor drain | HW Hot water
FH/FHR Fire hose reel | FE Fire extinguisher | SPR Sprinkler | MCP Manual call point
C1-C99 Columns | B1-B99 Beams | S1-S99 Slabs | F1-F99 Footings
D1-D99 Doors | W1-W99 Windows
See references/tags_and_symbols.md for complete list.
If scale is detected (e.g., 1:100), measurements are converted automatically:
real_mm = drawing_pts × (25.4/72) × scale_factor
Areas and lengths in the extraction JSON will include _m2 and _m values.
If scale isn't detected:
scale = known_mm / (measured_pts × 0.353)For concrete and similar:
Volume (m³) = Area (m²) × Thickness (m)
Common thicknesses:
Always verify scale — The most common error source. Cross-check extracted scale against known dimensions.
Check for missing tags — Symbols without text labels won't appear in extraction. Use vision to count these.
Watch for duplicates — Tags might appear in both plan and legend. Extraction counts both.
Cross-reference schedules — Drawings often include schedules (door schedule, light fitting schedule). These are authoritative.
Note revision clouds — Recent changes may affect quantities. Check revision markers.
Account for waste — Add appropriate waste factors:
Scanned PDFs — If the PDF is a scanned image (no vector data), extraction will return minimal results. Fall back to vision-only analysis.
Complex symbols — The script extracts shapes but doesn't interpret symbols. A circle might be a column, manhole, or light fitting — vision determines which.
Layered drawings — Some PDFs have overlapping layers that complicate extraction. Review results carefully.
Non-standard tags — Project-specific tag conventions may not match the built-in patterns. Check the legend and adjust.
# Extract all pages
python extract.py drawing.pdf -o extracted.json --pretty
# Extract single page
python extract.py drawing.pdf --page 1 -o page1.json
# Output to stdout
python extract.py drawing.pdf
# Create blank template
python takeoff.py template output.csv
# Convert extraction to CSV
python takeoff.py from-json extracted.json -o takeoff.csv
# Merge multiple takeoffs
python takeoff.py merge sheet1.csv sheet2.csv -o combined.csv
For tag counting:
Extract quantities from this electrical drawing. Run the extraction script first, then verify the counts against the image. Pay attention to the legend for any non-standard symbols.
For area measurement:
Calculate the floor area for tiling from this architectural plan. Extract vector data to get precise dimensions, verify the scale, then identify the tiled areas from the finish schedule.
For combined takeoff:
I need a full quantity takeoff for this hydraulic drawing - count all fixtures (WC, WHB, floor wastes, etc.) and measure the pipe runs. Use extraction for the fixture counts and trace the pipe routes visually.38:["$","$L42",null,{"content":"$43","frontMatter":{"name":"construction-takeoff","description":"Extract quantities from construction drawings using vector data extraction combined with AI vision. Handles tag counting (light fittings, power outlets, fixtures), area/volume measurement (concrete, flooring), and linear measurement (cable trays, pipes). Use when user uploads construction drawings and needs quantity takeoffs."}}]