private MachineInformation GetMachineInfo() { //var items = CopyUtil.DeepCopyBaseOnJSon(this.provider.DataCollection); var items = this.provider.DataCollection; var p1 = SystemContext.Hardware.GetCurrentPosition(); var p2 = items[0].Points[0]; var data = new DataUnit(DataUnitTypes.Polyline, 0, new List <PointF> { p1, p2 }); items.Insert(0, data); this.UpdateReturnPoint(); var p3 = SystemContext.MachineControlPara.ReturnPoint; if (p3 != null) { var tmp = items[items.Count - 1].Points; var p4 = tmp[tmp.Count - 1]; data = new DataUnit(DataUnitTypes.Polyline, 0, new List <PointF> { p4, p3.Value }); items.Add(data); } var process = ProcessFactory.CreateNewProcess(items); process.IsFirst = true; items.Remove(data); return(process.MachineInfo); }
public void MakeMachining(DataProvider data, CancellationToken token) { this.data = data; this.totalLen = this.data.TotalLen; this.token = token; var collection = this.GetDataCollection(data); if (!collection.Any()) { return; } this.point = collection[0].Points[0]; this.MoveTo(this.point); int offset = 1; for (int i = 0; i < collection.Count; i += offset) { var items = this.GetContinous(i, collection); offset = items.Count; this.figureId = this.GetFigureId(items[0].LayerId); if (!string.IsNullOrEmpty(this.figureId)) { OperationEngine.Instance.NotityMarkPathAdd(this.figureId, items[0].Points[0]); } var process = ProcessFactory.CreateNewProcess(items); //process.IsFirst = i == 0; //var next = (i + offset == collection.Count) ? null : collection[i + offset]; //if (next != null && next.LayerId == Constants.EmptyLayerId) //{ // double limit = GlobalModel.Params.LayerConfig.UnLiftMaxEmptyMoveLength; // process.IsEmptyMoveShort = next.Length < limit; //} this.UpdateProcess(process, collection, items); process.Execute(token, this.HandlePosInfo); token.ThrowIfCancellationRequested(); } }