📐 DWG/DXF Drawing Search System

Complete User Guide for Converting, Indexing, Searching, and Opening CAD Drawings

📋

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.

1. Convert DWG→DXF
2. Build Text Index
3. Search Interface
4. Open in TrueView
🔄

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

📝 Written by Douglas Millner
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)

3. Autodesk DWG TrueView (Free)

💡 Note: All required software is completely free. The Python scripts use only standard library, so no pip installations are needed.
1

Convert DWG to DXF

Run convert_dwg_to_dxf.py to batch convert all DWG files to DXF format.

📥 Download convert_dwg_to_dxf.py

🚀 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:

Before:
📁 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
✅ Benefits:
  • 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
2

Build Search Index

Run build_drawing_index.py to extract text from DXF files and create searchable index.

📥 Download build_drawing_index.py

🚀 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 index
    • drawing_index_keywords.json - Keyword statistics
  • Shows progress for every 50 files
  • Provides statistics on text entries and averages
💡 How It Works: The script reads DXF files as text (they're text-based format) and extracts content following specific DXF code patterns (codes 1, 3, 7). No external libraries needed!
⏱️ Processing Time: Now with smart estimates! The script counts files first and calculates realistic processing time based on your actual file count.
3

Start Drawing Opener Server

Run open_drawing_server.py to enable one-click opening of drawings from the search interface.

📥 Download open_drawing_server.py

🚀 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
💡 Important: Keep this server running in a terminal window while using the search interface. It's what makes the one-click opening work!
⚠️ Note: The search interface will work without the server, but you won't be able to open drawings with one click. You'll need to navigate to them manually.
4

Search and View Drawings

Open search_drawings_local.html in your web browser to search through all indexed drawings.

📥 Download search_drawings_local.html

🚀 How to Use:

  1. Make sure the server is running (open_drawing_server.py)
  2. Open in browser: http://127.0.0.1:8765 (the server serves the HTML)
  3. Load index: Click "Choose drawing_index.json" and select the file
  4. Start searching: Type any term and results appear instantly
  5. 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:

Individual Words (AND):
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
✅ Pro Tips:
  • 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:

❌ "ODA File Converter not found"
  • 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
❌ "DWG TrueView not found"
  • Install DWG TrueView to default location
  • Script searches versions 2020-2026 automatically
  • Check installation in: C:\Program Files\Autodesk\
❌ "Cannot connect to server"
  • 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
❌ "No search results"
  • 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")
❌ "Drawing won't open"
  • 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:

  1. Initial Setup:
    • Install all prerequisites (Python, ODA, TrueView)
    • Run conversion once on all drawings
    • Build initial index
    • Test search with known drawing numbers
  2. 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
  3. 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
✅ Performance Tips:
  • 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:

📥 Download All Required Files:
  • 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