private void AlignHeads_Click(object sender, RoutedEventArgs e) { var state = Cnc.PlannedState; var xSteps = state.X - state.U; var ySteps = state.Y - state.V; var builder = new PlanBuilder(); builder.AddRampedLineXY(-xSteps, -ySteps, Constants.MaxPlaneAcceleration, Constants.MaxPlaneSpeed); Cnc.SEND(builder.Build()); }
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 GoToZeros_Click(object sender, RoutedEventArgs e) { var state = Cnc.PlannedState; var stepsU = _positionOffsetU - state.U; var stepsV = _positionOffsetV - state.V; var stepsX = _positionOffsetX - state.X; var stepsY = _positionOffsetY - state.Y; var planner = new PlanBuilder(); planner.AddRampedLineUVXY(stepsU, stepsV, stepsX, stepsY, Constants.MaxPlaneAcceleration, Constants.MaxPlaneSpeed); Cnc.SEND(planner.Build()); }
public SyncPlan BuildPlan(IEnumerable <string> paths, Mask mask) { Analyze(paths, mask); PlanBuilder builder = new PlanBuilder(_tager, mask); var plan = builder.Build(NotSynchronizedFiles.Keys); foreach (var errorFile in builder.ErrorFiles) { ErrorFiles.Add(errorFile.Key, errorFile.Value); } return(plan); }
private void executePlan() { if (!Cnc.IsHomeCalibrated) { ShowError("Calibration is required!"); return; } disableMotionCommands(); Workspace.DisableChanges(); var builder = new PlanBuilder(); var point = Workspace.EntryPoint; var state = Cnc.PlannedState; var initU = point.PositionC1 - state.U; var initV = point.PositionC2 - state.V; var initX = point.PositionC1 - state.X; var initY = point.PositionC2 - state.Y; builder.AddRampedLineUVXY(initU, initV, initX, initY, Configuration.MaxPlaneAcceleration, getTransitionSpeed()); try { Workspace.BuildPlan(builder); } catch (PlanningException ex) { planCompleted(); ShowError(ex.Message); return; } //builder.AddRampedLineUVXY(-initU, -initV, -initX, -initY, Constants.MaxPlaneAcceleration, getTransitionSpeed()); var plan = builder.Build(); if (!Cnc.SEND(plan)) { planCompleted(); ShowError("Plan overflows the workspace!"); return; } Cnc.OnInstructionQueueIsComplete += planCompleted; _planStart = DateTime.Now; _isPlanRunning = true; if (!plan.Any()) { planCompleted(); } }
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); } }
public Plan ToSDKPlan() { if (sdkPlan != null) { return(sdkPlan); } else if (apiPlan != null) { PlanBuilder builder = PlanBuilder.NewPlan(apiPlan.Name) .WithContract(apiPlan.Contract) .WithData(apiPlan.Data) .WithId(apiPlan.Id) .WithCycle(apiPlan.Cycle) .WithDescription(apiPlan.Description) .WithFeatures(apiPlan.Features) .WithGroup(apiPlan.Group) .WithOriginal(apiPlan.Original) .WithPrice(new PriceConverter(apiPlan.Price).ToSDKPrice()); if (apiPlan.FreeCycles != null) { builder.WithFreeCycles(apiPlan.FreeCycles.Count, apiPlan.FreeCycles.Cycle); } if (apiPlan.Quotas != null && apiPlan.Quotas.Count > 0) { foreach (API.Quota quota in apiPlan.Quotas) { builder.WithQuota(quota.Cycle, quota.Limit, quota.Scope, quota.Target); } } return(builder.Build()); } else { return(null); } }
private void setElevation(CenterCutState newState) { if (_state == newState) { //there is nothing to do return; } var elevationFactor = _state - newState; _state = newState; refreshStateButtons(); var elevation = double.Parse(Elevation.Text); var elevationSteps = (int)Math.Round(elevation / Configuration.MilimetersPerStep) * elevationFactor; var builder = new PlanBuilder(); builder.AddRampedLineUVXY(elevationSteps, 0, -elevationSteps, 0, Configuration.MaxPlaneAcceleration, Configuration.MaxPlaneSpeed); var plan = builder.Build(); _panel.Cnc.SEND(plan); }
private void Execute(PlanBuilder plan, bool duplicateUV = true) { Execute(plan.Build(), duplicateUV); }