public void refresh()
        {
            Rhino.DocObjects.Tables.ObjectTable docObjects = RhinoDoc.ActiveDoc.Objects;

            foreach (var obj in docObjects)
            {
                bool isHidden = obj.IsHidden;
                if (isHidden == true)
                {
                }
                else
                {
                    obj.Attributes.Visible = false;
                    obj.CommitChanges();
                }
            }
            Rhino.RhinoDoc.ActiveDoc.Views.Redraw();
        }
        public void addToDisplay(string layer)
        {
            RhinoDoc.ActiveDoc.Objects.UnselectAll();
            var objs = RhinoDoc.ActiveDoc.Objects.FindByLayer(layer);

            if (null != objs && objs.Length > 0)
            {
                for (int i = 0; i < objs.Length; i++)
                {
                    var obj = objs[i];
                    obj.Attributes.Visible = true;
                    obj.CommitChanges();
                    //obj.Select(true);
                }
                RhinoDoc.ActiveDoc.Views.Redraw();
            }

            Rhino.DocObjects.Tables.ObjectTable docObjects = RhinoDoc.ActiveDoc.Objects;
        }
        public void HideUnselectedObjects(string layer)
        {
            Rhino.DocObjects.Tables.ObjectTable docObjects = RhinoDoc.ActiveDoc.Objects;

            foreach (var obj in docObjects)
            {
                int isSelected = obj.IsSelected(false);
                if (isSelected > 0)
                {
                    obj.Attributes.Visible = true;
                    obj.CommitChanges();
                }
                else
                {
                    obj.Attributes.Visible = false;
                    obj.CommitChanges();
                }
            }
            Rhino.RhinoDoc.ActiveDoc.Views.Redraw();
        }