/// <summary> RunCommandPickPlane is a helper method for picking an existing surface to draw on </summary> /// <param name="mRhinoDoc"></param> /// <param name="mode"></param> /// <returns></returns> protected Result RunCommandPickPlane(RhinoDoc mRhinoDoc, RunMode mode) { //routine for picking an existing surface to draw on //please select a plane Rhino.DocObjects.ObjectType filter = Rhino.DocObjects.ObjectType.Surface; Rhino.DocObjects.ObjRef objref = null; Rhino.Commands.Result rc = Rhino.Input.RhinoGet.GetOneObject("Select surface", false, filter, out objref); if (rc != Rhino.Commands.Result.Success || objref == null) { return(rc); } Rhino.Geometry.Surface refSrf = objref.Surface(); refSrf.FrameAt(.5, .5, out plane1); Point3d pOrigin = refSrf.PointAt(1, 1); Point3d pY = refSrf.PointAt(0.5, 1); Point3d pX = refSrf.PointAt(1, 0.75); Vector3d vX = Rhino.Geometry.Point3d.Subtract(pX, pOrigin); Vector3d vY = Rhino.Geometry.Point3d.Subtract(pY, pOrigin); plane1 = new Plane(pOrigin, vX, vY); Rhino.DocObjects.RhinoObject rhobj = objref.Object(); rhobj.Select(false); mRhinoDoc.Objects.AddPoint(pOrigin); mRhinoDoc.Objects.AddPoint(pX); mRhinoDoc.Objects.AddPoint(pY); mRhinoDoc.Views.Redraw(); return(Result.Success); }