probing macro not responding
Posted: Tue Jan 03, 2023 3:09 pm
Hi all,
can someone tell why the following macro goes wrong every now and then ( circa every 10/15 correct probing there is one wrong)?
common issues are:
1) wrong feedrate ( doesn't get the correct feedrate)
2) doesn't swap from G90 to G91 or viceversa
3) moves in absolutely unpredictable positions
4) strange alert window ... "a file read error occurred. The file loading wil be aborted now"
here is the macro:
Thanks for the help
Giorgio
can someone tell why the following macro goes wrong every now and then ( circa every 10/15 correct probing there is one wrong)?
common issues are:
1) wrong feedrate ( doesn't get the correct feedrate)
2) doesn't swap from G90 to G91 or viceversa
3) moves in absolutely unpredictable positions
4) strange alert window ... "a file read error occurred. The file loading wil be aborted now"
here is the macro:
- Code: Select all
Probing(0,0);
#Events
const double Zmin = -250;
const double safeZ = -1;
const double Retract_for_second_measurement = 0.5;
//feedrate machine
const double FeedrateFast = 1000;
const double FeedrateSlow = 50;
public double Probing(double x_offset = 0, double y_offset = 0){
// Security Z
SendCode("G53 G0 Z"+ safeZ);
SendCode("F"+ FeedrateFast);
// First touch
SendCode("G31 Z" + Zmin ); // Do the Z probing with Fast feedrate first
SendCode("G91");
SendCode("G0 Z" + Retract_for_second_measurement);
SendCode("G90");
SendCode("F"+ FeedrateSlow);
// Second touch
SendCode("G31 Z" + Zmin); // Do the Z probing again with Slow Feedrate to get a more accurate reading
double Z = exec.GetZmachpos();
SendCode("G53 G0 Z"+ safeZ);
return Z;
}
//* SendCode
// @brief:
// Invia una stringa di codice alla macchina e aspetta che finisca il muovimento.
// @param:
// code = Stringa di codice da inviare.
// @return:
// True se la stringa è stata eseguita, false la macchina è in macrostopped.
public bool SendCode(string code){
if(!exec.Ismacrostopped()){
exec.Code(code);
Thread.Sleep(150);
while(exec.IsMoving()){}
return true;
}
return false;
}
Thanks for the help
Giorgio