示例#1
0
        /*
         * public override void AppendAdditionalMenuItems(ToolStripDropDown menu)
         * {
         *  Menu_AppendItem(menu, "Select Layer", Do_Select_Layer);
         *  base.AppendAdditionalMenuItems(menu);
         * }
         *
         * private void Do_Select_Layer(object sender, EventArgs e)
         * {
         *  this.ExpireSolution(true);
         * }*/
        protected override GH_GetterResult Prompt_Singular(ref Types.Hu_Layer value)
        {
            Forms.LayerDialog Dialog = new Forms.LayerDialog();
            Dialog.StartPosition = FormStartPosition.CenterParent;
            LayerTable LT = Rhino.RhinoDoc.ActiveDoc.Layers;

            if (Dialog.ShowDialog() == DialogResult.OK)
            {
                int LayerIndex            = Dialog.LayerIndex;
                Rhino.DocObjects.Layer La = LT.FindIndex(LayerIndex);
                if (La == null)
                {
                    value = null;
                    this.AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "设置图层在工作空间中不存在");
                }
                else
                {
                    value = new Types.Hu_Layer(La);
                }
                return(GH_GetterResult.success);
            }
            else
            {
                return(GH_GetterResult.cancel);
            }
        }
示例#2
0
 private void Do_SelectALayer(object sender, EventArgs e)
 {
     Forms.LayerDialog Dialog = new Forms.LayerDialog();
     Dialog.StartPosition = FormStartPosition.CenterParent;
     if (Dialog.ShowDialog() == DialogResult.OK)
     {
         this.LayerIndex = Dialog.LayerIndex;
     }
     this.ExpireSolution(true);
 }