Get Point as World Coordinate Value in C#

Is it possible to get the Pt Coordinates of a Get Point command in C# as World Coordinates or Cplane Coordinates depending on what has been set, instead of having to Round down and Format the pt coordinate that has come from the Get Point command which has the maximum number of decimal places and not limited to the DistanceDisplayPrecision.

This is taken from visual studio so only the part of the code for the command and not the library imports etc, though it based on the VS Project wizard example code.

            int tol = doc.DistanceDisplayPrecision;

            Point3d pt;
            Result rc  = Rhino.Input.RhinoGet.GetPoint("Set location of dot", false, out pt);
            if (rc != Result.Success)
                return rc;

            double ptx = Math.Round(pt.X, tol);
            double pty = Math.Round(pt.Y, tol);
            double ptz = Math.Round(pt.Z, tol);
            string value = string.Format("w{0},{1},{2}",ptx, pty,ptz);


Also slightly off topic but linked to the code snippet is it possible to set the text dot height and font as part of the add text dot or do I have to do this after it created.


Sure, try this:

Sure, just create a TextDot object, fill in the parameters, and then call doc.Objects.AdddTextDot.

Thanks this is, great. to better understand what’s happening could you explain why in this code:

The Get point returns world coordinates or screen coordinates with the doc.Distance Display Precision without the need for formatting. I realise this code is different as its dynamic so it does not output anything on screen.

This example does perform some string formatting with this statement:

var msg = string.Format("screen {0:F}, {1:F}", current_point.X, current_point.Y);

Note the “F” or Fixed-Point format: