Пример #1
0
        // commit changes
        private void OK_Click(object sender, EventArgs e)
        {
            dp = (int)Math.Round(nudDP.Value);
            ts = tsvalues[cbThousand.SelectedIndex];
            if (rbClrName.Checked)
            {
                cf = 0;
            }
            else if (rbClrDash.Checked)
            {
                cf = 1;
            }
            else if (rbClrComma.Checked)
            {
                cf = 2;
            }
            else
            {
                MessageBox.Show("color format radio buttons error");
            }
            update      = rbAutoUpdate.Checked;
            su          = (double)nudUnitScale.Value;
            cun         = tbUnitName.Text.Trim();
            seeunits    = cbSeeTot.Checked;
            seetots     = cbSeeTot.Checked;
            th          = cbThreaded.Checked;
            outhdrs     = cbExHdrs.Checked;
            docmarker.w = (int)nudWireWt.Value;

            // must be shown modal and therefore not disposed after below call
            Close();
            super.Refresh_Click(null, null); // dummy args
        }
Пример #2
0
        protected override Result RunCommand(RhinoDoc doc, RunMode mode)
        {
            TablDockPanel tablpanel = Panels.GetPanel <TablDockPanel>(RhinoDoc.ActiveDoc);
            bool          blitz     = false;
            var           r         = RhinoGet.GetBool(" Erase existing Tabl_ contents?", false, "No", "Yes", ref blitz);

            if (r == Result.Success)
            {
                r = RhinoGet.GetMultipleObjects(" Select objects to add", true, ObjectType.AnyObject, out ObjRef[] picked);
                if (r == Result.Success)
                {
                    if (blitz)
                    {
                        tablpanel.Loaded = picked.Select(oref => new ObjRef(oref.ObjectId)).ToArray();
                        tablpanel.PushRefs();
                    }
                    else
                    {
                        List <ObjRef> concat = new List <ObjRef>();
                        concat.AddRange(tablpanel.Loaded);
                        var ids = tablpanel.Loaded.Select(i => i.ObjectId.ToString());
                        foreach (ObjRef oref in picked)
                        {
                            if (!ids.Contains(oref.ObjectId.ToString()))
                            {
                                concat.Add(new ObjRef(oref.ObjectId));
                            }
                        }
                        tablpanel.Loaded = concat.ToArray();
                        tablpanel.PushRefs();
                    }
                    tablpanel.Refresh_Click(null, null); // dummy args, method doesn't use them anyway
                    if (!Panels.IsPanelVisible(TablDockPanel.PanelId))
                    {
                        MessageBox.Show("Added to Tabl_\nType \"LaunchTabl_\" to open it", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                else
                {
                    RhinoApp.WriteLine("command interrupted, nothing done...");
                }
            }
            else
            {
                RhinoApp.WriteLine("command interrupted, nothing done...");
            }

            return(Result.Success);
        }