Part / Material Test Fit Macro, ported from Mach3
(Note... new to uccnc, seems to work fine on my machine, usual disclaimers apply).
Thought I'd have a go at trying to progress uccnc & the community + learn c# a little with respect to uccnc (hence the comments... ) , give a man a fish, eat for a day, teach him how to fish & he'll sit & drink beer all day by the side of the river
Rob
edit: added a beep at each of the extent points (you can comment it out if it annoys you)
Code:
/* M1020
Part Extents Macro to test material fit
ported from Mach3 to C# for uccnc, thanks to BR549/Vmax549/TP for the original macro
25/06/2016 - robertspark
NOTE: Set your feedrate and Dwell Time according to you machine parameters / units / requirements.
*/
double FR = 1000; // sets Feedrate
double DT = 3000; // Sets Dwell Time (mSec, 3000 = 3 sec)
string XMax = AS3.Getfield(888); // 888 Diagnostics_maxX
string XMin = AS3.Getfield(885); // 885 Diagnostics_minX
string YMax = AS3.Getfield(889); // 889 Diagnostics_maxY
string YMin = AS3.Getfield(886); // 886 Diagnostics_minY
DialogResult result;
result = MessageBox.Show("Is Your Z HEIGHT Safe To Travel?", "check!!!" , MessageBoxButtons.YesNo);
if (result == System.Windows.Forms.DialogResult.Yes)
{
exec.Code("G92 X0 Y0 Z0"); // Zero the DRO's
exec.Code("G01 X" + XMin + " Y" + YMin + " F" + FR); // Move to Minimum X & Y Coordinates
while(exec.IsMoving()){}
exec.Wait(200);
Console.Beep();
exec.Code("G04 P" + DT);
exec.Code("G01 Y" + YMax); // Move to Maximum Y Coordinates
while(exec.IsMoving()){}
exec.Wait(200);
Console.Beep();
exec.Code("G04 P" + DT);
exec.Code("G01 X" + XMax); // Move to Maximum X Coordinates
while(exec.IsMoving()){}
exec.Wait(200);
Console.Beep();
exec.Code("G04 P" + DT);
exec.Code("G01 Y" + YMin); // Move to Minimum Y Coordinates
while(exec.IsMoving()){}
exec.Wait(200);
Console.Beep();
exec.Code("G04 P" + DT);
exec.Code("G01 X" + XMin); // Move to Minimum X Coordinates
while(exec.IsMoving()){}
exec.Wait(200);
Console.Beep();
exec.Code("G04 P" + DT);
exec.Code("G01 X0 Y0"); // Move to 0,0 X & Y Coordinates
while(exec.IsMoving()){}
exec.Wait(200);
Console.Beep();
}
if (result == System.Windows.Forms.DialogResult.No)
{
MessageBox.Show("Move Z To A Safe Position And Restart");
}