Exemple #1
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);
        }
Exemple #2
0
 public TablParams(TablDockPanel panel) : this()
 {
     super = panel;
 }