protected override Result RunCommand(RhinoDoc doc, RunMode mode) { var getNumber = new GetInteger(); getNumber.SetLowerLimit(2, false); getNumber.SetUpperLimit(10000000, false); getNumber.SetDefaultInteger(RcCore.It.EngineSettings.Samples); getNumber.SetCommandPrompt("Set Debug Options"); var toggleVerbose = new OptionToggle(RcCore.It.EngineSettings.Verbose, "No", "Yes"); var toggleInteractive = new OptionToggle(RcCore.It.EngineSettings.UseInteractiveRenderer, "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.AddOptionToggle("use_interactive_renderer", ref toggleInteractive); 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.Samples = getNumber.Number(); ReadOptions(toggleVerbose, toggleInteractive, spotlightFactor, pointlightFactor, sunlightFactor, arealightFactor, polishFactor); break; case GetResult.Option: ReadOptions(toggleVerbose, toggleInteractive, spotlightFactor, pointlightFactor, sunlightFactor, arealightFactor, polishFactor); continue; default: continue; } break; } return Result.Success; }
public static Rhino.Commands.Result CommandLineOptions(Rhino.RhinoDoc doc) { // For this example we will use a GetPoint class, but all of the custom // "Get" classes support command line options. Rhino.Input.Custom.GetPoint gp = new Rhino.Input.Custom.GetPoint(); gp.SetCommandPrompt("GetPoint with options"); // set up the options Rhino.Input.Custom.OptionInteger intOption = new Rhino.Input.Custom.OptionInteger(1, 1, 99); Rhino.Input.Custom.OptionDouble dblOption = new Rhino.Input.Custom.OptionDouble(2.2, 0, 99.9); Rhino.Input.Custom.OptionToggle boolOption = new Rhino.Input.Custom.OptionToggle(true, "Off", "On"); string[] listValues = new string[] { "Item0", "Item1", "Item2", "Item3", "Item4" }; gp.AddOptionInteger("Integer", ref intOption); gp.AddOptionDouble("Double", ref dblOption); gp.AddOptionToggle("Boolean", ref boolOption); int listIndex = 3; int opList = gp.AddOptionList("List", listValues, listIndex); while (true) { // perform the get operation. This will prompt the user to input a point, but also // allow for command line options defined above Rhino.Input.GetResult get_rc = gp.Get(); if (gp.CommandResult() != Rhino.Commands.Result.Success) return gp.CommandResult(); if (get_rc == Rhino.Input.GetResult.Point) { doc.Objects.AddPoint(gp.Point()); doc.Views.Redraw(); Rhino.RhinoApp.WriteLine("Command line option values are"); Rhino.RhinoApp.WriteLine(" Integer = {0}", intOption.CurrentValue); Rhino.RhinoApp.WriteLine(" Double = {0}", dblOption.CurrentValue); Rhino.RhinoApp.WriteLine(" Boolean = {0}", boolOption.CurrentValue); Rhino.RhinoApp.WriteLine(" List = {0}", listValues[listIndex]); } else if (get_rc == Rhino.Input.GetResult.Option) { if (gp.OptionIndex() == opList) listIndex = gp.Option().CurrentListOptionIndex; continue; } break; } return Rhino.Commands.Result.Success; }
protected override Result RunCommand(RhinoDoc doc, RunMode mode) { ObjRef obj_ref; var rc = RhinoGet.GetOneObject("Select surface", false, ObjectType.Surface, out obj_ref); if (rc != Result.Success || obj_ref == null) return rc; var surface = obj_ref.Surface(); var gp = new GetPoint(); gp.SetCommandPrompt("Point on surface"); gp.Constrain(surface, false); var option_toggle = new OptionToggle(false, "U", "V"); gp.AddOptionToggle("Direction", ref option_toggle); Point3d point = Point3d.Unset; while (true) { var grc = gp.Get(); if (grc == GetResult.Option) continue; else if (grc == GetResult.Point) { point = gp.Point(); break; } else return Result.Nothing; } if (point == Point3d.Unset) return Result.Nothing; int direction = option_toggle.CurrentValue ? 1 : 0; // V : U double u_parameter, v_parameter; if (!surface.ClosestPoint(point, out u_parameter, out v_parameter)) return Result.Failure; var iso_curve = surface.IsoCurve(direction, direction == 1 ? u_parameter : v_parameter); if (iso_curve == null) return Result.Failure; doc.Objects.AddCurve(iso_curve); doc.Views.Redraw(); return Result.Success; }
protected override Result RunCommand(RhinoDoc doc, RunMode mode) { Rhino.Input.Custom.GetOption go = new GetOption(); go.SetCommandPrompt("Set Faro scan settings"); Rhino.Input.Custom.GetString gs = new GetString(); gs.SetCommandPrompt("Set Faro IP address."); gs.SetDefaultString("127.0.0.1"); gs.AddOption("Scanner IP"); gs.Get(); string val = gs.StringResult(); Rhino.RhinoApp.WriteLine("IP: " + val); // set up the options Rhino.Input.Custom.OptionInteger intOption = new Rhino.Input.Custom.OptionInteger(1, 1, 99); Rhino.Input.Custom.OptionDouble dblOption = new Rhino.Input.Custom.OptionDouble(2.2, 0, 99.9); Rhino.Input.Custom.OptionToggle boolOption = new Rhino.Input.Custom.OptionToggle(true, "Off", "On"); string[] resolutionValues = new string[] { "Full", "Half", "Quarter", "Eighth", "Sixsteenth" }; string[] measurementValues = new string[] { "Low", "Medium", "High" }; string[] noiseValues = new string[] { "Low", "Medium", "High" }; go.AddOptionInteger("Integer", ref intOption); go.AddOptionDouble("Double", ref dblOption); go.AddOptionToggle("Boolean", ref boolOption); int resolutionIndex = 2; int measurementIndex = 1; int noiseIndex = 1; int resolutionList = go.AddOptionList("Resolution", resolutionValues, resolutionIndex); int measurementList = go.AddOptionList("MeasurementRate", measurementValues, measurementIndex); int noiseList = go.AddOptionList("NoiseCompression", noiseValues, noiseIndex); while (true) { // perform the get operation. This will prompt the user to input a point, but also // allow for command line options defined above Rhino.Input.GetResult get_rc = go.Get(); Rhino.RhinoApp.WriteLine(get_rc.ToString()); if (go.CommandResult() != Rhino.Commands.Result.Success) { return(go.CommandResult()); } if (get_rc == Rhino.Input.GetResult.Nothing) { //doc.Objects.AddPoint(go.Point()); doc.Views.Redraw(); Rhino.RhinoApp.WriteLine("Command line option values are"); Rhino.RhinoApp.WriteLine(" Integer = {0}", intOption.CurrentValue); Rhino.RhinoApp.WriteLine(" Double = {0}", dblOption.CurrentValue); Rhino.RhinoApp.WriteLine(" Boolean = {0}", boolOption.CurrentValue); Rhino.RhinoApp.WriteLine(" Measurement rate = {0}", measurementValues[measurementIndex]); Rhino.RhinoApp.WriteLine(" Resolution = {0}", resolutionValues[resolutionIndex]); } else if (get_rc == Rhino.Input.GetResult.Option) { if (go.OptionIndex() == resolutionList) { resolutionIndex = go.Option().CurrentListOptionIndex; } else if (go.OptionIndex() == measurementList) { measurementIndex = go.Option().CurrentListOptionIndex; } continue; } break; } return(Rhino.Commands.Result.Success); }
protected override Result RunCommand(RhinoDoc doc, RunMode mode) { double tolerance = doc.ModelAbsoluteTolerance; List <Curve> curves = new List <Curve>(); //Select surface GetObject gs = new Rhino.Input.Custom.GetObject(); gs.SetCommandPrompt("Surface to orient on"); gs.GeometryFilter = Rhino.DocObjects.ObjectType.Surface; gs.SubObjectSelect = true; gs.DeselectAllBeforePostSelect = true; gs.OneByOnePostSelect = true; gs.Get(); if (gs.CommandResult() != Result.Success) { return(gs.CommandResult()); } Rhino.DocObjects.ObjRef objref_Surface = gs.Object(0); Rhino.DocObjects.RhinoObject obj = objref_Surface.Object(); if (obj == null) { return(Result.Failure); } surface = objref_Surface.Surface(); if (surface == null) { return(Result.Failure); } obj.Select(false); //Select Line(s) GetObject gl = new GetObject(); gl.SetCommandPrompt("Select one or two line(s)"); gl.GeometryFilter = Rhino.DocObjects.ObjectType.Curve; gl.DeselectAllBeforePostSelect = true; gl.OneByOnePostSelect = true; gl.GetMultiple(1, 0); for (int i = 0; i < gl.ObjectCount; i++) { Rhino.DocObjects.ObjRef objref_Line = gl.Object(i); curve = objref_Line.Curve(); Curve curveRe = curve.Rebuild(60, 3, true); curves.Add(curveRe); } List <Guid> cir_guid_list = new List <Guid>(); if (curves.Count > 1) { Curve curve2 = curves[0]; Curve curve3 = curves[1]; if (curve2.IsClosed || curve3.IsClosed) { Rhino.UI.Dialogs.ShowMessage("Please only select open curves for two line pave.", "Warning!"); return(Result.Failure); } while (true) { cir_guid_list = new List <Guid>(); var tweenCurves = Curve.CreateTweenCurvesWithSampling(curve2, curve3, 1, 30, tolerance); Curve tCurve = tweenCurves[0]; //3 point circle Point3d po1 = curve2.PointAtStart; Point3d po2 = curve3.PointAtStart; LineCurve line1 = new LineCurve(po1, po2); double[] param = line1.DivideByCount(2, false); double param1 = param[0]; double param2 = param[0]; double param3 = param[0]; Curve curve1 = line1; while (true) { Circle outCircle = Circle.TryFitCircleTTT(curve1, curve2, curve3, param1, param2, param3); //circle normal to surface Point3d outCircleCenter = outCircle.Center; double outCircleRadius = outCircle.Radius; double u, v; surface.ClosestPoint(outCircleCenter, out u, out v); var direction = surface.NormalAt(u, v); Point3d surfCenter = surface.PointAt(u, v); Plane pl1 = new Plane(surfCenter, direction); Circle circle = new Circle(pl1, surfCenter, outCircleRadius - offSetStone); Circle circleDist = new Circle(pl1, surfCenter, outCircleRadius + stoneDist); Guid cir_guid = doc.Objects.AddCircle(circle); cir_guid_list.Add(cir_guid); //Cut tween curve at latest circle center Point3d pointOnCurve; Point3d pointOnCircle; Curve circleDistCurve = circleDist.ToNurbsCurve(); tCurve.Domain = new Interval(0, tCurve.GetLength()); Curve[] splitCurves = tCurve.Split(outCircleRadius); if (splitCurves is null) { break; } tCurve = splitCurves[splitCurves.Length - 1]; tCurve.ClosestPoints(circleDistCurve, out pointOnCurve, out pointOnCircle); //Cut tween curve at latest circle border double curveSplitParam; tCurve.Domain = new Interval(0, tCurve.GetLength()); tCurve.ClosestPoint(pointOnCurve, out curveSplitParam); splitCurves = tCurve.Split(curveSplitParam); if (splitCurves is null) { break; } tCurve = splitCurves[splitCurves.Length - 1]; //New parameter at curve1 double circleParam; circleDistCurve.ClosestPoint(pointOnCircle, out circleParam); param1 = circleParam; curve1 = circleDistCurve; //New parameter at curves[0] double paramCurve0New; curve2.ClosestPoint(pointOnCircle, out paramCurve0New); Point3d pointCurve0New = curve2.PointAt(paramCurve0New); double distNewPoints0 = pointOnCircle.DistanceTo(pointCurve0New); param2 = paramCurve0New + distNewPoints0; //New parameter at curves[1] double paramCurve1New; curve3.ClosestPoint(pointOnCircle, out paramCurve1New); Point3d pointCurve1New = curve3.PointAt(paramCurve1New); double distNewPoints1 = pointOnCircle.DistanceTo(pointCurve1New); param3 = paramCurve1New + distNewPoints1; } doc.Views.Redraw(); //Options var go = new GetOption(); go.SetCommandPrompt("Set options."); var stoneOff = new Rhino.Input.Custom.OptionDouble(offSetStone); var distStone = new Rhino.Input.Custom.OptionDouble(stoneDist); var boolOption = new Rhino.Input.Custom.OptionToggle(false, "Off", "On"); go.AddOptionDouble("Offset", ref stoneOff); go.AddOptionDouble("Distance", ref distStone); go.AddOptionToggle("Reverse", ref boolOption); go.AcceptNothing(true); var res = go.Get(); if (res == GetResult.Nothing) { break; } if (res == GetResult.Cancel) { break; } foreach (var gui in cir_guid_list) { var gu = doc.Objects.Find(gui); doc.Objects.Delete(gu); } offSetStone = stoneOff.CurrentValue; stoneDist = distStone.CurrentValue; optionBool = boolOption.CurrentValue; if (optionBool == true) { curve2.Reverse(); curve2 = curve2.Rebuild(60, 3, false); curve3.Reverse(); curve3 = curve3.Rebuild(60, 3, false); optionBool = false; } } } else { while (true) { cir_guid_list = new List <Guid>(); List <Point3d> points = new List <Point3d>(); double length = (diamStone / 2) + offSetStone; double crv_length = curve.GetLength(); Point3d point = curve.PointAtLength(length); points.Add(point); while (true) { length += diamStone + offSetStone; if (length > crv_length) { break; } point = curve.PointAtLength(length); points.Add(point); } foreach (var poi in points) { double u, v; surface.ClosestPoint(poi, out u, out v); var direction = surface.NormalAt(u, v); double x = direction.X; double y = direction.Y; double z = direction.Z; Vector3d vt1 = new Vector3d(x, y, z); Plane pl1 = new Plane(poi, vt1); Circle circle = new Circle(pl1, poi, diamStone / 2); Guid cir_guid = doc.Objects.AddCircle(circle); cir_guid_list.Add(cir_guid); } doc.Views.Redraw(); //Options var go = new GetOption(); go.SetCommandPrompt("Set options."); var stoneDiam = new Rhino.Input.Custom.OptionDouble(diamStone); var stoneOff = new Rhino.Input.Custom.OptionDouble(offSetStone); var boolOption = new Rhino.Input.Custom.OptionToggle(false, "Off", "On"); go.AddOptionDouble("StoneDiam", ref stoneDiam); go.AddOptionDouble("Offset", ref stoneOff); go.AddOptionToggle("Reverse", ref boolOption); go.AcceptNothing(true); var res = go.Get(); if (res == GetResult.Nothing) { break; } if (res == GetResult.Cancel) { break; } foreach (var gui in cir_guid_list) { var gu = doc.Objects.Find(gui); doc.Objects.Delete(gu); } diamStone = stoneDiam.CurrentValue; offSetStone = stoneOff.CurrentValue; optionBool = boolOption.CurrentValue; if (optionBool == true) { curve.Reverse(); } } } doc.Views.Redraw(); doc.Groups.Add(cir_guid_list); return(Result.Success); }
protected override Result RunCommand(RhinoDoc doc, RunMode mode) { points.Clear(); while (true) { m_escape_key_pressed = false; RhinoApp.EscapeKeyPressed += RhinoApp_EscapeKeyPressed; bool undo = false; Point3d pt0; Point3d pt0M; int insert; GetPoint getPoint = new GetPoint(); getPoint.SetCommandPrompt("Please select point"); var boolOptionAxis = new Rhino.Input.Custom.OptionToggle(front, "Front", "Side"); getPoint.AddOptionToggle("MirrorPlane", ref boolOptionAxis); var boolOption = new Rhino.Input.Custom.OptionToggle(clamped, "Off", "On"); getPoint.AddOptionToggle("Closed", ref boolOption); var undoOption = new Rhino.Input.Custom.OptionToggle(undo, "No", "Yes"); getPoint.AddOptionToggle("Undo", ref undoOption); if (points.Count > 1) { getPoint.DynamicDraw += DynDrawCurve; } getPoint.AcceptNothing(true); GetResult gr = getPoint.Get(); if (gr == GetResult.Nothing) { break; } else if (gr == GetResult.Option) { clamped = boolOption.CurrentValue; front = boolOptionAxis.CurrentValue; undo = undoOption.CurrentValue; if (front == false) { xm = -1; ym = 1; } else if (front) { xm = 1; ym = -1; } if (undo) { points.RemoveAt(points.Count / 2); points.RemoveAt(points.Count / 2); } } else if (gr == GetResult.Point) { pt0 = getPoint.Point(); pt0M = new Point3d(xm * pt0.X, ym * pt0.Y, pt0.Z); insert = points.Count / 2; points.Insert(insert, pt0); points.Insert(insert + 1, pt0M); } if (m_escape_key_pressed) { break; } } NurbsCurve nc = NurbsCurve.Create(clamped, 3, points); RhinoApp.EscapeKeyPressed -= RhinoApp_EscapeKeyPressed; doc.Objects.AddCurve(nc); doc.Views.Redraw(); return(Result.Success); }
private static void ReadOptions(OptionToggle toggleVerbose, OptionToggle toggleInteractive, OptionDouble spotlightFactor, OptionDouble pointlightFactor, OptionDouble sunlightFactor, OptionDouble arealightFactor, OptionDouble polishFactor) { RcCore.It.EngineSettings.Verbose = toggleVerbose.CurrentValue; RcCore.It.EngineSettings.UseInteractiveRenderer = toggleInteractive.CurrentValue; RcCore.It.EngineSettings.SpotlightFactor = (float) spotlightFactor.CurrentValue; RcCore.It.EngineSettings.PointlightFactor = (float) pointlightFactor.CurrentValue; RcCore.It.EngineSettings.SunlightFactor = (float) sunlightFactor.CurrentValue; RcCore.It.EngineSettings.ArealightFactor = (float) arealightFactor.CurrentValue; RcCore.It.EngineSettings.PolishFactor = (float) polishFactor.CurrentValue; }
protected override Result RunCommand(RhinoDoc doc, RunMode mode) { SearchMode sm = SearchMode.CurveLength; Curve[] curves; OptionToggle tog = new OptionToggle(false, "Hide", "Show"); OptionDouble tol = new OptionDouble(RhinoDoc.ActiveDoc.ModelAbsoluteTolerance, true, 0.0); using (CurvesGetter getLines = new CurvesGetter("Select curves meeting at endpoints. Press Enter when done")) { for( ; ;) { getLines.ClearCommandOptions(); getLines.EnableClearObjectsOnEntry(false); int showInt = getLines.AddOptionToggle("Topology", ref tog); int tolInt = getLines.AddOptionDouble("Tolerance", ref tol); int modeInt = GetterExtension.AddEnumOptionList(getLines, sm); if (getLines.Curves(1, 0, out curves)) break; else { if (getLines.Result() == GetResult.Option) { if (getLines.Option().Index == modeInt) { sm = GetterExtension.RetrieveEnumOptionValue<SearchMode> (getLines.Option().CurrentListOptionIndex); } continue; } else { RhinoApp.WriteLine("Less than three lines were selected"); return Result.Cancel; } } } } CurvesTopology crvTopology = new CurvesTopology(curves, tol.CurrentValue); Guid[] ids = null; if (tog.CurrentValue) ids = CurvesTopologyPreview.Mark(crvTopology, Color.LightBlue, Color.LightCoral); int walkFromIndex; using (var getStart = new TrackingPointGetter("Select the start point of the walk on the curves", crvTopology)) { if (getStart.GetPointOnTopology(out walkFromIndex) != Result.Success) { EndOperations(ids); return Result.Cancel; } } Result wasSuccessful = Result.Cancel; for (; ; ) { int walkToIndex; double[] distances; using (var getEnd = new TrackingPointGetter("Select the end point", crvTopology, walkFromIndex, sm)) { if (getEnd.GetPointOnTopology(out walkToIndex) != Result.Success) { break; } distances = getEnd.DistanceCache; } if (walkFromIndex == walkToIndex) { RhinoApp.WriteLine("Start and end points are equal"); EndOperations(ids); return Result.Nothing; } PathMethod pathSearch = PathMethod.FromMode(sm, crvTopology, distances); int[] nIndices, eIndices; bool[] eDirs; double totLength; Curve c = pathSearch.Cross(walkFromIndex, walkToIndex, out nIndices, out eIndices, out eDirs, out totLength); if (c != null && c.IsValid) { if (tog.CurrentValue) { RhinoApp.WriteLine("Vertices: {0}", FormatNumbers(nIndices)); RhinoApp.WriteLine("Edges: {0}", FormatNumbers(eIndices)); } var a = RhinoDoc.ActiveDoc.CreateDefaultAttributes(); Guid g = RhinoDoc.ActiveDoc.Objects.AddCurve(c, a); var obj = RhinoDoc.ActiveDoc.Objects.Find(g); if (obj != null) { obj.Select(true); wasSuccessful = Result.Success; walkFromIndex = walkToIndex; } else { RhinoApp.WriteLine("An error occurred while adding the new polycurve."); wasSuccessful = Result.Failure; break; } } else { RhinoApp.WriteLine("No path was found. Nodes are isolated."); wasSuccessful = Result.Nothing; } } EndOperations(ids); return wasSuccessful; }
protected override Result RunCommand(RhinoDoc doc, RunMode mode) { Mesh meshSurf; List <Guid> ids = new List <Guid>(); double tolerance = doc.ModelAbsoluteTolerance; const Rhino.DocObjects.ObjectType geometryFilter = Rhino.DocObjects.ObjectType.Surface | Rhino.DocObjects.ObjectType.PolysrfFilter | Rhino.DocObjects.ObjectType.Mesh; GetObject gs = new Rhino.Input.Custom.GetObject(); gs.SetCommandPrompt("Surface to orient on"); gs.GeometryFilter = geometryFilter; gs.SubObjectSelect = true; gs.DeselectAllBeforePostSelect = true; gs.OneByOnePostSelect = true; gs.Get(); if (gs.CommandResult() != Result.Success) { return(gs.CommandResult()); } Rhino.DocObjects.ObjRef objref = gs.Object(0); Rhino.DocObjects.RhinoObject obj = objref.Object(); if (obj == null) { return(Result.Failure); } brepSurf = objref.Brep(); if (brepSurf == null) { meshSurf = objref.Mesh(); brepSurf = Brep.CreateFromMesh(meshSurf, true); } if (brepSurf == null) { return(Result.Failure); } obj.Select(false); while (true) { w_key_pressed = false; s_key_pressed = false; a_key_pressed = false; d_key_pressed = false; m_escape_key_pressed = false; RhinoApp.EscapeKeyPressed += RhinoApp_EscapeKeyPressed; RhinoApp.KeyboardEvent += OnRhinoKeyboardEvent; Point3d pt0; GetPoint getPointAction = new GetPoint(); getPointAction.SetCommandPrompt("Please select insert point(s) on surface."); getPointAction.Constrain(brepSurf, -1, -1, false); var stoneDiam = new Rhino.Input.Custom.OptionDouble(diamStone); var stoneOff = new Rhino.Input.Custom.OptionDouble(offSetStone); var boolOption = new Rhino.Input.Custom.OptionToggle(false, "Off", "On"); var moveOption = new Rhino.Input.Custom.OptionToggle(false, "Off", "On"); getPointAction.AddOptionDouble("StoneDiam", ref stoneDiam); getPointAction.AddOptionDouble("Offset", ref stoneOff); getPointAction.AddOptionToggle("Delete", ref boolOption); getPointAction.AddOptionToggle("Move", ref moveOption); getPointAction.DynamicDraw += RefCircleDraw; getPointAction.Tag = obj; getPointAction.AcceptString(false); getPointAction.AcceptNothing(true); var res = getPointAction.Get(); if (w_key_pressed || s_key_pressed) { RhinoApp.KeyboardEvent -= OnRhinoKeyboardEvent; w_key_pressed = false; s_key_pressed = false; stoneDiam.CurrentValue = diamStone; } if (a_key_pressed || d_key_pressed) { RhinoApp.KeyboardEvent -= OnRhinoKeyboardEvent; a_key_pressed = false; d_key_pressed = false; stoneOff.CurrentValue = offSetStone; } if (res == GetResult.Nothing) { break; } if (m_escape_key_pressed) { break; } diamStone = stoneDiam.CurrentValue; offSetStone = stoneOff.CurrentValue; optionBool = boolOption.CurrentValue; moveBool = moveOption.CurrentValue; RhinoApp.KeyboardEvent -= OnRhinoKeyboardEvent; if (moveBool == true) { RhinoApp.KeyboardEvent -= OnRhinoKeyboardEvent; while (true) { GetObject gcd = new Rhino.Input.Custom.GetObject(); gcd.SetCommandPrompt("Select circle(s) to move. Press enter when done"); gcd.GeometryFilter = Rhino.DocObjects.ObjectType.Curve; gcd.SubObjectSelect = false; gcd.DeselectAllBeforePostSelect = true; gcd.AcceptNothing(true); if (gcd.Get() == GetResult.Nothing) { break; } gcd.Get(); Rhino.DocObjects.ObjRef delobjref = gcd.Object(0); Rhino.DocObjects.RhinoObject delobj = delobjref.Object(); Curve curveRadius = delobjref.Curve(); Circle circleRadius = new Circle(); curveRadius.TryGetCircle(out circleRadius, tolerance); diamStone = circleRadius.Diameter; doc.Objects.Delete(delobj, true); doc.Views.Redraw(); getPointAction.Get(); pt0 = getPointAction.Point(); Point3d closestPoint; ComponentIndex compIndex; double u, v; Vector3d vt1; brepSurf.ClosestPoint(pt0, out closestPoint, out compIndex, out u, out v, 0.01, out vt1); Plane pl1 = new Plane(pt0, vt1); Circle cr1 = new Circle(pl1, pt0, diamStone / 2); var crgu = doc.Objects.AddCircle(cr1); ids.Add(crgu); doc.Views.Redraw(); } moveBool = false; } if (optionBool == true) { RhinoApp.KeyboardEvent -= OnRhinoKeyboardEvent; while (true) { GetObject gcd = new Rhino.Input.Custom.GetObject(); gcd.SetCommandPrompt("Select circle(s) to delete. Press enter when done"); gcd.GeometryFilter = Rhino.DocObjects.ObjectType.Curve; gcd.SubObjectSelect = false; gcd.DeselectAllBeforePostSelect = true; gcd.AcceptNothing(true); if (gcd.Get() == GetResult.Nothing) { break; } gcd.Get(); Rhino.DocObjects.ObjRef delobjref = gcd.Object(0); Rhino.DocObjects.RhinoObject delobj = delobjref.Object(); Curve curveRadius = delobjref.Curve(); Circle circleRadius = new Circle(); curveRadius.TryGetCircle(out circleRadius, tolerance); diamStone = circleRadius.Diameter; doc.Objects.Delete(delobj, true); doc.Views.Redraw(); } optionBool = false; } if (res == GetResult.Point) { pt0 = getPointAction.Point(); Point3d closestPoint; ComponentIndex compIndex; double u, v; Vector3d vt1; brepSurf.ClosestPoint(pt0, out closestPoint, out compIndex, out u, out v, 0.01, out vt1); Plane pl1 = new Plane(pt0, vt1); Circle cr1 = new Circle(pl1, pt0, diamStone / 2); var crgu = doc.Objects.AddCircle(cr1); ids.Add(crgu); doc.Views.Redraw(); } } RhinoApp.KeyboardEvent -= OnRhinoKeyboardEvent; RhinoApp.EscapeKeyPressed -= RhinoApp_EscapeKeyPressed; doc.Groups.Add(ids); return(Result.Success); }
protected override Rhino.Commands.Result RunCommand(RhinoDoc doc, Rhino.Commands.RunMode mode) { Rhino.DocObjects.ObjRef objref; var rc = Rhino.Input.RhinoGet.GetOneObject("Select object", true, Rhino.DocObjects.ObjectType.AnyObject, out objref); if (rc != Rhino.Commands.Result.Success) return rc; rc = Rhino.Input.RhinoGet.GetPoint("Start point", false, out m_point_start); if (rc != Rhino.Commands.Result.Success) return rc; var obj = objref.Object(); if (obj == null) return Rhino.Commands.Result.Failure; // create an instance of a GetPoint class and add a delegate // for the DynamicDraw event var gp = new Rhino.Input.Custom.GetPoint(); gp.DrawLineFromPoint(m_point_start, true); var optdouble = new Rhino.Input.Custom.OptionDouble(m_distance); bool constrain = false; var optconstrain = new Rhino.Input.Custom.OptionToggle(constrain, "Off", "On"); gp.AddOptionDouble("Distance", ref optdouble); gp.AddOptionToggle("Constrain", ref optconstrain); gp.DynamicDraw += ArrayByDistanceDraw; gp.Tag = obj; while (gp.Get() == Rhino.Input.GetResult.Option) { m_distance = optdouble.CurrentValue; if (constrain != optconstrain.CurrentValue) { constrain = optconstrain.CurrentValue; if (constrain) { var gp2 = new Rhino.Input.Custom.GetPoint(); gp2.DrawLineFromPoint(m_point_start, true); gp2.SetCommandPrompt("Second point on constraint line"); if (gp2.Get() == Rhino.Input.GetResult.Point) gp.Constrain(m_point_start, gp2.Point()); else { gp.ClearCommandOptions(); optconstrain.CurrentValue = false; constrain = false; gp.AddOptionDouble("Distance", ref optdouble); gp.AddOptionToggle("Constrain", ref optconstrain); } } else { gp.ClearConstraints(); } } } if (gp.CommandResult() == Rhino.Commands.Result.Success) { m_distance = optdouble.CurrentValue; var pt = gp.Point(); var vec = pt - m_point_start; double length = vec.Length; vec.Unitize(); int count = (int)(length / m_distance); for (int i = 1; i < count; i++) { var translate = vec * (i * m_distance); var xf = Rhino.Geometry.Transform.Translation(translate); doc.Objects.Transform(obj, xf, false); } doc.Views.Redraw(); } return gp.CommandResult(); }
protected override Result RunCommand(RhinoDoc doc, RunMode mode) { double tolerance = doc.ModelAbsoluteTolerance; double angleTolerance = doc.ModelAngleToleranceRadians; List <Curve> icur = new List <Curve>(); GetObject gcr = new Rhino.Input.Custom.GetObject(); gcr.SetCommandPrompt("Select reference circles for prongs. (No curves)"); gcr.GeometryFilter = Rhino.DocObjects.ObjectType.Curve; gcr.GroupSelect = true; gcr.SubObjectSelect = true; gcr.DeselectAllBeforePostSelect = true; gcr.OneByOnePostSelect = false; gcr.GetMultiple(1, 0); for (int ie = 0; ie < gcr.ObjectCount; ie++) { Rhino.DocObjects.ObjRef objref = gcr.Object(ie); Rhino.DocObjects.RhinoObject obj = objref.Object(); if (obj == null) { return(Result.Failure); } Curve refcr = objref.Curve(); if (refcr == null) { return(Result.Failure); } obj.Select(false); icur.Add(refcr); } while (true) { m_escape_key_pressed = false; RhinoApp.EscapeKeyPressed += RhinoApp_EscapeKeyPressed; Point3d pt0 = new Point3d(0, 0, hight); Point3d pt1 = new Point3d(0, 0, -(length - hight)); double rotationRadiant = ((rotation / 180) * 3.1415); List <Point3d> curvePoints = new List <Point3d>() { pt0, pt1 }; Curve prongCurve = Curve.CreateInterpolatedCurve(curvePoints, 3); if (!capBool) { capMode = PipeCapMode.Flat; } else if (capBool) { capMode = PipeCapMode.Round; } Brep[] cylBrep1 = Brep.CreatePipe(prongCurve, prongDia / 2, false, capMode, false, tolerance, angleTolerance); Brep cylBrep2 = cylBrep1[0]; cylBrep2.Faces.RemoveAt(2); Brep cylBrep3 = cylBrep2.CapPlanarHoles(tolerance); if (capBool) { Vector3d scaleVec = new Vector3d(0, 0, 1); var scalePlane = new Plane(pt0, scaleVec); var capScale = Transform.Scale(scalePlane, 1.0, 1.0, capHight); var surf2 = cylBrep3.Faces[1].UnderlyingSurface(); NurbsSurface nurbSurf2 = surf2.ToNurbsSurface(); nurbSurf2.Transform(capScale); Brep capBrep = nurbSurf2.ToBrep(); cylBrep3.Append(capBrep); cylBrep3.Faces.RemoveAt(1); } cylBrep3.Compact(); cylBrep3.JoinNakedEdges(tolerance); string instDefCount = DateTime.Now.ToString("ddMMyyyyHHmmss"); Brep[] brepArray = new Brep[1] { cylBrep3 }; var prongIndex = doc.InstanceDefinitions.Add("Prong" + instDefCount, "RefProng", Point3d.Origin, brepArray); foreach (Curve c in icur) { Circle circleProngs = new Circle(); c.TryGetCircle(out circleProngs, tolerance); NurbsCurve curveProngs = circleProngs.ToNurbsCurve(); Plane planeNew = circleProngs.Plane; Vector3d plVec = planeNew.Normal; if (planeNew == null) { curveProngs.DivideByCount(3, true, out Point3d[] curveProngsPoints); planeNew = new Plane(curvePoints[0], curveProngsPoints[1], curveProngsPoints[2]); } Curve[] offsetCurveArray = curveProngs.Offset(planeNew, prongDia / 4, tolerance, CurveOffsetCornerStyle.Sharp); Curve offsetCurve = offsetCurveArray[0]; double[] segParameters = offsetCurve.DivideByCount(prongCount, true); List <Point3d> prongPoints = new List <Point3d>(); List <Guid> idsInter = new List <Guid>(); foreach (double p in segParameters) { Point3d zen = new Point3d(0, 0, 0); Point3d prongPoint = offsetCurve.PointAt(p); Point3d center = circleProngs.Center; Vector3d moveV = new Vector3d(prongPoint); Vector3d zaxis = new Vector3d(0.0, 0.0, 1.0); Plane planeOr = new Plane(zen, zaxis); Plane plane = new Plane(prongPoint, plVec); var transform1 = Transform.PlaneToPlane(planeOr, plane); var transform2 = Transform.Rotation(rotationRadiant, plVec, center); var prongA = doc.Objects.AddInstanceObject(prongIndex, transform1); var prongB = doc.Objects.Transform(prongA, transform2, true); ids.Add(prongB); } doc.Views.Redraw(); } GetOption go = new Rhino.Input.Custom.GetOption(); go.SetCommandPrompt("Set prong parameters."); go.AcceptNothing(true); var countProng = new Rhino.Input.Custom.OptionInteger(prongCount); var diaProng = new Rhino.Input.Custom.OptionDouble(prongDia); var hightProng = new Rhino.Input.Custom.OptionDouble(hight); var lengthProng = new Rhino.Input.Custom.OptionDouble(length); var rotProng = new Rhino.Input.Custom.OptionDouble(rotation); var capProng = new Rhino.Input.Custom.OptionToggle(capBool, "Flat", "Round"); var hightCap = new Rhino.Input.Custom.OptionDouble(capHight); go.AddOptionInteger("Count", ref countProng); go.AddOptionDouble("Diameter", ref diaProng); go.AddOptionDouble("Hight", ref hightProng); go.AddOptionDouble("Length", ref lengthProng); go.AddOptionDouble("Rotation", ref rotProng); go.AddOptionToggle("Cap", ref capProng); if (capBool) { go.AddOptionDouble("Caphight", ref hightCap); } GetResult res = go.Get(); if (m_escape_key_pressed) { break; } hight = hightProng.CurrentValue; length = lengthProng.CurrentValue; prongCount = countProng.CurrentValue; prongDia = diaProng.CurrentValue; rotation = rotProng.CurrentValue; capBool = capProng.CurrentValue; capHight = hightCap.CurrentValue; if (length <= 0.0) { length = 1.0; } if (prongCount <= 0) { prongCount = 1; } if (prongDia <= 0.0) { prongDia = 1.0; } if (res == GetResult.Nothing) { break; } doc.Objects.Delete(ids, true); } RhinoApp.EscapeKeyPressed -= RhinoApp_EscapeKeyPressed; doc.Groups.Add(ids); return(Result.Success); }
protected override Result RunCommand(RhinoDoc doc, RunMode mode) { //pick surface to orient to or block instance to relocate GetObject gs = new Rhino.Input.Custom.GetObject(); gs.SetCommandPrompt("Surface to orient new object on or BlockInstance to move"); gs.GeometryFilter = Rhino.DocObjects.ObjectType.Surface | Rhino.DocObjects.ObjectType.InstanceReference; gs.SubObjectSelect = true; gs.DeselectAllBeforePostSelect = false; gs.OneByOnePostSelect = true; gs.Get(); if (gs.CommandResult() != Result.Success) { return(gs.CommandResult()); } Rhino.DocObjects.ObjRef objref = gs.Object(0); Rhino.DocObjects.RhinoObject obj = objref.Object(); if (obj == null) { return(Result.Failure); } surface = objref.Surface(); //relocate block instance if (surface == null) { Rhino.DocObjects.InstanceObject instance1 = objref.Object() as Rhino.DocObjects.InstanceObject; instancePoint = instance1.InsertionPoint; double g, h; surface2.ClosestPoint(instancePoint, out g, out h); var instanceDirection = surface2.NormalAt(g, h); instancePlane = new Plane(instancePoint, instanceDirection); Rhino.Input.Custom.GetPoint gpss = new Rhino.Input.Custom.GetPoint(); gpss.SetCommandPrompt("Point on surface to orient to"); gpss.Constrain(surface2, false); gpss.DynamicDraw += RefObjDraw; gpss.Tag = instance1; gpss.Get(); if (gpss.CommandResult() != Rhino.Commands.Result.Success) { return(gpss.CommandResult()); } Point3d ptss = gpss.Point(); surface2.ClosestPoint(ptss, out g, out h); var direction1 = surface2.NormalAt(g, h); Plane pl11 = new Plane(ptss, direction1); Transform iform = Rhino.Geometry.Transform.PlaneToPlane(instancePlane, pl11); doc.Objects.Transform(instance1, iform, true); return(Result.Success); } obj.Select(false); //pick objekt to orient var copy = new Rhino.Input.Custom.OptionToggle(false, "No", "Yes"); GetObject go = new GetObject(); go.SetCommandPrompt("Select object to orient."); go.AddOptionToggle("Copy", ref copy); go.SubObjectSelect = true; go.DeselectAllBeforePostSelect = false; go.GroupSelect = true; for (; ;) { var res = go.GetMultiple(1, -1); if (gs.CommandResult() != Result.Success) { return(gs.CommandResult()); } if (res == GetResult.Option) { copyBol = copy.CurrentValue; continue; } if (gs.CommandResult() != Result.Success) { return(gs.CommandResult()); } break; } int obCount = go.ObjectCount; string instDefCount = DateTime.Now.ToString("ddMMyyyyHHmmss"); //create block instance and plane for instance Rhino.Input.Custom.GetPoint gp = new Rhino.Input.Custom.GetPoint(); gp.SetCommandPrompt("Point to orient from"); gp.Get(); if (gp.CommandResult() != Rhino.Commands.Result.Success) { return(gp.CommandResult()); } Vector3d vt1 = new Vector3d(0, 0, 1); Point3d pt1 = gp.Point(); sourcePlane = new Plane(pt1, vt1); Plane originPlane = new Plane(Point3d.Origin, vt1); Transform bform = Rhino.Geometry.Transform.PlaneToPlane(sourcePlane, originPlane); //block instance GeometryBase[] obj1List = new GeometryBase[obCount]; List <Brep> opList = new List <Brep>(); for (int igo = 0; igo < obCount; igo++) { Rhino.DocObjects.ObjRef objref1 = go.Object(igo); Rhino.DocObjects.RhinoObject obj1 = objref1.Object(); if (obj == null) { return(Result.Failure); } obj.Select(false); Rhino.Geometry.Brep opItem = objref1.Brep(); opList.Add(opItem); GeometryBase obj1Base = obj1.Geometry; obj1Base.Transform(bform); obj1List[igo] = obj1Base; } var orientBlock = doc.InstanceDefinitions.Add("Block" + instDefCount, "OrientBlock", Point3d.Origin, obj1List); //get all go.Objects to .Tag Brep[] op = new Brep[obCount]; op = Brep.CreateBooleanUnion(opList, 0.01); Brep od = new Brep(); od = op[0]; var odGuid = doc.Objects.AddBrep(od); Rhino.DocObjects.ObjRef objref2 = new Rhino.DocObjects.ObjRef(odGuid); Rhino.DocObjects.RhinoObject objDrw = objref2.Object(); //orient plane to surface if (copyBol) { while (true) { Rhino.Input.Custom.GetPoint gps = new Rhino.Input.Custom.GetPoint(); gps.SetCommandPrompt("Point on surface to orient to. Press enter when done."); gps.Constrain(surface, false); gps.AcceptNothing(true); gps.DynamicDraw += RefObjDraw; gps.Tag = objDrw; var res = gps.Get(); if (res == GetResult.Nothing) { break; } //else if (gps.CommandResult() != Rhino.Commands.Result.Success) // return gps.CommandResult(); Point3d pts = gps.Point(); double u, v; surface.ClosestPoint(pts, out u, out v); Vector3d direction = surface.NormalAt(u, v); Plane pl1 = new Plane(pts, direction); Rhino.Geometry.Transform xform = Rhino.Geometry.Transform.PlaneToPlane(originPlane, pl1); doc.Objects.AddInstanceObject(orientBlock, xform); doc.Objects.Delete(objDrw); } copyBol = false; } else { Rhino.Input.Custom.GetPoint gps = new Rhino.Input.Custom.GetPoint(); gps.SetCommandPrompt("Point on surface to orient to"); gps.Constrain(surface, false); gps.DynamicDraw += RefObjDraw; gps.Tag = objDrw; gps.Get(); if (gps.CommandResult() != Rhino.Commands.Result.Success) { return(gps.CommandResult()); } Point3d pts = gps.Point(); double u, v; surface.ClosestPoint(pts, out u, out v); Vector3d direction = surface.NormalAt(u, v); Plane pl1 = new Plane(pts, direction); Rhino.Geometry.Transform xform = Rhino.Geometry.Transform.PlaneToPlane(originPlane, pl1); doc.Objects.AddInstanceObject(orientBlock, xform); doc.Objects.Delete(objDrw); } surface2 = surface; return(Result.Success); }
protected override Result RunCommand(RhinoDoc doc, RunMode mode) { var getNumber = new GetNumber(); getNumber.SetLowerLimit(2.0, false); getNumber.SetUpperLimit(100000.0, false); getNumber.SetDefaultInteger(RcCore.It.EngineSettings.Samples); getNumber.SetCommandPrompt("Set render samples"); var useCustomSettings = new OptionToggle(RcCore.It.EngineSettings.UseCustomQualitySettings, "No", "Yes"); var minBounce = new OptionInteger(RcCore.It.EngineSettings.MinBounce, 0, 500); var maxBounce = new OptionInteger(RcCore.It.EngineSettings.MaxBounce, 0, 500); var maxDiffuseBounce = new OptionInteger(RcCore.It.EngineSettings.MaxDiffuseBounce, 0, 200); var maxGlossyBounce = new OptionInteger(RcCore.It.EngineSettings.MaxGlossyBounce, 0, 200); var maxTransmissionBounce = new OptionInteger(RcCore.It.EngineSettings.MaxTransmissionBounce, 0, 200); var maxVolumeBounce = new OptionInteger(RcCore.It.EngineSettings.MaxVolumeBounce, 0, 200); var noCaustics = new OptionToggle(RcCore.It.EngineSettings.NoCaustics, "Caustics", "NoCaustics"); var aaSamples = new OptionInteger(RcCore.It.EngineSettings.AaSamples, 1, 100); var diffSamples = new OptionInteger(RcCore.It.EngineSettings.DiffuseSamples, 1, 100); var glossySamples = new OptionInteger(RcCore.It.EngineSettings.GlossySamples, 1, 100); var seed = new OptionInteger(RcCore.It.EngineSettings.Seed, 0, int.MaxValue); var sensorWidth = new OptionDouble(RcCore.It.EngineSettings.SensorWidth, 10.0, 100.0); var sensorHeight = new OptionDouble(RcCore.It.EngineSettings.SensorHeight, 10.0, 100.0); var transparentMinBounce = new OptionInteger(RcCore.It.EngineSettings.TransparentMinBounce, 0, 200); var transparentMaxBounce = new OptionInteger(RcCore.It.EngineSettings.TransparentMaxBounce, 0, 200); var transparentShadows = new OptionToggle(RcCore.It.EngineSettings.TransparentShadows, "NoTransparentShadows", "TransparentShadows"); var branched = new OptionToggle(RcCore.It.EngineSettings.IntegratorMethod==IntegratorMethod.BranchedPath, "Path", "BranchedPath"); var samplingPattern = new OptionToggle(RcCore.It.EngineSettings.SamplingPattern == SamplingPattern.CMJ, "Sobol", "CMJ"); var filterGlossy = new OptionDouble(RcCore.It.EngineSettings.FilterGlossy, 0.0, 100.0); var sampleClampDirect = new OptionDouble(RcCore.It.EngineSettings.SampleClampDirect, 0.0, 100.0); var sampleClampIndirect = new OptionDouble(RcCore.It.EngineSettings.SampleClampIndirect, 0.0, 100.0); var sampleAllLights = new OptionToggle(RcCore.It.EngineSettings.SampleAllLights, "no", "yes"); var sampleAllLightsIndirect = new OptionToggle(RcCore.It.EngineSettings.SampleAllLightsIndirect, "no", "yes"); getNumber.AddOptionToggle("use_custom_quality_settings", ref useCustomSettings); getNumber.AddOptionInteger("min_bounces", ref minBounce); getNumber.AddOptionInteger("max_bounces", ref maxBounce); getNumber.AddOptionToggle("no_caustics", ref noCaustics); getNumber.AddOptionInteger("max_diffuse_bounce", ref maxDiffuseBounce); getNumber.AddOptionInteger("max_glossy_bounce", ref maxGlossyBounce); getNumber.AddOptionInteger("max_transmission_bounce", ref maxTransmissionBounce); getNumber.AddOptionInteger("max_volume_bounce", ref maxVolumeBounce); getNumber.AddOptionInteger("transparent_min_bounce", ref transparentMinBounce); getNumber.AddOptionInteger("transparent_max_bounce", ref transparentMaxBounce); getNumber.AddOptionToggle("transparent_shadows", ref transparentShadows); getNumber.AddOptionInteger("aa_samples", ref aaSamples); getNumber.AddOptionInteger("diffuse_samples", ref diffSamples); getNumber.AddOptionInteger("glossy_samples", ref glossySamples); getNumber.AddOptionDouble("sensor_width", ref sensorWidth); getNumber.AddOptionDouble("sensor_height", ref sensorHeight); getNumber.AddOptionToggle("integrator_method", ref branched); getNumber.AddOptionInteger("seed", ref seed, "Seed to use for sampling distribution"); getNumber.AddOptionToggle("sampling_pattern", ref samplingPattern); getNumber.AddOptionDouble("filter_glossy", ref filterGlossy); getNumber.AddOptionDouble("sample_clamp_direct", ref sampleClampDirect); getNumber.AddOptionDouble("sample_clamp_indirect", ref sampleClampIndirect); getNumber.AddOptionToggle("sample_all_lights", ref sampleAllLights); getNumber.AddOptionToggle("sample_all_lights_indirect", ref sampleAllLightsIndirect); while (true) { var getRc = getNumber.Get(); if (getNumber.CommandResult() != Result.Success) return getNumber.CommandResult(); switch (getRc) { case GetResult.Number: RhinoApp.WriteLine($"We got: {getNumber.Number()}, {minBounce.CurrentValue}, {maxBounce.CurrentValue}"); RcCore.It.EngineSettings.Samples = (int)getNumber.Number(); RcCore.It.EngineSettings.UseCustomQualitySettings = useCustomSettings.CurrentValue; RcCore.It.EngineSettings.Seed = seed.CurrentValue; RcCore.It.EngineSettings.MaxBounce = maxBounce.CurrentValue; RcCore.It.EngineSettings.MinBounce = minBounce.CurrentValue; RcCore.It.EngineSettings.NoCaustics = noCaustics.CurrentValue; RcCore.It.EngineSettings.MaxDiffuseBounce = maxDiffuseBounce.CurrentValue; RcCore.It.EngineSettings.MaxGlossyBounce = maxGlossyBounce.CurrentValue; RcCore.It.EngineSettings.MaxTransmissionBounce = maxTransmissionBounce.CurrentValue; RcCore.It.EngineSettings.MaxVolumeBounce = maxVolumeBounce.CurrentValue; RcCore.It.EngineSettings.TransparentMinBounce = transparentMinBounce.CurrentValue; RcCore.It.EngineSettings.TransparentMaxBounce = transparentMaxBounce.CurrentValue; RcCore.It.EngineSettings.TransparentShadows = transparentShadows.CurrentValue; RcCore.It.EngineSettings.AaSamples = aaSamples.CurrentValue; RcCore.It.EngineSettings.DiffuseSamples = diffSamples.CurrentValue; RcCore.It.EngineSettings.GlossySamples = glossySamples.CurrentValue; RcCore.It.EngineSettings.SensorWidth = (float)sensorWidth.CurrentValue; RcCore.It.EngineSettings.SensorHeight = (float)sensorHeight.CurrentValue; RcCore.It.EngineSettings.IntegratorMethod = branched.CurrentValue ? IntegratorMethod.BranchedPath : IntegratorMethod.Path; RcCore.It.EngineSettings.SamplingPattern = SamplingPattern.Sobol; RcCore.It.EngineSettings.FilterGlossy = 0.0f; RcCore.It.EngineSettings.SampleClampDirect = 0.0f; RcCore.It.EngineSettings.SampleClampIndirect = 0.0f; RcCore.It.EngineSettings.SampleAllLights = true; RcCore.It.EngineSettings.SampleAllLightsIndirect = true; break; case GetResult.Option: continue; } break; } return Result.Success; }