/// <summary> /// Добавить объекты сечения /// </summary> //[CommandMethod("adds")] private void AddSectionObjects() { var selectedObjects = AutocadUtils.GetSelectedObjects(); if (selectedObjects == null) { return; } SectionCurves.Clear(); SectionCurves.AddRange(selectedObjects.Cast <Curve>().ToList()); var points = SectionCurves.Select(p => p.StartPoint.Y).Concat(SectionCurves.Select(p => p.EndPoint.Y)); Settings.GetInstance().HeightMax = points.Max(); Settings.GetInstance().HeightMin = points.Min(); SettingForm.RefreshForm(); AutocadUtils.WriteMessage(String.Format("Добавлено сечение: {0} объектов. Диапазон по высоте: {1}-{2}", SectionCurves.Count, Settings.GetInstance().HeightMin, Settings.GetInstance().HeightMax)); }
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(); }