Screen point to world xz plane or world zy plane in c#

Hi:
Rhino.Display.RhinoView view = doc.Views.ActiveView;
Rhino.Geometry.Transform xform = view.ActiveViewport.GetTransform(
Rhino.DocObjects.CoordinateSystem.Screen,
Rhino.DocObjects.CoordinateSystem.World
);
Rhino.Geometry.Point3d world_point = new Rhino.Geometry.Point3d(
screen_point.X,
screen_point.Y,
0.0
);
world_point.Transform(xform);

this core cant transform screen point to world xy plane, it is any way to tranform screen point to wold xz plane or world yz plane?

If you want to transform some from one coordinate system to another (e.g. from world xy-plane to construction plane or vise versa), then create a change of basis transformation - Transform.ChangeBasis.

Here is an example:
https://github.com/dalefugier/SampleCsCommands/blob/master/SampleCsBoundingBox.cs

Think you@dale, I get your means.

Hi Dale,

Do you have this updated .cs file? I try to search on your github while there isn’t…

thx

Thank you Dale for your prompt reply.

What I understood is that this method GetObject requires a mouse click, right? What if I just want to track the location of the cursor?

I have something similar to @pythonuser which can successfully track the cursor. While I am wondering why there is a “gap”… between the cursor and the point(see below gif)… Could you give me some suggestions?

    //current viewport
    var view = doc.Views.ActiveView;
    //xform matrix
    var xform = view.ActiveViewport.GetTransform(Rhino.DocObjects.CoordinateSystem.Screen, Rhino.DocObjects.CoordinateSystem.World);
    //cursor(screen coordinate system)
    var point = new Rhino.Geometry.Point3d(Rhino.UI.MouseCursor.Location.X, Rhino.UI.MouseCursor.Location.Y, 0.0);
    //transform
    point.Transform(xform);

    Line cursorToOrigin = new Line(point, new Point3d(0, 0, 0));

    A = point;
    B = cursorToOrigin;

Why? What problem are you trying to solve?

– Dale

I want an instance of Point3d at where my cursor is. Apparently they are not overlapped right now

Is there any reason you don’t just use a GetPoint object?

– Dale

Hi Dale,
thanks again for the prompt reply. I want to create a sort of interaction between the cursor and Rhino. GetPoint is a solution while it requires user’s input through Rhino console. I think the “cursor” way is more smooth🤔