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;
  }
示例#2
0
        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)
        {
            var pack_algorithm = PackingAlgorithm.Fast;
              Point3d base_point = new Point3d();
              var option_count = new OptionInteger(100, true, 2);
              var option_min_radius = new OptionDouble(0.1, true, 0.001);
              var option_max_radius = new OptionDouble(1.0, true, 0.001);
              var option_iterations = new OptionInteger(10000, false, 100);

              bool done_looping = false;
              while (!done_looping)
              {
            var gp = new GetPoint();
            gp.SetCommandPrompt("Center of fitting solution");
            gp.AddOptionInteger("Count", ref option_count);
            gp.AddOptionDouble("MinRadius", ref option_min_radius);
            gp.AddOptionDouble("MaxRadius", ref option_max_radius);
            gp.AddOptionInteger("IterationLimit", ref option_iterations);
            int index_option_packing = gp.AddOption("Packing", pack_algorithm.ToString());
            gp.AcceptNumber(true, true);

            switch( gp.Get() )
            {
              case GetResult.Point:
            base_point = gp.Point();
            done_looping = true;
            break;
              case GetResult.Option:
            if (index_option_packing == gp.OptionIndex())
            {
              var get_algorithm = new GetOption();
              get_algorithm.SetCommandPrompt("Packing");
              get_algorithm.SetDefaultString(pack_algorithm.ToString());
              var opts = new string[]{"Fast", "Double", "Random", "Simple"};
              int current_index = 0;
              switch(pack_algorithm)
              {
                case PackingAlgorithm.Fast:
                  current_index = 0;
                  break;
                case PackingAlgorithm.Double:
                  current_index = 1;
                  break;
                case PackingAlgorithm.Random:
                  current_index = 2;
                  break;
                case PackingAlgorithm.Simple:
                  current_index = 3;
                  break;
              }
              int index_list = get_algorithm.AddOptionList("algorithm", opts, current_index);
              get_algorithm.AddOption("Help");
              while( get_algorithm.Get() == GetResult.Option )
              {
                if (index_list == get_algorithm.OptionIndex())
                {
                  int index = get_algorithm.Option().CurrentListOptionIndex;
                  if (0 == index)
                    pack_algorithm = PackingAlgorithm.Fast;
                  if (1 == index)
                    pack_algorithm = PackingAlgorithm.Double;
                  if (2 == index)
                    pack_algorithm = PackingAlgorithm.Simple;
                  if (3 == index)
                    pack_algorithm = PackingAlgorithm.Random;
                  break;
                }
                // if we get here, the user selected help
                const string help =
                  @"Fast: fast packing prevents collisions by moving one
            circle away from all its intersectors. After every collision
            iteration, all circles are moved towards the centre of the
            packing to reduce the amount of wasted space. Collision
            detection proceeds from the center outwards.

            Double: similar to Fast, except that both circles are moved
            in case of a collision.

            Random: similar to Fast, except that collision detection is
            randomized rather than sorted.

            Simple: similar to Fast, but without a contraction pass
            after every collision iteration.";
                Rhino.UI.Dialogs.ShowMessageBox(help, "Packing algorithm description", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
              }
            }
            break;
              default:
            return Result.Cancel;
            }
              }
              int count = option_count.CurrentValue;
              double min_radius = option_min_radius.CurrentValue;
              double max_radius = option_max_radius.CurrentValue;
              int iterations = option_iterations.CurrentValue;

              // TODO: try setting up a background worker thread and
              // communicate with the GetString through messages
              //GetString gs = new GetString();
              //gs.SetCommandPrompt("Press escape to cancel");

              using (var all_circles = new PackCircles(base_point, count, min_radius, max_radius))
              {
            double damping = 0.1;
            for (int i = 1; i <= iterations; i++)
            {
              RhinoApp.SetCommandPrompt(string.Format("Performing circle packing iteration {0}...  (Press Shift+Ctrl to abort)", i));

              if (System.Windows.Forms.Control.ModifierKeys == (System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift))
              {
            RhinoApp.WriteLine("Circle fitting process aborted at iteration {0}...", i);
            break;
              }

              if (!all_circles.Pack(pack_algorithm, damping, doc.ModelAbsoluteTolerance))
              {
            RhinoApp.WriteLine("Circle fitting process completed at iteration {0}...", i);
            break;
              }

              damping *= 0.98;
              doc.Views.Redraw();
              RhinoApp.Wait();
            }
            all_circles.Add(doc);
              }
              doc.Views.Redraw();
              return Result.Success;
        }
示例#4
0
        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 curve for chain
            GetObject getCurve = new GetObject();

            getCurve.GeometryFilter = Rhino.DocObjects.ObjectType.Curve;
            getCurve.SetCommandPrompt("Select curve for chain");
            var res = getCurve.Get();

            Rhino.DocObjects.ObjRef      objref = getCurve.Object(0);
            Rhino.DocObjects.RhinoObject obj    = objref.Object();
            if (obj == null)
            {
                return(Result.Failure);
            }
            curve = objref.Curve();
            if (curve == null)
            {
                return(Result.Failure);
            }
            obj.Select(false);

            //Pick object for chain (instance)
            //pick objekt to orient
            GetObject go = new GetObject();

            go.SetCommandPrompt("Select chain element.");
            go.SubObjectSelect             = true;
            go.DeselectAllBeforePostSelect = false;
            //go.GroupSelect = true;
            //go.GetMultiple(1, -1);
            go.Get();
            if (go.CommandResult() != Result.Success)
            {
                return(go.CommandResult());
            }
            Rhino.DocObjects.ObjRef      objref1 = go.Object(0);
            Rhino.DocObjects.RhinoObject obj1    = objref1.Object();
            GeometryBase obj1Base = obj1.Geometry;


            int    obCount      = go.ObjectCount;
            string instDefCount = DateTime.Now.ToString("ddMMyyyyHHmmss");

            //create block instance and plane for instance
            Rhino.Input.Custom.GetPoint gp1 = new Rhino.Input.Custom.GetPoint();
            gp1.SetCommandPrompt("Center point to orient from");
            gp1.Get();
            if (gp1.CommandResult() != Rhino.Commands.Result.Success)
            {
                return(gp1.CommandResult());
            }
            Point3d pt1 = gp1.Point();

            Rhino.Input.Custom.GetPoint gp2 = new Rhino.Input.Custom.GetPoint();
            gp2.SetCommandPrompt("Point for orientation");
            gp2.DrawLineFromPoint(pt1, false);
            gp2.Get();
            if (gp2.CommandResult() != Rhino.Commands.Result.Success)
            {
                return(gp2.CommandResult());
            }
            Point3d pt2 = gp2.Point();

            Vector3d vt1 = pt2 - pt1;

            sourcePlane = new Plane(pt1, vt1);
            Plane     originPlane = new Plane(Point3d.Origin, vt1);
            Transform bform       = Rhino.Geometry.Transform.PlaneToPlane(sourcePlane, originPlane);

            obj1Base.Transform(bform);

            GeometryBase[] obj1List = new GeometryBase[1] {
                obj1Base
            };

            var orientBlock = doc.InstanceDefinitions.Add("Block" + instDefCount, "OrientBlock", Point3d.Origin, obj1List);


            //orient instances along curve

            List <Guid> chainBlocks = new List <Guid>();
            Guid        chainBlock;

            while (true)
            {
                foreach (var block in chainBlocks)
                {
                    doc.Objects.Delete(block, false);
                }
                chainBlocks = new List <Guid>();
                double curveLength    = curve.GetLength();
                double curveDivide    = curveLength / chainDis;
                int    curveDivideInt = Convert.ToInt32(curveDivide);

                for (int ic = 0; ic < curveDivideInt; ic++)
                {
                    Point3d  insertPoint = curve.PointAtLength(chainDis * ic);
                    Vector3d insertVec   = curve.PointAtLength(chainDis * ic + 1) - curve.PointAtLength(chainDis * ic - 1);
                    Plane    targetPlane = new Plane(insertPoint, insertVec);

                    var xvec = targetPlane.XAxis;
                    if (xvec.Z != 0)
                    {
                        targetPlane.Rotate(Math.PI / 2, insertVec);
                    }

                    var yvec = targetPlane.YAxis;
                    if (yvec.Z < 0)
                    {
                        targetPlane.Rotate(Math.PI, insertVec);
                    }

                    if (ic % 2 == 0)
                    {
                        targetPlane.Rotate(Math.PI / 2, insertVec);
                    }
                    targetPlane.Rotate(axisOffsetRadiant, insertVec);
                    Rhino.Geometry.Transform xform = Rhino.Geometry.Transform.PlaneToPlane(originPlane, targetPlane);
                    chainBlock = doc.Objects.AddInstanceObject(orientBlock, xform);
                    chainBlocks.Add(chainBlock);
                }

                doc.Views.Redraw();
                GetOption gd = new GetOption();
                gd.SetCommandPrompt("Set distance between element centers in mm and rotation offset in degree. Press enter to accept.");
                var dis        = new Rhino.Input.Custom.OptionDouble(chainDis);
                var axisOffset = new Rhino.Input.Custom.OptionInteger(chainAxisOffset);
                gd.AddOptionDouble("distance", ref dis);
                gd.AddOptionInteger("rotation", ref axisOffset);
                gd.AcceptNothing(true);
                var resdis = gd.Get();
                if (resdis == GetResult.Nothing)
                {
                    break;
                }

                chainDis          = dis.CurrentValue;
                chainAxisOffset   = axisOffset.CurrentValue;
                axisOffsetRadiant = chainAxisOffset * (Math.PI / 180);
            }

            int index = doc.Groups.Add(chainBlocks);

            return(Result.Success);
        }
