The mill_func.h features the lift_up as well as the coolant_motor_start code blocks.
lift_up()
{
if (proc==plc_proc_spindle) //Lift if spindle was ON
{
z1=gvarget(17003); //Use the absolute program coordinates
timer=10; do{timer--;}while (timer>0);
z2=gvarget(7020); //Use the lift value
z2=z2*100; //multiply lift value by 100, since PLC motion commands operate using 0.01 of chosen unit
zmax=gvarget(17053)-5; //use Limit Z (in PLC motion command units)
//(on older software versions which do not have Global Var #17053, can use #5433*100)
zmachine=gvarget(17023); //Current machine coordinates
zmax=zmax-zmachine; //Calculate distance to limit
if (absolute==0)
{ //If lift in incremental mode, then check if lift does not go above limit and stop at limit in that case
if (zmax<z2) {z2=zmax-5;};
z2=z1+z2;
}else
{ //same in absolute mode
zlen=z2-z1;
if (zmax<zlen)
{
z2=z1+zmax;
};
};
z1=z1+10; //add 0,1mm gap
if (z2>z1) //if lift less than 0,1mm, do not lift at all
{ //position coordinate in given axis in 0.01 units (mm)
gvarset(7080,speed_z); //set speed
g0moveA(1,0x4,z2); //absolute programming; Z axis;
timer=300; do{timer--;}while (timer>0); //wait motion started
//wait motion stopped
do
{ ex=0; code=gvarget(6060);
if (code==0x4d) {ex=1;};
if (code==0x57) {ex=1;};
} while(ex==0);
};
};
};