protected override Result RunCommand(RhinoDoc doc, RunMode mode)
        {
            RhinoView view = doc.Views.ActiveView;

            if (null == view)
            {
                return(Result.Failure);
            }

            string name = null;
            Result rc   = RhinoGet.GetString("Named view to restore", false, ref name);

            if (rc != Result.Success || string.IsNullOrEmpty(name))
            {
                return(Result.Cancel);
            }

            int index = doc.NamedViews.FindByName(name);

            if (index < 0 || index >= doc.NamedViews.Count)
            {
                RhinoApp.WriteLine("Named view not found");
                return(Result.Nothing);
            }

            //doc.NamedViews.Restore(index, view, false);
            doc.NamedViews.RestoreAnimated(index, view, false);
            view.Redraw();

            return(Result.Success);
        }
示例#2
0
        protected void MaintainViewPort(int Width, int Height, double Reduce)
        {
            int width  = (int)((float)Width / Reduce);
            int height = (int)((float)Height / Reduce);
            int x      = Convert.ToInt32(Math.Round((double)Screen.PrimaryScreen.Bounds.Width - width));
            int y      = 200;


            if (Rhino.RhinoDoc.ActiveDoc.Views.Find("Whale", true) == null)
            {
                RhinoView      = Rhino.RhinoDoc.ActiveDoc.Views.Add("Whale", DefinedViewportProjection.Perspective, new Rectangle(x, y, width, height), true);
                RhinoView.Size = new Size(width, height);
                RhinoView.ActiveViewport.DisplayMode = DisplayModeDescription.GetDisplayMode(DisplayModeDescription.RenderedId);
                IntPtr parent = GetControl.GetParent(RhinoView.Handle);
                GetControl.SetWindowPos(parent, -1, 0, 0, 0, 0, 3);
            }
            else
            {
                RhinoView = Rhino.RhinoDoc.ActiveDoc.Views.Find("Whale", true);
                int viewWidth = RhinoView.Size.Width;
                Reduce         = (float)Width / (float)viewWidth;
                RhinoView.Size = new Size(viewWidth, viewWidth * height / width);
                RhinoView.Redraw();
            }
        }
        protected override Result RunCommand(RhinoDoc doc, RunMode mode)
        {
            RhinoView view = doc.Views.ActiveView;

            if (null == view)
            {
                return(Result.Failure);
            }

            const string           englishName = @"Shaded";
            DisplayModeDescription display_mode_description = DisplayModeDescription.FindByName(englishName);

            if (null != display_mode_description)
            {
                view.ActiveViewport.DisplayMode = display_mode_description;
                view.Redraw();
            }

            return(Result.Success);
        }