示例#6
0
        protected override Result RunCommand(Rhino.RhinoDoc doc, RunMode mode)
        {
            int    portNumber     = 8181;
            string hostnameString = "127.0.0.1";
            bool   activate       = serverManager.IsRunning;

            GetString gp = new GetString();

            gp.SetCommandPrompt("Websocket Server");
            gp.SetDefaultString(hostnameString);

            Rhino.Input.Custom.OptionInteger portNumberOption = new Rhino.Input.Custom.OptionInteger(portNumber);
            OptionToggle activeOption = new OptionToggle(activate, "Off", "On");

            gp.AddOptionToggle("Activate", ref activeOption);
            gp.AddOptionInteger("Port", ref portNumberOption);

            while (true)
            {
                GetResult get_rc = gp.Get();

                if (gp.CommandResult() != Result.Success)
                {
                    return(gp.CommandResult());
                }

                if (get_rc == GetResult.String)
                {
                    hostnameString = gp.StringResult();
                }
                else if (get_rc == GetResult.Option)
                {
                    continue;
                }
                break;
            }

            portNumber = portNumberOption.CurrentValue;
            activate   = activeOption.CurrentValue;

            if (activate)
            {
                serverManager.Setup(hostnameString, portNumber);
                serverManager.Start(socket =>
                {
                    socket.OnOpen    = () => RhinoApp.WriteLine("Open");
                    socket.OnClose   = () => RhinoApp.WriteLine("Close!");
                    socket.OnMessage = (message) =>
                    {
                        try
                        {
                            var obj = JObject.Parse(message);
                            if (obj.ContainsKey("action") && obj.GetValue("action").ToString() == "broadcast")
                            {
                                serverManager.Broadcast(obj.GetValue("data").ToString(), socket);
                                return;
                            }
                        } catch (JsonReaderException exception)
                        {
                        }
                        //socket.Send(message);
                    };
                });
            }
            else
            {
                RhinoApp.WriteLine("Closing server");
                serverManager.Dispose();
            }

            return(Result.Success);
        }
示例#7
0
        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;
        }