Hi Guys,
I've trying to work on this for over a week now... Absolutely stumped.
I've plugin that controls a drill moving from Z0 to Z-(a variable). When I click the pause button I want it to retract 1mm (which is in the positive direction). I've managed this in two ways, neither of which are acceptable. Need help please.
The below works but requires me to click OK on a popup box. I don't like this solution because it's an extra action from the operator, and if the operator is slow or forgets, then the drill tip will rub during spindle deceleration.
UC.StopWithDeccel(); //Stops the G - code execution
double Z_Pos_Desired = UC.GetZpos() + 1;
MessageBox.Show(new Form { TopMost = true }, "Drill will be retracted by 1mm to prevent rubbing", "Drilling Operation Paused", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
UC.Code("G0 Z" + Z_Pos_Desired);
For an unknown reason, if I remove the MessageBox then it always returns to Z0 (not ideal). This happens regardless of whether I call the command from the plugin or a Macro.
UC.StopWithDeccel(); //Stops the G - code execution
double Z_Pos_Desired = UC.GetZpos() + 1;
UC.Code("G0 Z" + Z_Pos_Desired);
I have also tried the button route:
UC.StopWithDeccel(); //Stops the G - code execution
UC.Callbutton(166); // Sets the jog distance when stepping mode to 1.00 Units
UC.Callbutton(162); // Sets the jog mode to stepping.
UC.Callbutton(151); // Jogs the Z axis to positive direction 1mm (away from cut face, stops rubbing)
This works, but only once per UCCNC startup. If I press this plugin PAUSE button again and haven't restarted UCCNC, then it does nothing.
Can anyone explain what is going on? Got any ideas to achieve this without the MessageBox.Show?
Regards,
Jesse.