private void Goto_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(GotoText.Text)) { ConnectionExpander.WriteCOMPortFmt("$J=G53 {0}", GotoText.Text); } }
private void _jogTimer_Tick(object sender, EventArgs e) { if (!_mouseIsJogging || GRBLMachinePlugin.CurrentMachineState == GRBLMachinePlugin.MachineState.Alarm) { _jogTimer.Stop(); return; } /*if (!ConnectionExpander.IsCOMPortIdle) { * return; // Still moving * }*/ const float px2mm = 0.5f; const float maxMmPerMove = 10; const float nominalFeed = 1000; float relX = Math.Abs(_mouseJogDelta.X) * px2mm; float relY = Math.Abs(_mouseJogDelta.Y) * px2mm; float largestDelta = Math.Max(relX, relY); float speedPercent = 1.0f; if (largestDelta > maxMmPerMove) { // Make sure we never move more than 5mm per jog command relX *= maxMmPerMove / largestDelta; relY *= maxMmPerMove / largestDelta; speedPercent = largestDelta / maxMmPerMove; } float moveX = relX * Math.Sign(_mouseJogDelta.X); float moveY = relY * -Math.Sign(_mouseJogDelta.Y); float feed = speedPercent * nominalFeed; ConnectionExpander.WriteCOMPort((char)0x85); // Jog cancel for previous jog ConnectionExpander.WriteCOMPortFmt("$J=G91 G21 X{0:+#;-#;+0} Y{1:+#;-#;+0} F{2}", moveX, moveY, feed); }
private void ZProbeButton_Click(object sender, EventArgs e) { OriginButton.Enabled = false; // Will run your router drill into the workpiece ... ThreadedGCodeExecute( () => ConnectionExpander.WriteCOMPort("G43.1 Z0"), // Remove any existing tool offset () => ConnectionExpander.WriteCOMPort("G10 L2 P0 Z0"), // Reset WCS to absolute machine 0 (Z-Probe target Z is based on WCS origin) () => ConnectionExpander.WriteCOMPortFmt("G38.2 F200 Z{0}", GRBLMachinePlugin.Props.ZProbeToolDropTargetZ), // Perform Z-Probe () => ConnectionExpander.WriteCOMPort("G10 L20 P0 Z0"), // Set WCS Z to probe Z () => ConnectionExpander.WriteCOMPortFmt("G43.1 Z{0}", GRBLMachinePlugin.Props.ZProbeToolOffset) // Set tool offset again ); }
private void GotoMouse_Click(object sender, EventArgs e) { MoveToLocationMode editMode = new MoveToLocationMode(CamBamUI.MainUI.ActiveView); editMode.DefaultValue = (object)null; editMode.Prompt = "Select Move Destination"; editMode.OnReturnOK += (o, ea) => { Point3F moveDelta = editMode.MoveDestination - editMode.MoveSource; ThisApplication.AddLogMessage("MoveDelta = " + moveDelta); ConnectionExpander.WriteCOMPortFmt("$J=G91 G21 X{0:+#;-#;+0} Y{1:+#;-#;+0} F4000", moveDelta.X, moveDelta.Y); }; CamBamUI.MainUI.ActiveView.SetEditMode((EditMode)editMode); CamBamUI.MainUI.ActiveView.RepaintEditMode(); }