AutoCAD to Google Earth - Custom AutoLISP Script

AutoCAD to Google Earth - AutoLISP Script | Er. Alish Subedi
⚡ AUTOCAD → GOOGLE EARTH | AUTOLISP

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

EASTING MIN
617262.0 m
EMIN
EASTING MAX
620269.0 m
EMAX
NORTHING MIN
3029816.0 m
NMIN
NORTHING MAX
3034836.0 m
NMAX

🚀 My Journey: Building the Solution

1
Identifying the Gap
No plugin could handle Nepal Grid with precision
2
Learning AutoLISP
Mastered entity reading & coordinate extraction
3
Coordinate Transformation
Nepal Grid → Lat/Long with GPS calibration
4
Testing & Refining
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

defun c:DWG2KML ( / ss ent ename ptList)
;; Select all entities in drawing
(setq ss (ssget "_X"))
;; Loop through each entity
(foreach ent (ssnamex ss)
;; Extract coordinates
(setq ptList (cons (get-coordinates ent) ptList))
)
;; Convert to KML format
(write-kml ptList)
princ
)
💡 Key Note: The script handles coordinate transformation from Nepal National Grid to WGS84 with GPS calibration.

✅ What I Achieved

Accurate slope plan overlay on Google Earth
GPS-calibrated coordinate correction
Clean, ready-to-use KML files
No manual coordinate entry needed
🖥️ AutoLISP 📐 AutoCAD 🗺️ Google Earth 📡 GPS Calibration 📁 KML Export 🇳🇵 Nepal Grid 🔄 Coordinate Transform
#AutoLISP #AutoCAD #GoogleEarth #KML #DWG #CoordinateTransformation #CivilEngineering #NepalGrid