public void Disposes_results() { var plan = new PlanBuilder(); var aDisposable = new MyDisposable(); var create = plan.Add("Create", () => aDisposable); plan.Add("Use", (MyDisposable _) => { }, create); plan.Build().Invoke(); Check.That(() => aDisposable.IsDisposed); }
private void Execute(IEnumerable <InstructionCNC> plan, bool duplicateUV = true) { if (duplicateUV) { var builder = new PlanBuilder(); builder.Add(plan); builder.DuplicateXYtoUV(); _cnc.SEND(builder.Build()); } else { _cnc.SEND(plan); } }
/// <summary> /// Builds plan configured by the workspace. /// ASSUMING the starting position be correctly set up on <see cref="EntryPoint"/>. /// </summary> internal void BuildPlan(PlanBuilder plan) { var speedPoints = new List <Speed4Dstep>(); _entryPoint.Build(this, speedPoints, null); var planPoints = speedPoints.Select(p => p.Point).ToList(); var segmentSpeeds = speedPoints.Select(p => Tuple.Create(p.SpeedUV, p.SpeedXY)).ToArray(); //scheduler needs referential point planPoints.Insert(0, _entryPoint.CutPoints.First()); var scheduler = new StraightLinePlanner4D(CuttingSpeed); var trajectoryPlan = scheduler.CreateConstantPlan(new Trajectory4D(planPoints), segmentSpeeds); plan.Add(trajectoryPlan.Build()); }