AutoCAD to Google Earth - Custom AutoLISP Script
Custom AutoLISP Script
DWG to KML Converter
Transform your AutoCAD slope plans directly into Google Earth with GPS-calibrated accuracy
"Not every problem has a ready-made solution. Sometimes you have to build it yourself."
— Er. Alish Subedi
🎯 The Challenge
I needed a way to visualize my AutoCAD slope plan drawings directly on Google Earth accurately, not approximately. No existing plugin did exactly what I needed. Existing tools either lacked precision, couldn't handle Nepal's coordinate system, or produced KML files with unacceptable errors.
📐 Project Coordinate Bounds
🚀 My Journey: Building the Solution
No plugin could handle Nepal Grid with precision
Mastered entity reading & coordinate extraction
Nepal Grid → Lat/Long with GPS calibration
Achieved perfect KML output after iterations
The Solution
My custom AutoLISP script reads every entity in the drawing, converts Nepal National Grid coordinates to real-world latitude and longitude, applies GPS-calibrated corrections, and exports a clean KML file ready for Google Earth.
Key Features
- 📁 Reads all drawing entities automatically
- 🗺️ Precise Nepal Grid → Lat/Long conversion
- 📡 GPS-calibrated correction algorithm
- 📄 Clean, ready-to-use KML output
- 📐 Preserves all drawing geometry
📝 AutoLISP Code Snippet
(setq ss (ssget "_X"))
(foreach ent (vl-remove-if-not 'listp
(mapcar 'cadr (ssnamex ss)))
(setq coord (cdr (assoc 10 (entget ent))))
(setq lat (nepal-grid-to-lat coord))
(setq lon (nepal-grid-to-lon coord))
(write-kml-point lat lon)
)
)
The script processes each entity, transforms coordinates, and outputs clean KML markup ready for Google Earth import.
✅ What I Achieved
📚 Explore My Other Articles
📐 Ramp Modeling in ETABS
Inclined surface design, load analysis, and structural behavior
🌊 Flood Animation Using ArcMap
GIS-based flood simulation near Koshi Barrage, Nepal
🏗️ Pushover Analysis in ETABS
Nonlinear static analysis for seismic performance evaluation
⚙️ ETABS Section Designer
Creating custom frame sections with any shape imaginable
🏔️ Step-Back Building in ETABS
Designing resilient structures on sloped terrains
🤖 Interactive Map in 5 mins with AI
Using ChatGPT and DeepSeek to create Python maps
📊 Concrete Mix Design Calculator
Excel-based tool following IS10262:2019 and IS456:2000
🏗️ Box Culvert - First Lift Concreting
Multi-lift construction techniques for mass concrete
🏗️ Box Culvert- Main chamber(2mX2m) Concreting
Rebar arrangement, concrete and machinery arrangement
🪨 Mechanically Stabilized Earth (MSE) Wall
Compaction guidelines and density inspection requirements
💻 Interactive Choropleth MapUS-based Population Count