Esempio n. 1
0
        private static void Click(object sender, EventArgs e)
        {
            try
            {
                var doc = AcadHelper.Doc;
                var sel = doc.Editor.SelectImplied();
                if (sel.Status != PromptStatus.OK)
                {
                    return;
                }
                List <IGroupProvider> groups;
                _dictBlName = new DictBlockName();
                using (var t = doc.TransactionManager.StartTransaction())
                {
                    var ents = sel.Value.GetObjectIds().GetObjects <Entity>()
                               .GroupBy(GetType).ToDictionary(k => k.Key, v => v.ToList());
                    groups = ents.Select(s => GetTypeProvider(s.Key))
                             .Where(w => w != null).OrderBy(o => o.Name).ToList();
                    groups.Insert(0, new CommonProvider(ents));
                    t.Commit();
                }

                var selVm = new SelectVm(groups, _dictBlName);
                selView?.Close();
                selView = new SelectView(selVm);
                Autodesk.AutoCAD.ApplicationServices.Core.Application.ShowModelessWindow(selView);
            }
            catch (Exception ex)
            {
                ex.Message.WriteLine();
            }
            finally
            {
                _dictBlName = null;
            }
        }