protected override Result RunCommand(RhinoDoc doc, RunMode mode) { var getNumber = new GetInteger(); getNumber.SetLowerLimit(0, false); getNumber.SetUpperLimit(Environment.ProcessorCount, false); getNumber.SetDefaultInteger(RcCore.It.EngineSettings.Threads); getNumber.SetCommandPrompt($"Set CPU render threads (max {Environment.ProcessorCount}, 0 for automatic)"); var getRc = getNumber.Get(); if (getNumber.CommandResult() != Result.Success) { return(getNumber.CommandResult()); } if (getRc == GetResult.Number) { var nr = getNumber.Number(); var endS = nr != 1 ? "s" : ""; RhinoApp.WriteLine($"User wants {nr} CPU thread{endS}"); RcCore.It.EngineSettings.Threads = nr; return(Result.Success); } return(Result.Nothing); }
protected override Result RunCommand(RhinoDoc doc, RunMode mode) { (PlugIn as Plugin)?.InitialiseCSycles(); if (doc.Views.ActiveView.ActiveViewport.DisplayMode.Id == Guid.Parse("69E0C7A5-1C6A-46C8-B98B-8779686CD181")) { var rvp = doc.Views.ActiveView.RealtimeDisplayMode as RenderedViewport; if (rvp != null) { var getNumber = new GetInteger(); getNumber.SetLowerLimit(1, true); getNumber.SetDefaultInteger(rvp.HudMaximumPasses() + 100); getNumber.SetCommandPrompt("Set new sample count"); var getRc = getNumber.Get(); if (getNumber.CommandResult() != Result.Success) { return(getNumber.CommandResult()); } if (getRc == GetResult.Number) { var nr = getNumber.Number(); RhinoApp.WriteLine($"User changes samples to {nr}"); rvp.ChangeSamples(nr); return(Result.Success); } } } RhinoApp.WriteLine("Active view isn't rendering with Cycles"); return(Result.Nothing); }
protected override Result RunCommand(RhinoDoc doc, RunMode mode) { GetInteger getUserInteger = new GetInteger(); getUserInteger.SetCommandPrompt("Enter a valid Integer only (no decimal points):"); getUserInteger.SetDefaultInteger(1984); GetResult get_rn = getUserInteger.Get(); RhinoApp.WriteLine("The Roman Numeral version of " + getUserInteger.Number() + " is " + ArabicToRoman(getUserInteger.Number())); return(Result.Success); }
public override int EnterInteger(string prompt = "Enter integer value", int defaultValue = 0) { GetInteger gI = new GetInteger(); gI.SetCommandPrompt(prompt); gI.SetDefaultInteger(defaultValue); if (gI.Get() == GetResult.Cancel) { throw new OperationCanceledException("Operation cancelled by user"); } return(gI.Number()); }
protected override Result RunCommand(RhinoDoc doc, RunMode mode) { var getNumber = new GetInteger(); getNumber.SetLowerLimit(0, false); getNumber.SetUpperLimit(500, false); getNumber.SetDefaultInteger(RcCore.It.EngineSettings.ThrottleMs); getNumber.SetCommandPrompt("Set throttle (in ms)"); var toggleVerbose = new OptionToggle(RcCore.It.EngineSettings.Verbose, "No", "Yes"); var spotlightFactor = new OptionDouble(RcCore.It.EngineSettings.SpotlightFactor, 0.0, 1000000.0); var pointlightFactor = new OptionDouble(RcCore.It.EngineSettings.PointlightFactor, 0.0, 1000000.0); var sunlightFactor = new OptionDouble(RcCore.It.EngineSettings.SunlightFactor, 0.0, 1000000.0); var arealightFactor = new OptionDouble(RcCore.It.EngineSettings.ArealightFactor, 0.0, 1000000.0); var polishFactor = new OptionDouble(RcCore.It.EngineSettings.PolishFactor, 0.0, 1000000.0); getNumber.AddOptionToggle("verbose", ref toggleVerbose); getNumber.AddOptionDouble("spotlight_factor", ref spotlightFactor); getNumber.AddOptionDouble("pointlight_factor", ref pointlightFactor); getNumber.AddOptionDouble("sunlight_factor", ref sunlightFactor); getNumber.AddOptionDouble("arealight_factor", ref arealightFactor); getNumber.AddOptionDouble("polish_factor", ref polishFactor); while (true) { var getRc = getNumber.Get(); if (getNumber.CommandResult() != Result.Success) { return(getNumber.CommandResult()); } switch (getRc) { case GetResult.Nothing: case GetResult.Number: RcCore.It.EngineSettings.ThrottleMs = getNumber.Number(); ReadOptions(toggleVerbose, spotlightFactor, pointlightFactor, sunlightFactor, arealightFactor, polishFactor); break; case GetResult.Option: ReadOptions(toggleVerbose, spotlightFactor, pointlightFactor, sunlightFactor, arealightFactor, polishFactor); continue; default: continue; } break; } return(Result.Success); }
public static Result DisplayPrecision(RhinoDoc doc) { var gi = new GetInteger(); gi.SetCommandPrompt("New display precision"); gi.SetDefaultInteger(doc.ModelDistanceDisplayPrecision); gi.SetLowerLimit(0, false); gi.SetUpperLimit(7, false); gi.Get(); if (gi.CommandResult() != Result.Success) return gi.CommandResult(); var distance_display_precision = gi.Number(); if (distance_display_precision != doc.ModelDistanceDisplayPrecision) doc.ModelDistanceDisplayPrecision = distance_display_precision; return Result.Success; }
protected override Result RunCommand(RhinoDoc doc, RunMode mode) { (PlugIn as Plugin)?.InitialiseCSycles(); var numDevices = Device.Count; var endS = numDevices != 1 ? "s" : ""; RhinoApp.WriteLine($"We have {numDevices} device{endS}"); RhinoApp.WriteLine("----------"); foreach (var dev in Device.Devices) { if (dev.Id < 100000) { RhinoApp.WriteLine($" Device {dev.Id}: {dev.Name} ({dev.Description})"); } } RhinoApp.WriteLine("----------"); var getNumber = new GetInteger(); getNumber.SetLowerLimit(-1, false); getNumber.SetUpperLimit((int)(Device.Count - 1), false); getNumber.SetDefaultInteger(PlugIn.Settings.GetInteger("rc_renderdevice", -1)); getNumber.SetCommandPrompt($"Select device to render on (-1 for default, 0-{Device.Count - 1})"); var getRc = getNumber.Get(); if (getNumber.CommandResult() != Result.Success) { return(getNumber.CommandResult()); } if (getRc == GetResult.Number) { var idx = getNumber.Number(); Device dev = idx > -1 ? Device.GetDevice(idx) : Device.FirstCuda; RhinoApp.WriteLine($"User selected device {idx}: {dev}"); PlugIn.Settings.SetInteger("rc_renderdevice", idx); RcCore.It.EngineSettings.SelectedDeviceStr = idx.ToString(); return(Result.Success); } return(Result.Nothing); }
public static Result DisplayPrecision(RhinoDoc doc) { var gi = new GetInteger(); gi.SetCommandPrompt("New display precision"); gi.SetDefaultInteger(doc.ModelDistanceDisplayPrecision); gi.SetLowerLimit(0, false); gi.SetUpperLimit(7, false); gi.Get(); if (gi.CommandResult() != Result.Success) { return(gi.CommandResult()); } var distance_display_precision = gi.Number(); if (distance_display_precision != doc.ModelDistanceDisplayPrecision) { doc.ModelDistanceDisplayPrecision = distance_display_precision; } return(Result.Success); }
protected override Result RunCommand(RhinoDoc doc, RunMode mode) { (PlugIn as Plugin)?.InitialiseCSycles(); var numDevices = Device.Count; var endS = numDevices != 1 ? "s" : ""; RhinoApp.WriteLine($"We have {numDevices} device{endS}"); RhinoApp.WriteLine("----------"); List <int> allowedIds = new List <int>(); foreach (var dev in Device.Devices) { if (dev.Id >= 100000) { RhinoApp.WriteLine($" Device {dev.Id}: {dev.Name} ({dev.Description})"); allowedIds.Add((int)dev.Id); } } if (allowedIds.Count < 1) { RhinoApp.WriteLine("No multi-devices available"); return(Result.Nothing); } var lowest = allowedIds.Min(); var highest = allowedIds.Min(); RhinoApp.WriteLine("----------"); var getNumber = new GetInteger(); getNumber.SetLowerLimit(lowest, false); getNumber.SetUpperLimit(highest, false); getNumber.SetDefaultInteger(lowest); getNumber.SetCommandPrompt($"Select multi-device to render"); var getRc = getNumber.Get(); if (getNumber.CommandResult() != Result.Success) { return(getNumber.CommandResult()); } if (getRc == GetResult.Number) { var idx = getNumber.Number(); Device dev = Device.GetDevice(idx); RhinoApp.WriteLine($"User selected device {idx}: {dev}"); List <int> sdidx = new List <int>(); if (dev.IsMulti) { foreach (var sd in dev.SubdevicesIndex) { RhinoApp.WriteLine($" {sd.Item1} {sd.Item2}"); sdidx.Add(sd.Item1); } } var idxstr = string.Join(",", sdidx); RcCore.It.EngineSettings.SelectedDeviceStr = idxstr; return(Result.Success); } return(Result.Nothing); }