- Posts: 5
- Thank you received: 2
// -----
// Purpose : Check probe for repeatability
// Author : WHu
// -----
// Date Version Remarks
// 20180825 1.0 Base
// -----
//
//
double Zmin = -100; //Max.Z depth
double Feedrate = 200; //Feedrate for probing
double retractheight = 20; //The retract height
double MinimumZ= 1000000; // Min measured Z height
double MaximumZ= -1000000; // Max measured Z Height
double AverageZ= 0; // Average Z height
double MaxDev=0; // Max registered deviation
double Deviation=0; // intermediate value, actual deviation
double MeasuredZ=0; // Actual measured Z height
int i=0; // loop counter
//
for(i=0; i<10;i++)
{
exec.Code("G31 Z" + Zmin + "F" + Feedrate); // Start probing
while(exec.IsMoving()){} // Wait until movement stopped
exec.Wait(1000); // Safety wait for the UC100 syncronisation
MeasuredZ=exec.GetZmachpos(); // read actual Z-height
AverageZ= AverageZ + MeasuredZ; // Add to average
if (MeasuredZ<MinimumZ) MinimumZ=MeasuredZ; // New minimum value ?
if (MeasuredZ>MaximumZ) MaximumZ=MeasuredZ; // New maximum value ?
Deviation= Math.Abs(AverageZ/(i+1) - MeasuredZ);
if (Deviation > MaxDev) MaxDev = Deviation;
// Uncomment line below to show the intermediate value
//MessageBox.Show("Probe[" + (i+1) + "]: "+ MeasuredZ+"\nMin value :"+MinimumZ+"\nMax value :"+MaximumZ+"\nMax Deviation :"+MaxDev);
double Zup = exec.GetZmachpos() + retractheight;//Calculate the new coordinate for the retract of Z axis
exec.Code("G00 G53 Z" + Zup); //Retract the Z-axis
while(exec.IsMoving()){} // Wait until movement stopped
}
if(MaxDev<0.001) MaxDev=0; // Absurd to show these values. Even 0.001 is just a gimmick for the Stepcraft ...
MessageBox.Show("Average value :"+AverageZ/10+"\nMin value :"+MinimumZ+"\nMax value :"+MaximumZ+"\nMax Deviation :"+MaxDev);
Please Log in or Create an account to join the conversation.
We use cookies on our website. Some of them are essential for the operation of the site, while others help us to improve this site and the user experience (tracking cookies). You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.