public TimeSpan AnalyzeCommand(GrblCommand cmd, bool compute, GrblConf conf = null) { bool delete = !cmd.JustBuilt; if (!cmd.JustBuilt) { cmd.BuildHelper(); } UpdateModalsNB(cmd); mCurX.Update(cmd.X, ABS); mCurY.Update(cmd.Y, ABS); mCurF.Update(cmd.F); mCurS.Update(cmd.S); TimeSpan rv = compute ? ComputeExecutionTime(cmd, conf) : TimeSpan.Zero; if (delete) { cmd.DeleteHelper(); } return(rv); }
public List<GrblConf.GrblConfParam> GetChanges() { List<GrblConf.GrblConfParam> rv = new List<GrblConf.GrblConfParam>(); GrblConf conf = Core.Configuration; foreach (GrblConf.GrblConfParam p in mLocalCopy) if (conf.HasChanges(p)) rv.Add(p); return rv; }
public bool HasChanges() { GrblConf conf = Core.Configuration; if (conf.Count != mLocalCopy.Count) return true; foreach(GrblConf.GrblConfParam p in mLocalCopy) if (conf.HasChanges(p)) return true; return false; }
public bool HasChanges() { GrblConf conf = Core.Configuration; if (conf.Count != mLocalCopy.Count) { return(true); } foreach (GrblConf.GrblConfParam p in mLocalCopy) { if (conf.HasChanges(p)) { return(true); } } return(false); }
private TimeSpan ComputeExecutionTime(GrblCommand cmd, GrblConf conf) { if (G0 && cmd.IsLinearMovement) { return(TimeSpan.FromMinutes((double)GetSegmentLenght(cmd) / (double)conf.MaxRateX)); //todo: use a better computation of xy if different speed } else if (G1G2G3 && cmd.IsMovement && mCurF.Number != 0) { return(TimeSpan.FromMinutes((double)GetSegmentLenght(cmd) / (double)Math.Min(mCurF.Number, conf.MaxRateX))); } else if (cmd.IsPause) { return(cmd.P != null?TimeSpan.FromSeconds((double)cmd.P.Number) : cmd.S != null?TimeSpan.FromSeconds((double)cmd.S.Number) : TimeSpan.Zero); } else { return(TimeSpan.Zero); } }
public TimeSpan AnalyzeCommand(GrblCommand cmd, bool compute, GrblConf conf = null) { bool delete = !cmd.JustBuilt; if (!cmd.JustBuilt) { cmd.BuildHelper(); } UpdateModalsNB(cmd); UpdateWCO(cmd); UpdateXYZ(cmd); UpdateFS(cmd); TimeSpan rv = compute ? ComputeExecutionTime(cmd, conf) : TimeSpan.Zero; if (delete) { cmd.DeleteHelper(); } return(rv); }
private void Analyze() //analyze the file and build global range and timing for each command { GrblCommand.StatePositionBuilder spb = new GrblCommand.StatePositionBuilder(); mRange.ResetRange(); mRange.UpdateXYRange("X0", "Y0", false); mEstimatedTotalTime = TimeSpan.Zero; foreach (GrblCommand cmd in list) { try { GrblConf conf = (GrblConf)Settings.GetObject("Grbl Configuration", new GrblConf()); TimeSpan delay = spb.AnalyzeCommand(cmd, true, conf); mRange.UpdateSRange(spb.S); mRange.UpdateXYRange(spb.X, spb.Y, spb.LaserBurning); mEstimatedTotalTime += delay; cmd.SetOffset(mEstimatedTotalTime); } catch (Exception ex) { throw ex; } finally { cmd.DeleteHelper(); } } }