ποΈ DXFConvertor: AI-Powered Architectural Drawing to DXF Converter
Inspiration
Architects and engineers frequently receive floor plans as scanned images or PDF documents instead of editable CAD files. Converting these documents into DXF format is traditionally a manual process that involves tracing walls, doors, windows, annotations, and furniture inside CAD softwareβa workflow that is both time-consuming and error-prone.
Our goal was to build an intelligent system capable of understanding architectural drawings and automatically generating professional DXF files while preserving structural information, room annotations, and architectural entities.
What it Does
DXFConvertor is an AI-powered CAD processing toolkit that converts architectural images and PDFs into editable DXF files.
The system automatically detects:
- π§± Walls
- πͺ Doors
- πͺ Windows
- ποΈ Columns
- πͺ Stairs
- ποΈ Furniture & Fixtures
- π Room Names using OCR
- π’ Multiple Floors from PDF documents
Besides generating AutoCAD-compatible DXF files, the application also produces structured JSON metadata containing every detected architectural component.
How We Built It
The project combines Computer Vision, OCR, Geometry Analysis, and CAD generation into a single processing pipeline.
Image Processing
We preprocess architectural drawings using:
- OpenCV
- Adaptive Thresholding
- Morphological Operations
- Edge Detection
- Hough Line Transform
- Contour Detection
This helps remove noise while preserving important structural details.
Entity Detection
After preprocessing, the system identifies architectural components based on:
- Line orientation
- Shape analysis
- Contour geometry
- Connected components
- Spatial relationships
Different algorithms classify walls, doors, windows, columns, stairs, furniture, and fixtures.
OCR
Room labels, dimensions, and textual annotations are extracted using OCR after deskewing and image enhancement.
DXF Generation
Detected entities are converted into AutoCAD-standard DXF objects using:
- Standard Layers
- Colors
- Line Types
- Line Weights
- Coordinate Mapping
The resulting DXF files can be opened directly in AutoCAD, LibreCAD, or DraftSight.
Multi-Floor Processing
For PDF floor plans, every page is treated as an individual floor.
The application automatically:
- Extracts each page
- Detects architectural entities
- Generates individual DXF files
- Produces JSON metadata
- Creates an overall building summary
System Workflow
Input Image / PDF
β
βΌ
Image Preprocessing
β
βΌ
Edge & Line Detection
β
βΌ
Architectural Entity Detection
β
βΌ
Furniture Detection
β
βΌ
OCR Annotation Extraction
β
βΌ
AutoCAD DXF Generation
β
βΌ
DXF + JSON Metadata
What We Learned
This project taught us that architectural drawings are significantly more complex than conventional computer vision datasets.
Some major learnings include:
- Image preprocessing greatly influences OCR accuracy.
- Computer vision alone is insufficient without architectural heuristics.
- Proper layer organization is essential for CAD interoperability.
- Modular software architecture makes large computer vision systems easier to maintain and extend.
- Small improvements in preprocessing can significantly improve downstream detection accuracy.
We also gained valuable experience integrating multiple technologies into a single production-ready workflow.
Challenges We Faced
Handling Different Drawing Standards
Floor plans vary widely in quality, scale, symbols, and drawing conventions.
We designed configurable preprocessing pipelines that adapt to different blueprint styles.
Distinguishing Similar Objects
Furniture often resembles walls or structural elements.
We combined:
- Shape descriptors
- Aspect ratios
- Area thresholds
- Spatial heuristics
to improve classification accuracy.
OCR Reliability
Scanned floor plans often contain:
- Noise
- Rotated text
- Low resolution
- Broken characters
To improve OCR performance, we implemented:
- Adaptive thresholding
- Deskewing
- Noise removal
- Morphological enhancement
CAD Compatibility
Producing DXF files compatible with professional CAD software required careful implementation of:
- AutoCAD layers
- Entity ordering
- Coordinate transformations
- Line styles
- Standard CAD conventions
Performance Optimization
Large buildings contain thousands of architectural entities.
We optimized our processing pipeline to reduce execution time while maintaining high detection quality.
Accomplishments We're Proud Of
- β Automated Image/PDF β DXF conversion
- β Multi-floor building processing
- β AI-assisted architectural entity detection
- β OCR-based room annotation extraction
- β Professional AutoCAD-standard DXF generation
- β Structured JSON metadata for downstream analysis
- β Modular, scalable architecture
Mathematical Perspective
One of our optimization goals was minimizing detection error.
The objective can be represented as
$$ E = \sum_{i=1}^{n} \left| P_i - G_i \right| $$
where:
- $P_i$ represents the predicted architectural entity
- $G_i$ represents the corresponding ground-truth entity
Our processing pipeline aims to minimize the total detection error:
$$ \min E $$
while maximizing structural consistency across the generated DXF.
What's Next
We plan to extend DXFConvertor with:
- π€ Deep Learning-based object detection
- π’ BIM (Building Information Modeling) integration
- π Automatic area and dimension estimation
- π οΈ Interactive web-based CAD editing
- βοΈ Cloud deployment for large-scale processing
- π AI-assisted building analytics
- π§© 3D floor plan reconstruction
Conclusion
DXFConvertor demonstrates how Computer Vision, OCR, and CAD automation can transform static architectural drawings into structured, editable CAD files. By automating a traditionally manual workflow, the project helps architects, engineers, and construction professionals reduce processing time, improve accuracy, and accelerate design workflows.
Built With
- pdf2image-ocr:-pytesseract-cad/dxf-handling:-ezdxf-data/geometry-support:-shapely
- pillow
- pytest
- scikit-image
- scikit-learn
- testing:
- the-stack-used-for-this-project-is:-language:-python-web-framework:-flask-image/pdf-processing:-opencv
Log in or sign up for Devpost to join the conversation.