I am not sure where the difference bwtween using AutoCAD Map built-in command/operation and using Platform API's calculation was from, in your case.
I just did a quick verification, like this:
1. I have a shape file created in projected coordinate system "NAD83.BC/Abers", in which a point's coordinate is X=1233743.880, Y=1196519.261.
2 I want to convert this point into projected coordinate system "UTM83-10".
So, here is what I did in different ways and the results are all the same, the converted UTM83-10 coordinate is X=545837.500, Y=6173925.001. (well, both of the coordinate systems have unit in "METER", thus the converted number may have tiny difference in the 5th, or 6th decimal, which is ignorable):
1. I start a blank drawing, assign UTM83-10 coordinate system to the blank drawing. Then I use "MapImport" command to import the shape into the drawing. Then I checked the point's coordinate.
2. I start a blank drawing, assign it UTM83-10 coordinate system, drag the shape into the drawing, which is equivalent to use MaFDO connection to load FDO data into AutoCAD MAP. This also correctly convert the NAD83.BC/Abers coordinate into UTM83-10 coordinate, the same as 1.
3. I wrote code to programmatically convert the coordinate with Platform API, just as you did (with actually moving the DBPoint). the result is the same. here is the code anyway:
using System;
using Autodesk.AutoCAD.Geometry;
using OSGeo.MapGuide;
namespace MapPlatformCsTranform
{
public class CoordConverter
{
public static void Convert(string fromCs, string toCs, Point2d fromPoint, out Point2d toPoint)
{
toPoint = Point2d.Origin;
var factory = new MgCoordinateSystemFactory();
var catalog = factory.GetCatalog();
var coordDic = catalog.GetCoordinateSystemDictionary();
MgCoordinateSystem fromCoord = null;
if (coordDic.Has(fromCs)) fromCoord = coordDic.GetCoordinateSystem(fromCs);
if (fromCoord==null)
{
throw new InvalidOperationException(
$"Coordinate system {fromCs} is not available in AutoCAD Map.");
}
MgCoordinateSystem toCoord = null;
if (coordDic.Has(toCs)) toCoord = coordDic.GetCoordinateSystem(toCs);
if (toCoord == null)
{
throw new InvalidOperationException(
$"Coordinate system {toCs} is not available in AutoCAD Map.");
}
var coordTransform = factory.GetTransform(fromCoord, toCoord);
var mgCoord = coordTransform.Transform(fromPoint.X, fromPoint.Y);
toPoint = new Point2d(mgCoord.X, mgCoord.Y);
}
}
}
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.Geometry;
using CadApp = Autodesk.AutoCAD.ApplicationServices.Application;
[assembly: CommandClass(typeof(MapPlatformCsTranform.MyCommands))]
namespace MapPlatformCsTranform
{
public class MyCommands
{
[CommandMethod("CalcCoord")]
public static void RunDocCommand()
{
var dwg = CadApp.DocumentManager.MdiActiveDocument;
var ed = dwg.Editor;
try
{
string sourceCs = "NAD83.BC/Abers";
string destiCs = "UTM83-10";
var sourcePoint = new Point2d(1233743.880, 1196519.261);
CoordConvertion(sourceCs, destiCs, sourcePoint);
sourceCs = "UTM83-10";
destiCs = "NAD83.BC/Abers";
sourcePoint = new Point2d(545837.50, 6173925.001);
CoordConvertion(sourceCs, destiCs, sourcePoint);
}
catch (System.Exception ex)
{
ed.WriteMessage("\nError: {0}", ex.Message);
ed.WriteMessage("\n*Cancel*");
}
finally
{
Autodesk.AutoCAD.Internal.Utils.PostCommandPrompt();
}
}
private static void CoordConvertion(string sourceCs, string destiCs, Point2d sourcePoint)
{
CoordConverter.Convert(sourceCs, destiCs, sourcePoint, out Point2d destiPoint);
var msg = $"Output point: x={destiPoint.X}, y={destiPoint.Y}";
CadApp.ShowAlertDialog(msg);
}
}
}
I did not try drawing set/attaching approach, but expect the result would be the same. So, whether you use AutoCAD built-in approaches, as I suggested in previous reply, or use AutoCAD platform API to calculate the coordinate, the result should be the same with negligible difference (because the numbers are float point numbers).