private bool SetPageUnit(RhinoDoc doc) { bool result = false; try { Rhino.Input.Custom.GetOption getOption = new Rhino.Input.Custom.GetOption(); getOption.SetCommandPrompt("Set Page Units"); foreach (string unit in optionValues) { getOption.AddOption(unit); } getOption.Get(); if (getOption.CommandResult() != Rhino.Commands.Result.Success) { return(false); } string selectedUnit = getOption.Option().EnglishName; switch (selectedUnit) { case "Inch": doc.AdjustPageUnitSystem(UnitSystem.Inches, true); break; case "Foot": doc.AdjustPageUnitSystem(UnitSystem.Feet, true); break; case "Millimeter": doc.AdjustPageUnitSystem(UnitSystem.Millimeters, true); break; case "Centimeter": doc.AdjustPageUnitSystem(UnitSystem.Centimeters, true); break; case "Meter": doc.AdjustPageUnitSystem(UnitSystem.Meters, true); break; } doc.Views.Redraw(); result = true; } catch (Exception ex) { string message = ex.Message; } return(result); }