GraphGists

Import: Kml To Autocad Civil 3d 2018

var pt = new AeccPoint(); pt.Northing = northing; pt.Easting = easting; pt.Elevation = elevation; // Add to block table record var bt = tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite) as BlockTableRecord; var ptId = bt.AppendEntity(pt); tr.AddNewlyCreatedDBObject(pt, true); return ptId;

// Coordinate system (optional: prompt user) string targetCsCode = GetDrawingCoordinateSystemCode(db);

// Parse KML var kmlData = ParseKML(filename); import kml to autocad civil 3d 2018

var geometries = new List<KmlGeometry>(); using (var stream = File.OpenRead(filepath))

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 pt = new AeccPoint(); pt

public Point2d ConvertLatLonToDrawing(double lat, double lon, string targetCsCode)

public List<KmlGeometry> ParseKML(string filepath) var pt = new AeccPoint()

return geometries; Use CoordinateSystemService from Civil 3D API: