/// <summary> /// Добавить объекты /// </summary> //[CommandMethod("add")] //, CommandFlags.UsePickSet)] // | CommandFlags.Redraw | CommandFlags.Modal)] //CommandFlags.Redraw SetImpliedSelection()SelectImplied private void AddObjects() { var selectedObjects = AutocadUtils.GetSelectedObjects(); if (selectedObjects == null) { return; } if (AutocadUtils.ShowModalDialog(ToolStoreForm) != DialogResult.OK) { return; } var tools = ToolStoreForm.GetSelectedToos(); SettingForm.RefreshSettings(); ProcessObjectFactory.Create(selectedObjects, tools); ObjectForm.RefreshList(); ShowPaletteSet(); }
public void Initialize() { AutocadUtils.WriteMessage("Инициализация плагина ProcessingProgram. Версия с режимом обработки."); // + DateTime.Today.ToShortDateString()); TODO Assemlly.DateTime() ObjectForm.DeleteAll += (sender, args) => DeleteAll(); ObjectForm.DeleteProcessing += (sender, args) => DeleteProcessing(); ObjectForm.Calculate += (sender, args) => Calculate(); ObjectForm.Quit += (sender, args) => AutocadUtils.Close(); ObjectForm.AddObjects += (sender, args) => AddObjects(); ObjectForm.ShowTools += (sender, args) => AutocadUtils.ShowModalDialog(ToolStoreForm); ObjectForm.CurrentChanged += (sender, args) => AutocadUtils.SelectObject(args.Data.Curve.ObjectId); ObjectForm.ChangeOutside += (sender, args) => { CalcUtils.ChangeOutside(args.Data.Curve.ObjectId); Calculate(); }; ObjectForm.ReverseProcess += (sender, args) => { args.Data.Direction *= -1; Calculate(); }; ObjectForm.DeleteObject += (sender, args) => { ProcessObjects.Remove(args.Data); if (ProcessObjects.All(p => p.Curve != args.Data.Curve)) { ProcessCurves.Remove(args.Data.Curve); } Calculate(); }; SettingForm.AddSectionObjects += (sender, args) => { AddSectionObjects(); SettingForm.SetSectionDesc(SectionCurves.Any() ? String.Format("Сечение установлено. {0} элемента", SectionCurves.Count) : ""); }; AutocadUtils.AddPaletteSet("Объекты", ObjectForm); ProcessingForm.CurrentChanged += (sender, args) => AutocadUtils.SelectObjects(args.Data.ObjectId, args.Data.ToolObjectId); ProcessingForm.DeleteProcessing += (sender, args) => DeleteProcessing(); ProcessingForm.Calculate += (sender, args) => Calculate(); AutocadUtils.AddPaletteSet("Обработка", ProcessingForm); AutocadUtils.AddPaletteSet("Программа", ProgramForm); AutocadUtils.AddPaletteSet("Настройки", SettingForm); AutocadUtils.Selected += (sender, args) => ProcessingForm.SelectObjects(args.Data); AutocadUtils.Focused += (sender, args) => ProcessingForm.SetFocus(args.Data); AutocadUtils.Focused += (sender, args) => ObjectForm.SetFocus(args.Data); CalcUtils.Init(ProcessObjects, ProcessCurves); ProcessObjectFactory.Init(ProcessObjects, ProcessCurves); var machine = new Machine(); machine.ChangeActionsCount += (sender, args) => ObjectForm.ShowProgress(String.Format("Генерация обработки... {0} строк", args.Data)); ActionGenerator.SetMachine(machine); //AutocadUtils.CreateTest(); //RunTest(); }