Author Topic: ThisDrawing.Utility.TranslateCoordinates in .NET API  (Read 2122 times)

0 Members and 1 Guest are viewing this topic.

tik

  • Guest
ThisDrawing.Utility.TranslateCoordinates in .NET API
« on: December 21, 2011, 08:47:15 AM »
"I am converting a VBA project to .NET. I am looking for a equivalent code for ThisDrawing.Utility.TranslateCoordinates in .NET API.

<VBA Code>

Dim ThisBlockInsPoint As Variant

ThisBlockInsPoint = ThisDrawing.Utility.TranslateCoordinates(ThisBlockInsPoint, acWorld, acUCS, False)
ThisBlockInsPoint(0) = 0: ThisBlockInsPoint(2) = 0
ThisBlockInsPoint = ThisDrawing.Utility.TranslateCoordinates(ThisBlockInsPoint, acUCS, acWorld, False)

</VBA Code>

I wrote following functions in .NET. Are the follwing functions doing the same as above.

<.NET Code>   

public Point3d WCS2UCS(Point3d worldPoint)
{
Matrix3d wcs2ucs = ActiveDocument.Editor.CurrentUserCoordinateSystem.Inverse();
return worldPoint.TransformBy(wcs2ucs);
}

public Point3d UCS2WCS(Point3d ucsPoint)
{
Matrix3d ucs2wcs = ActiveDocument.Editor.CurrentUserCoordinateSystem;
return ucsPoint.TransformBy(ucs2wcs);
}

</.NET Code>"