public static void GetLeaderPointsFromUser(string prompt, RhinoInteractionHandler…
- User
public static void GetLeaderPointsFromUser(string prompt, RhinoInteractionHandler interactionHandler) { Point3d startPoint = Point3d.Unset; using (var getPointAction = new GetPoint()) { getPointAction.SetCommandPrompt(prompt); getPointAction.AcceptNothing(true); // Allow pressing Enter to finish getPointAction.DynamicDraw += (sender, e) => { if (startPoint.IsValid) { // Draw the line from startPoint to current point e.Display.DrawLine(startPoint, e.CurrentPoint, Color.CornflowerBlue, 2); } };
while (true) { var res = getPointAction.Get(); if (interactionHandler.IsCancelled) { RhinoApp.WriteLine("Operation cancelled by user."); break; } if (res == GetResult.Point) { if (!startPoint.IsValid) { // First point of the pair startPoint = getPointAction.Point(); getPointAction.SetCommandPrompt("Lider Son Noktasını Seçin:"); getPointAction.SetBasePoint(startPoint, true); } else { // Second point of the pair Point3d endPoint = getPointAction.Point(); // Process the pair interactionHandler.ProcessLeaderPointPair(startPoint, endPoint, interactionHandler.IsCancelled); // Reset startPoint startPoint = Point3d.Unset; // Reset command prompt getPointAction.SetCommandPrompt("Yeni Konum Seçin Veya Bitirmek için Enter'a Basın:"); } } else if (res == GetResult.Nothing) { interactionHandler.GetGeometryData().Bake = true; // User pressed Enter break; } else if (res == GetResult.Cancel) { RhinoApp.WriteLine("Get operation cancelled."); break; } else { // Cancelled or error RhinoApp.WriteLine("Point selection cancelled or invalid."); break; } } }}
I have written this method for another purpose and now want something like this but with this functionality: the methode gets a Curve as inpout and then with the corrent point that the user is selecting comput a closest point on the curve and show the dynamic draw line between closest point and the current point and at the end return a list of poit3d contaninig the closest point and the point user selected
- Assistant
- User
The method should just get one point from user and when the get point is complete the list should returns and the method be done
- Assistant