/// <summary> /// Node GetCurrentCoordinateSystem return the name of current CS (assigned to drawing) /// </summary> /// <returns></returns> public static string GetCurrentCoordinateSystem() { Autodesk.Gis.Map.Platform.AcMapMap map = Autodesk.Gis.Map.Platform.AcMapMap.GetCurrentMap(); string wkt = map.GetMapSRS(); OSGeo.MapGuide.MgCoordinateSystemFactory factory = new OSGeo.MapGuide.MgCoordinateSystemFactory(); string csCode = factory.ConvertWktToCoordinateSystemCode(wkt); return(csCode); }
/// <summary> /// Assign CS to drawing from WKT code (as string) /// </summary> /// <param name="wkt"></param> public static void AssignCSFromWKT(string wkt) { CivilDocument c3d_doc = Autodesk.Civil.ApplicationServices.CivilApplication.ActiveDocument; var Units_Window = c3d_doc.Settings.DrawingSettings; Document m_Doc = Application.DocumentManager.MdiActiveDocument; Database db = m_Doc.Database; OSGeo.MapGuide.MgCoordinateSystemFactory factory = new OSGeo.MapGuide.MgCoordinateSystemFactory(); string csCode = factory.ConvertWktToCoordinateSystemCode(wkt); using (Transaction tr = db.TransactionManager.StartTransaction()) { Units_Window.UnitZoneSettings.CoordinateSystemCode = csCode; tr.Commit(); } }