public LongCleaningTechOperation(ITechProcess techProcess, string caption) : base(techProcess, caption) { StepX1 = 1; StepX2 = 1; StepY = 1; StepZ = 1; }
public void BuildProcessing(ITechProcess techProcess) { try { Acad.Write($"Выполняется расчет обработки по техпроцессу {techProcess.Caption} ..."); var stopwatch = Stopwatch.StartNew(); Acad.DeleteObjects(techProcess.ToolpathObjectIds); Acad.DeleteExtraObjects(); Acad.Editor.UpdateScreen(); techProcess.BuildProcessing(); stopwatch.Stop(); Acad.Write($"Расчет обработки завершен {stopwatch.Elapsed}"); } catch (Autodesk.AutoCAD.Runtime.Exception ex) { techProcess.DeleteProcessCommands(); if (ex.ErrorStatus == Autodesk.AutoCAD.Runtime.ErrorStatus.UserBreak) { Acad.Write("Расчет прерван"); } else { Acad.Alert("Ошибка при выполнении расчета", ex); } } catch (Exception ex) { techProcess.DeleteProcessCommands(); Acad.Alert("Ошибка при выполнении расчета", ex); } Acad.Editor.UpdateScreen(); }
public void SendProgram(ITechProcess techProcess) { if (techProcess.ProcessCommands == null) { Acad.Alert("Программа не сформирована"); return; } var fileName = Acad.SaveFileDialog(techProcess.Caption, Settings.GetMachineSettings(techProcess.MachineType.Value).ProgramFileExtension, techProcess.MachineType.ToString()); if (fileName != null) { try { var contents = techProcess.ProcessCommands.Select(p => p.GetProgrammLine(Settings.GetMachineSettings(techProcess.MachineType.Value).ProgramLineNumberFormat)).ToArray(); File.WriteAllLines(fileName, contents); Acad.Write($"Создан файл {fileName}"); if (techProcess.MachineType == MachineType.CableSawing) { CreateImitationProgramm(contents, fileName); } } catch (Exception ex) { Acad.Alert($"Ошибка при записи файла {fileName}", ex); } } }
public void SelectProcessCommand(ITechProcess techProcess, ProcessCommand processCommand) { if (processCommand.ToolpathObjectId.HasValue) { Acad.SelectObjectIds(processCommand.ToolpathObjectId.Value); } Acad.RegenToolObject(techProcess.Tool, processCommand.HasTool, processCommand.ToolLocation, techProcess.MachineType == MachineType.Donatoni); //Settongs.IsFrontPlaneZero }
public List <ITechOperation> CreateTechOperations(ITechProcess techProcess, string techOperationName = "Все операции") => !techProcess.Validate() ? new List <ITechOperation>() : techOperationName == "Все операции" ? techProcess.CreateTechOperations() : new List <ITechOperation> { Activator.CreateInstance(_techOperationTypes[techProcess.GetType()][techOperationName], new object[] { techProcess, techOperationName }) as ITechOperation };
public void PartialProcessing(ITechProcess techProcess, ProcessCommand processCommand) { Acad.Write($"Выполняется формирование программы обработки по техпроцессу {techProcess.Caption} с команды номер {processCommand.Number}"); var toolpathObjectIds = techProcess.ToolpathObjectIds.ToList(); techProcess.SkipProcessing(processCommand); Acad.DeleteObjects(toolpathObjectIds.Except(techProcess.ToolpathObjectIds)); Acad.Editor.UpdateScreen(); }
public override void StartTechProcess(ITechProcess techProcess) { _techProcess = techProcess; _originX = techProcess.OriginX; _originY = techProcess.OriginY; ZSafety = techProcess.ZSafety; _documentLock = Acad.ActiveDocument.LockDocument(); _transaction = Acad.Database.TransactionManager.StartTransaction(); _currentSpace = (BlockTableRecord)_transaction.GetObject(Acad.Database.CurrentSpaceId, OpenMode.ForWrite, false); //StartMachineCommands(_techProcess.Caption); }
private TreeNode CreateTechProcessNode(ITechProcess techProcess) { var children = techProcess.TechOperations.ConvertAll(CreateTechOperationNode).ToArray(); var techProcessNode = new TreeNode(techProcess.Caption + " ", 0, 0, children) { Tag = techProcess, Checked = true, NodeFont = new Font(treeView.Font, FontStyle.Bold) }; treeView.Nodes.Add(techProcessNode); techProcessNode.ExpandAll(); RefreshToolButtonsState(); return(techProcessNode); }
public List <TechOperation> CreateTechOperations(ITechProcess techProcess, string techOperationName = "Все операции") { if (!techProcess.Validate()) { return(new List <TechOperation>()); } if (techOperationName == "Все операции") { return(techProcess.CreateTechOperations()); } var techOperation = (TechOperation)Activator.CreateInstance(_techOperationTypes[techProcess.GetType()][techOperationName]); techOperation.Setup(techProcess, techOperationName); return(new List <TechOperation> { techOperation }); }
public void BuildProcessing(ITechProcess techProcess) { if (!techProcess.TechOperations.Any()) { techProcess.CreateTechOperations(); } if (!techProcess.Validate() || techProcess.TechOperations.Any(p => p.Enabled && p.CanProcess && !p.Validate())) { return; } try { Acad.Write($"Выполняется расчет обработки по техпроцессу {techProcess.Caption} ..."); var stopwatch = Stopwatch.StartNew(); Acad.CreateProgressor($"Расчет обработки по техпроцессу \"{techProcess.Caption}\""); DeleteProcessing(techProcess); Acad.Editor.UpdateScreen(); techProcess.BuildProcessing(); stopwatch.Stop(); Acad.Write($"Расчет обработки завершен {stopwatch.Elapsed}"); } catch (Autodesk.AutoCAD.Runtime.Exception ex) { techProcess.DeleteProcessCommands(); if (ex.ErrorStatus == Autodesk.AutoCAD.Runtime.ErrorStatus.UserBreak) { Acad.Write("Расчет прерван"); } else { Acad.Alert("Ошибка при выполнении расчета", ex); } } catch (Exception ex) { techProcess.DeleteProcessCommands(); Acad.Alert("Ошибка при выполнении расчета", ex); } Acad.CloseProgressor(); Acad.Editor.UpdateScreen(); }
public ProcessCommand Play(ITechProcess techProcess, int commandIndex) { var commands = techProcess.ProcessCommands.Skip(commandIndex).ToList(); var progressor = new Progressor("Проигрывание обработки", commands.Count); foreach (var command in commands) { Acad.RegenToolObject(techProcess.Tool, command.HasTool, command.ToolLocation, techProcess.MachineType == MachineType.Donatoni); if (!progressor.Progress(false)) { SelectProcessCommand(techProcess, command); return(command); } System.Threading.Thread.Sleep(30); } progressor.Stop(); return(commands.First()); }
public void SendProgram(List <ProcessCommand> processCommands, ITechProcess techProcess) { if (processCommands == null || !processCommands.Any()) { Acad.Alert("Программа не сформирована"); return; } var fileName = Acad.SaveFileDialog(techProcess.Caption, _machineSettings[techProcess.MachineType.Value].ProgramFileExtension, techProcess.MachineType.ToString()); if (fileName != null) { try { var contents = processCommands?.Select(p => p.GetProgrammLine(_machineSettings[techProcess.MachineType.Value].ProgramLineNumberFormat)).ToArray(); File.WriteAllLines(fileName, contents); Acad.Write($"Создан файл {fileName}"); } catch (Exception ex) { Acad.Alert($"Ошибка при записи файла {fileName}", ex); } } }
public SawingTechOperation(ITechProcess techProcess, Border border) : base(techProcess, $"Распиловка{border.ObjectId.GetDesc()}") { SetFromBorder(border); }
public SawingTechOperation(ITechProcess techProcess, string caption) : base(techProcess, caption) { }
public MeasurementTechOperation(ITechProcess techProcess, string caption) : base(techProcess, caption) { }
public override void Setup(ITechProcess techProcess) { base.Setup(techProcess); PointObjectIds = PointsX.SelectMany((p, i) => Acad.CreateMeasurementPoint(new Point3d(PointsX[i], PointsY[i], 0))).ToArray(); }
public void DeleteTechOperation(ITechProcess techProcess, int index) => techProcess.RemoveTechOperation(index);
public virtual void StartTechProcess(ITechProcess techProcess) { }
public void PartialProcessing(ITechProcess techProcess, ProcessCommand processCommand) { Acad.Write($"Выполняется формирование программы обработки по техпроцессу {techProcess.Caption} с команды номер {processCommand.Number}"); techProcess.SkipProcessing(processCommand); Acad.Editor.UpdateScreen(); }
public List <ITechOperation> CreateTechOperation(ITechProcess techProcess, string techOperationName) => _techProcessFactory.CreateTechOperations(techProcess, techOperationName);
public LongCleaningTechOperation(ITechProcess techProcess, string caption) : base(techProcess, caption) { }
public void DeleteExtraObjects(ITechProcess techProcess) { techProcess.SetToolpathVisible(false); Acad.DeleteExtraObjects(); //Acad.HideExtraObjects(techProcess.ToolpathCurves); }
private void DeleteProcessing(ITechProcess techProcess) { Acad.DeleteObjects(techProcess.ToolpathObjectIds); Acad.DeleteExtraObjects(); techProcess.DeleteProcessCommands(); }
public void SelectTechProcess(ITechProcess techProcess) { techProcess.SetToolpathVisible(true); Acad.Editor.UpdateScreen(); }
public void DeleteTechProcess(ITechProcess techProcess) { techProcess.Teardown(); TechProcessList.Remove(techProcess); }