Viewport.GetUcs doesn't do what it's advertised to do, as in "This function returns the origin, x-axis, and y-axis of the ucs for this viewport."
Googling brought up a link from China four years old:
http://www.objectarx.net/forum.php?mod=viewthread&tid=340&page=1Are there more sleeping beauties?
public static class AcDbViewport
{
// Acad::ErrorStatus getUcs(AcGePoint3d& origin, AcGeVector3d& xAxis, AcGeVector3d& yAxis) const;
[DllImport("acdb18.dll", CallingConvention = CallingConvention.ThisCall, CharSet = CharSet.Unicode,
EntryPoint = "?getUcs@AcDbViewport@@QBE?AW4ErrorStatus@Acad@@AAVAcGePoint3d@@AAVAcGeVector3d@@1@Z")]
public static extern ErrorStatus getUcs(IntPtr viewport, out Point3d origin, out Vector3d xAxis, out Vector3d yAxis);
[CommandMethod("getUCSTest")]
public static void getUCSTest()
{
Document doc = Application.DocumentManager.MdiActiveDocument;
PromptEntityOptions peo = new PromptEntityOptions("\nSelect viewport: ");
peo.SetRejectMessage("\nOnly Viewport accepted. ");
peo.AddAllowedClass(typeof(Viewport), true);
PromptEntityResult per = doc.Editor.GetEntity(peo);
if (per.Status == PromptStatus.OK)
{
using (Transaction tr = doc.Database.TransactionManager.StartTransaction())
{
Viewport vp = (Viewport)per.ObjectId.GetObject(OpenMode.ForRead);
Point3d origin;
Vector3d x, y;
// vp.GetUcs<Ctrl-Space>: void Viewport.GetUcs(Point3d origin, Vector3d x, Vector3d y)
getUcs(vp.UnmanagedObject, out origin, out x, out y);
doc.Editor.WriteMessage("Ucs Origin: {0}\nUcs X: {1}\nUcs Y: {2}\n", origin, x, y);
tr.Commit();
}
}
}
}
The easy cure is a little p/invoken. Alas, I can't get it to work under F#2.0 when byref<System.ValueType> is involved.
Regards, Thorsten