Import Kml To Autocad Civil 3d 2018 Official

Document doc = Application.DocumentManager.MdiActiveDocument; Database db = doc.Database; Editor ed = doc.Editor; // File selection string filename = SelectKMLFile(); if (string.IsNullOrEmpty(filename)) return;

public ObjectId CreateCogoPoint(double northing, double easting, double elevation, Database db, Transaction tr)

return geometries; Use CoordinateSystemService from Civil 3D API: import kml to autocad civil 3d 2018

// Parse KML var kmlData = ParseKML(filename);

public List<KmlGeometry> ParseKML(string filepath) Document doc = Application

var sourceCs = "LL84"; // EPSG:4326 alias in Civil 3D var transform = CoordinateSystemService.CreateTransform(sourceCs, targetCsCode); double x, y; transform.TransformPoint(lon, lat, out x, out y); // note: lon → X, lat → Y return new Point2d(x, y);

var geometries = new List<KmlGeometry>(); using (var stream = File.OpenRead(filepath)) Document doc = Application.DocumentManager.MdiActiveDocument

tr.Commit();