Import Kml To Autocad Civil 3d 2018 May 2026

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

public ObjectId Create3DPolyline(Point3dCollection points, Database db, Transaction tr) import kml to autocad civil 3d 2018

var geometries = new List<KmlGeometry>(); using (var stream = File.OpenRead(filepath)) public ObjectId CreateCogoPoint(double northing

var kmlFile = KmlFile.Load(stream); var root = kmlFile.Root as Kml; if (root?.Feature is Placemark placemark) // Extract coordinates if (placemark.Geometry is Point point) var coord = point.Coordinate; geometries.Add(new KmlGeometry(GeometryType.Point, new[] new Coordinate(coord.Latitude, coord.Longitude, coord.Altitude) )); else if (placemark.Geometry is LineString line) var coords = line.Coordinates.Select(c => new Coordinate(c.Latitude, c.Longitude, c.Altitude)).ToArray(); geometries.Add(new KmlGeometry(GeometryType.Polyline, coords)); else if (placemark.Geometry is Polygon polygon) // Extract outer boundary var coords = polygon.OuterBoundary.LinearRing.Coordinates.Select(c => new Coordinate(c.Latitude, c.Longitude, c.Altitude)).ToArray(); geometries.Add(new KmlGeometry(GeometryType.Polygon, coords)); var root = kmlFile.Root as Kml

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

return geometries; Use CoordinateSystemService from Civil 3D API:

Back
Top