protected override Result RunCommand(RhinoDoc doc, RunMode mode) { Rhino.UI.OpenFileDialog dialog = new Rhino.UI.OpenFileDialog(); dialog.Title = "Open pointcloud file"; dialog.ShowOpenDialog(); Rhino.Input.Custom.OptionInteger optStep = new Rhino.Input.Custom.OptionInteger(4, 1, 1000); Rhino.Input.Custom.GetOption getOpt = new Rhino.Input.Custom.GetOption(); getOpt.AddOptionInteger("Resolution", ref optStep); getOpt.SetCommandPrompt("Loading options"); string path = dialog.FileName; if (!System.IO.File.Exists(path)) { Rhino.RhinoApp.WriteLine("Farhino: Failed to find file..."); return(Result.Failure); } getOpt.Get(); Rhino.RhinoApp.WriteLine("Farhino: Step value: " + optStep.CurrentValue.ToString()); RFContext.LoadScan(path, optStep.CurrentValue); return(Result.Success); }
private void GetNestingSettings() { //Parameters Rhino.Input.Custom.GetOption gp = new Rhino.Input.Custom.GetOption(); gp.SetCommandPrompt("OpenNest: Set nesting settings"); Rhino.Input.Custom.OptionInteger Iterations = new Rhino.Input.Custom.OptionInteger(1, 1, 100); Rhino.Input.Custom.OptionDouble Spacing = new Rhino.Input.Custom.OptionDouble(0.01, 0.001, 10); Rhino.Input.Custom.OptionInteger Placement = new Rhino.Input.Custom.OptionInteger(1, 0, 4); Rhino.Input.Custom.OptionDouble Tolerance = new Rhino.Input.Custom.OptionDouble(0.1, 0.01, 10); Rhino.Input.Custom.OptionInteger Rotations = new Rhino.Input.Custom.OptionInteger(4, 0, 360); Rhino.Input.Custom.OptionInteger Seed = new Rhino.Input.Custom.OptionInteger(0, 1, 100); Rhino.Input.Custom.OptionDouble ClosestObjects = new Rhino.Input.Custom.OptionDouble(0.01, 0, 100); gp.AddOptionInteger("Iterations", ref Iterations); gp.AddOptionDouble("Spacing", ref Spacing); gp.AddOptionInteger("Placement", ref Placement); gp.AddOptionDouble("Tolerance", ref Tolerance); gp.AddOptionInteger("Rotations", ref Rotations); gp.AddOptionInteger("Seed", ref Seed); gp.AddOptionDouble("ClosestObjects", ref ClosestObjects); while (true) { Rhino.Input.GetResult get_rc = gp.Get(); if (gp.CommandResult() != Rhino.Commands.Result.Success) { break; } } this.iterations = Iterations.CurrentValue; this.spacing = Spacing.CurrentValue; this.placementType = Placement.CurrentValue; this.tolerance = Tolerance.CurrentValue; this.rotations = Rotations.CurrentValue; this.seed = Seed.CurrentValue; this.spacing *= (1 / tolerance); this.cp = ClosestObjects.CurrentValue; }