System Overview
This is a complete CAD drawing management system that allows you to convert, index, search, and open thousands of drawings instantly. The system consists of four main components working together seamlessly.
Batch Conversion
Automatically converts all DWG files to searchable DXF format
Smart Indexing
Extracts and indexes all text from drawings with intelligent estimates
Instant Search
Search thousands of drawings in milliseconds with advanced filters
One-Click Open
Click any result to instantly open in Autodesk DWG TrueView
NERX Power Consultants LLC
Social, Website, and Blog - https://linktr.ee/nerxpower
⚠️ DISCLAIMER: The software is free for distribution. The user assumes all risk.
Prerequisites & Installation
Required Software:
1. Python 3.6 or Higher
- Download from: https://www.python.org/downloads/
- During installation, check "Add Python to PATH"
- No additional Python packages required - uses only built-in libraries
2. ODA File Converter (Free)
- Download from: https://www.opendesign.com/guestfiles/oda_file_converter
- Completely free, no registration required
- Install to default location for automatic detection
- Converts between DWG and DXF formats
3. Autodesk DWG TrueView (Free)
- Download from: https://www.autodesk.com/products/dwg/viewers
- Free official Autodesk viewer
- Opens DWG and DXF files
- Allows viewing, measuring, and printing
Convert DWG to DXF
Run convert_dwg_to_dxf.py to batch convert all DWG files to DXF format.
🚀 How to Run:
python convert_dwg_to_dxf.py
📂 What It Does:
- Scans recursively through current directory and ALL subdirectories
- Counts files first and displays accurate conversion time estimates
- Creates parallel directory structure with '-dxf' suffix for organization
- Converts to DXF using ODA File Converter (AutoCAD 2018 DXF format)
- Skips existing files to save time on subsequent runs
- Shows progress for each file with success/failure status
- Provides summary of successful, failed, and skipped conversions
📁 Directory Structure Example:
📁 c:/selkirk4/autocad print - DXF/
├── drawing1.dwg
├── 📁 HRSG/
│ └── boiler.dwg
└── 📁 2-POA/
└── panel.dwg
After:
📁 c:/selkirk4/autocad print - DXF/
├── drawing1.dwg
├── drawing1.dxf ← New!
├── 📁 HRSG/
│ └── boiler.dwg
├── 📁 HRSG-dxf/ ← New parallel structure!
│ └── boiler.dxf
├── 📁 2-POA/
│ └── panel.dwg
└── 📁 2-POA-dxf/ ← New parallel structure!
└── panel.dxf
- Original DWG files are never modified or touched
- Easy to identify converted files (all in -dxf directories)
- Can delete all DXF directories easily if needed
- Maintains exact organizational structure
Build Search Index
Run build_drawing_index.py to extract text from DXF files and create searchable index.
🚀 How to Run:
python build_drawing_index.py
📊 What It Does:
- Counts DXF files first and provides smart estimates:
- Actual file count detected
- Processing time estimated (based on ~0.08-0.15 sec/file)
- Index file size estimated (based on ~8-10 KB/file)
- Extracts ALL text from DXF files including:
- Drawing titles and numbers
- Part numbers and specifications
- Notes and annotations
- Dimensions and labels
- Table data and schedules
- Creates two JSON files:
drawing_index.json- Complete searchable indexdrawing_index_keywords.json- Keyword statistics
- Shows progress for every 50 files
- Provides statistics on text entries and averages
Start Drawing Opener Server
Run open_drawing_server.py to enable one-click opening of drawings from the search interface.
🚀 How to Run:
python open_drawing_server.py
🌐 What It Does:
- Starts HTTP server on localhost:8765
- Auto-detects DWG TrueView installation location
- Accepts drawing open requests from the web interface
- Opens drawings in Autodesk DWG TrueView automatically
- Shows diagnostics for TrueView detection
- Logs all operations with success/failure status
📋 Server Features:
- Runs in the background while you search
- Automatically finds TrueView 2020-2026 versions
- Handles multiple drawing open requests
- Press Ctrl+C to stop the server
Search and View Drawings
Open search_drawings_local.html in your web browser to search through all indexed drawings.
🚀 How to Use:
- Make sure the server is running (open_drawing_server.py)
- Open in browser:
http://127.0.0.1:8765(the server serves the HTML) - Load index: Click "Choose drawing_index.json" and select the file
- Start searching: Type any term and results appear instantly
- Click to open: Click any result to open in DWG TrueView
✨ Search Features:
- Instant Results: Search happens as you type (or click Update Results)
- Multiple Search Modes:
- Match ALL words (AND logic) - default
- Match ANY word (OR logic)
- Exact phrases (use quotes: "motor control center")
- Regex patterns (advanced users)
- Advanced Filters:
- Case sensitive option
- Whole word matching
- Exclusion terms (exclude unwanted results)
- Result Features:
- Expandable text preview with highlighting
- Match count for each file
- Export results to CSV
- Quick Search Buttons: Transformer, XFMR, CT, Bus, Breaker, etc.
🔍 Search Examples:
transformer 480V panel
→ Finds drawings with ALL three words
Individual Words (OR):
Select "Match ANY word", then: transformer relay motor
→ Finds drawings with ANY of these words
Exact Phrase:
"motor control center"
→ Finds this EXACT phrase in this EXACT order
Mixed Search:
480V "control panel" breaker
→ Finds 480V and breaker anywhere, plus exact phrase
With Exclusions:
Search: transformer
Exclude: backup old temp
→ Finds transformer but excludes backup/old/temp files
- Use quotes for exact phrases
- Combine individual words and phrases in one search
- Use exclusion box to filter out unwanted results
- Click result to expand and see all matching text highlighted
- Export to CSV to share search results with colleagues
Troubleshooting
Common Issues and Solutions:
- Install ODA File Converter to default location
- Check installation in: C:\Program Files\ODA\ or C:\Program Files (x86)\ODA\
- Script searches common locations automatically
- Install DWG TrueView to default location
- Script searches versions 2020-2026 automatically
- Check installation in: C:\Program Files\Autodesk\
- Make sure open_drawing_server.py is running
- Access page via http://127.0.0.1:8765 (not file:///)
- Check firewall isn't blocking localhost:8765
- Verify you loaded drawing_index.json in the search page
- Make sure build_drawing_index.py completed successfully
- Check that DXF files exist in your directory
- Try a broader search term first (e.g., just "panel")
- Verify DWG TrueView is installed and working
- Check that the DXF file exists at the displayed path
- Manually try to open the file in TrueView to test
- Check server console for error messages
Best Practices & Tips
Recommended Workflow:
- Initial Setup:
- Install all prerequisites (Python, ODA, TrueView)
- Run conversion once on all drawings
- Build initial index
- Test search with known drawing numbers
- Daily Use:
- Start open_drawing_server.py in a terminal
- Access search page at http://127.0.0.1:8765
- Search and open drawings as needed
- Updates:
- Re-run convert_dwg_to_dxf.py when adding new drawings
- Re-run build_drawing_index.py to update the index
- Index updates in minutes, not hours
- Search is extremely fast - handles 1000s of drawings instantly
- Keep index up-to-date - re-index when drawings change
- Use exclusion filters - eliminate old/backup files from results
- Bookmark the server URL - quick access to search
- Keep DWG originals - DXF files are for searching only
System Requirements:
- Disk Space: DXF files = ~same size as DWG files
- Index Size: ~8-10 KB per drawing (e.g., 3,879 files = ~35 MB)
- RAM: Minimal - index loads into browser memory
- CPU: Any modern processor - indexing is I/O bound
Complete File Reference
Python Scripts:
- convert_dwg_to_dxf.py - Download
- Batch converts DWG to DXF using ODA File Converter
- Creates parallel directory structure
- Shows progress and provides conversion statistics
- build_drawing_index.py - Download
- Extracts text from DXF files
- Creates searchable JSON index
- Provides smart estimates based on file count
- Generates keyword statistics
- open_drawing_server.py - Download
- HTTP server for opening drawings
- Auto-detects DWG TrueView installation
- Serves the search interface
- Handles drawing open requests
Web Interface:
- search_drawings_local.html - Download
- Full-featured search interface
- Advanced search options (AND/OR, regex, exclusions)
- One-click drawing opening via server
- Result highlighting and CSV export
Generated Files:
- drawing_index.json - Complete searchable index (~35 MB for 3,879 files)
- drawing_index_keywords.json - Keyword statistics and counts
- *.dxf files - Converted drawings in -dxf directories
External Dependencies:
- Python 3.6+ - No pip packages required (uses standard library)
- ODA File Converter - Free DWG/DXF converter
- Autodesk DWG TrueView - Free drawing viewer