The trick is that you don’t reach into the other command’s getter directly. A transparent/nestable command feeds its result back by typing it onto the command line, and the parent getter (GetPoint, GetNumber, GetDistance, …) parses that text as if the user had typed it. This is exactly how the built-in Distance command injects its value when you run it nested.
Mark your command transparent so it can run while another getter is active:
[CommandStyle(Style.Transparent)]
public class MyDistance : Command { ... }
Detect whether you’re running nested, and if so post the result via RhinoApp.RunScript.
protected override Result RunCommand(RhinoDoc doc, RunMode mode)
{
// ... get two points, compute the distance ...
double length = a.DistanceTo(b);
if (doc.InCommand(true) > 1) // we're nested inside another command's getter
RhinoApp.RunScript(doc.RuntimeSerialNumber, length.ToString(System.Globalization.CultureInfo.InvariantCulture), false);
else
RhinoApp.WriteLine($"Distance = {length}");
return Result.Success;
}
great - so this explicitly must not be a Script-Runner ?
therefore [CommandStyle(Style.ScriptRunner)] is not needed.
and for Point input like “_inBetween” ?
“RunScript” the Point to String with "G17" or "R" Format ?
or what is best practice to get full precision independend from document unit display precision ?