I had to step my spindle up to keep it from shutting down. Here is the code from my post. It's long. Different spindle speed commands have different step configurations to minimize wasted time on slow tools.
Machine is a 2019 VF2SSYT on a 40hp rotary converter.
if (spindleSpeed < 1) {
error(localize("Spindle speed out of range."));
return;
}
if (spindleSpeed > 12000) {
warning(localize("Spindle speed exceeds maximum value."));
}
if (spindleSpeed > 4000 && spindleSpeed <=6000) {
writeBlock(
sOutput.format(spindleSpeed/4), mFormat.format(tool.clockwise ? 3 : 4)
);
}
if (spindleSpeed > 4000 && spindleSpeed <=6000) {
writeBlock(
"G04 P0.2"
);
}
if (spindleSpeed > 4000 && spindleSpeed <=6000) {
writeBlock(
sOutput.format(spindleSpeed/2.5), mFormat.format(tool.clockwise ? 3 : 4)
);
}
if (spindleSpeed > 4000 && spindleSpeed <=6000) {
writeBlock(
"G04 P0.2"
);
}
if (spindleSpeed > 4000 && spindleSpeed <=6000) {
writeBlock(
sOutput.format(spindleSpeed/1.5), mFormat.format(tool.clockwise ? 3 : 4)
);
}
if (spindleSpeed > 4000 && spindleSpeed <=6000) {
writeBlock(
"G04 P0.2"
);
}
if (spindleSpeed > 6000) {
writeBlock(
sOutput.format(spindleSpeed/32), mFormat.format(tool.clockwise ? 3 : 4)
);
}
if (spindleSpeed > 6000) {
writeBlock(
"G04 p0.05"
);
}
if (spindleSpeed > 6000) {
writeBlock(
sOutput.format(spindleSpeed/16), mFormat.format(tool.clockwise ? 3 : 4)
);
}
if (spindleSpeed > 6000) {
writeBlock(
"G04 p0.05"
);
}
if (spindleSpeed > 6000) {
writeBlock(
sOutput.format(spindleSpeed/10.66), mFormat.format(tool.clockwise ? 3 : 4)
);
}
if (spindleSpeed > 6000) {
writeBlock(
"G04 p0.05"
);
}
if (spindleSpeed > 6000) {
writeBlock(
sOutput.format(spindleSpeed/8), mFormat.format(tool.clockwise ? 3 : 4)
);
}
if (spindleSpeed > 6000) {
writeBlock(
"G04 p0.05"
);
}
if (spindleSpeed > 6000) {
writeBlock(
sOutput.format(spindleSpeed/6.41), mFormat.format(tool.clockwise ? 3 : 4)
);
}
if (spindleSpeed > 6000) {
writeBlock(
"G04 p0.05"
);
}
if (spindleSpeed > 6000) {
writeBlock(
sOutput.format(spindleSpeed/5.319), mFormat.format(tool.clockwise ? 3 : 4)
);
}
if (spindleSpeed > 6000) {
writeBlock(
"G04 p0.05"
);
}
if (spindleSpeed > 6000) {
writeBlock(
sOutput.format(spindleSpeed/4.566), mFormat.format(tool.clockwise ? 3 : 4)
);
}
if (spindleSpeed > 6000) {
writeBlock(
"G04 p0.05"
);
}
if (spindleSpeed > 6000) {
writeBlock(
sOutput.format(spindleSpeed/4), mFormat.format(tool.clockwise ? 3 : 4)
);
}
if (spindleSpeed > 6000) {
writeBlock(
"G04 p0.05"
);
}
if (spindleSpeed > 6000) {
writeBlock(
sOutput.format(spindleSpeed/3.558), mFormat.format(tool.clockwise ? 3 : 4)
);
}
if (spindleSpeed > 6000) {
writeBlock(
"G04 p0.05"
);
}
if (spindleSpeed > 6000) {
writeBlock(
sOutput.format(spindleSpeed/3.195), mFormat.format(tool.clockwise ? 3 : 4)
);
}
if (spindleSpeed > 6000) {
writeBlock(
"G04 p0.05"
);
}
if (spindleSpeed > 6000) {
writeBlock(
sOutput.format(spindleSpeed/2.9), mFormat.format(tool.clockwise ? 3 : 4)
);
}
if (spindleSpeed > 6000) {
writeBlock(
"G04 p0.05"
);
}
if (spindleSpeed > 6000) {
writeBlock(
sOutput.format(spindleSpeed/2.66), mFormat.format(tool.clockwise ? 3 : 4)
);
}
if (spindleSpeed > 6000) {
writeBlock(
"G04 p0.05"
);
}
if (spindleSpeed > 6000) {
writeBlock(
sOutput.format(spindleSpeed/2.46), mFormat.format(tool.clockwise ? 3 : 4)
);
}
if (spindleSpeed > 6000) {
writeBlock(
"G04 p0.05"
);
}
if (spindleSpeed > 6000) {
writeBlock(
sOutput.format(spindleSpeed/2.28), mFormat.format(tool.clockwise ? 3 : 4)
);
}
if (spindleSpeed > 6000) {
writeBlock(
"G04 p0.05"
);
}
if (spindleSpeed > 6000) {
writeBlock(
sOutput.format(spindleSpeed/2.13), mFormat.format(tool.clockwise ? 3 : 4)
);
}
if (spindleSpeed > 6000) {
writeBlock(
"G04 p0.05"
);
}
if (spindleSpeed > 6000) {
writeBlock(
sOutput.format(spindleSpeed/2), mFormat.format(tool.clockwise ? 3 : 4)
);
}
if (spindleSpeed > 6000) {
writeBlock(
"G04 p0.05"
);
}
if (spindleSpeed > 6000) {
writeBlock(
sOutput.format(spindleSpeed/1.91), mFormat.format(tool.clockwise ? 3 : 4)
);
}
if (spindleSpeed > 6000) {
writeBlock(
"G04 p0.05"
);
}
if (spindleSpeed > 6000) {
writeBlock(
sOutput.format(spindleSpeed/1.845), mFormat.format(tool.clockwise ? 3 : 4)
);
}
if (spindleSpeed > 6000) {
writeBlock(
"G04 p0.05"
);
}
if (spindleSpeed > 6000) {
writeBlock(
sOutput.format(spindleSpeed/1.776), mFormat.format(tool.clockwise ? 3 : 4)
);
}
if (spindleSpeed > 6000) {
writeBlock(
"G04 p0.05"
);
}
if (spindleSpeed > 6000) {
writeBlock(
sOutput.format(spindleSpeed/1.71), mFormat.format(tool.clockwise ? 3 : 4)
);
}
if (spindleSpeed > 6000) {
writeBlock(
"G04 p0.05"
);
}
if (spindleSpeed > 6000) {
writeBlock(
sOutput.format(spindleSpeed/1.65), mFormat.format(tool.clockwise ? 3 : 4)
);
}
if (spindleSpeed > 6000) {
writeBlock(
"G04 p0.05"
);
}
if (spindleSpeed > 6000) {
writeBlock(
sOutput.format(spindleSpeed/1.6), mFormat.format(tool.clockwise ? 3 : 4)
);
}
if (spindleSpeed > 6000) {
writeBlock(
"G04 p0.05"
);
}
if (spindleSpeed > 6000) {
writeBlock(
sOutput.format(spindleSpeed/1.56), mFormat.format(tool.clockwise ? 3 : 4)
);
}
if (spindleSpeed > 6000) {
writeBlock(
"G04 p0.05"
);
}
if (spindleSpeed > 6000) {
writeBlock(
sOutput.format(spindleSpeed/1.51), mFormat.format(tool.clockwise ? 3 : 4)
);
}
if (spindleSpeed > 6000) {
writeBlock(
"G04 p0.05"
);
}
if (spindleSpeed > 6000) {
writeBlock(
sOutput.format(spindleSpeed/1.47), mFormat.format(tool.clockwise ? 3 : 4)
);
}
if (spindleSpeed > 6000) {
writeBlock(
"G04 p0.05"
);
}
if (spindleSpeed > 6000) {
writeBlock(
sOutput.format(spindleSpeed/1.43), mFormat.format(tool.clockwise ? 3 : 4)
);
}
if (spindleSpeed > 6000) {
writeBlock(
"G04 p0.05"
);
}
if (spindleSpeed > 6000) {
writeBlock(
sOutput.format(spindleSpeed/1.39), mFormat.format(tool.clockwise ? 3 : 4)
);
}
if (spindleSpeed > 6000) {
writeBlock(
"G04 p0.05"
);
}
if (spindleSpeed > 6000) {
writeBlock(
sOutput.format(spindleSpeed/1.36), mFormat.format(tool.clockwise ? 3 : 4)
);
}
if (spindleSpeed > 6000) {
writeBlock(
"G04 p0.05"
);
}
if (spindleSpeed > 6000) {
writeBlock(
sOutput.format(spindleSpeed/1.33), mFormat.format(tool.clockwise ? 3 : 4)
);
}
if (spindleSpeed > 6000) {
writeBlock(
"G04 p0.05"
);
}
if (spindleSpeed > 6000) {
writeBlock(
sOutput.format(spindleSpeed/1.3), mFormat.format(tool.clockwise ? 3 : 4)
);
}
if (spindleSpeed > 6000) {
writeBlock(
"G04 p0.05"
);
}if (spindleSpeed > 6000) {
writeBlock(
sOutput.format(spindleSpeed/1.27), mFormat.format(tool.clockwise ? 3 : 4)
);
}
if (spindleSpeed > 6000) {
writeBlock(
"G04 p0.05"
);
}
if (spindleSpeed > 6000) {
writeBlock(
sOutput.format(spindleSpeed/1.25), mFormat.format(tool.clockwise ? 3 : 4)
);
}
if (spindleSpeed > 6000) {
writeBlock(
"G04 p0.05"
);
}
if (spindleSpeed > 6000) {
writeBlock(
sOutput.format(spindleSpeed/1.22), mFormat.format(tool.clockwise ? 3 : 4)
);
}
if (spindleSpeed > 6000) {
writeBlock(
"G04 p0.05"
);
}
if (spindleSpeed > 6000) {
writeBlock(
sOutput.format(spindleSpeed/1.19), mFormat.format(tool.clockwise ? 3 : 4)
);
}
if (spindleSpeed > 6000) {
writeBlock(
"G04 p0.05"
);
}
if (spindleSpeed > 6000) {
writeBlock(
sOutput.format(spindleSpeed/1.17), mFormat.format(tool.clockwise ? 3 : 4)
);
}
if (spindleSpeed > 6000) {
writeBlock(
"G04 p0.05"
);
}
if (spindleSpeed > 6000) {
writeBlock(
sOutput.format(spindleSpeed/1.149), mFormat.format(tool.clockwise ? 3 : 4)
);
}
if (spindleSpeed > 6000) {
writeBlock(
"G04 p0.05"
);
}
if (spindleSpeed > 6000) {
writeBlock(
sOutput.format(spindleSpeed/1.13), mFormat.format(tool.clockwise ? 3 : 4)
);
}
if (spindleSpeed > 6000) {
writeBlock(
"G04 p0.05"
);
}
if (spindleSpeed > 6000) {
writeBlock(
sOutput.format(spindleSpeed/1.11), mFormat.format(tool.clockwise ? 3 : 4)
);
}
if (spindleSpeed > 6000) {
writeBlock(
"G04 p0.05"
);
}
if (spindleSpeed > 6000) {
writeBlock(
sOutput.format(spindleSpeed/1.10), mFormat.format(tool.clockwise ? 3 : 4)
);
}
if (spindleSpeed > 6000) {
writeBlock(
"G04 p0.05"
);
}
if (spindleSpeed > 6000) {
writeBlock(
sOutput.format(spindleSpeed/1.08), mFormat.format(tool.clockwise ? 3 : 4)
);
}
if (spindleSpeed > 6000) {
writeBlock(
"G04 p0.05"
);
}
if (spindleSpeed > 6000) {
writeBlock(
sOutput.format(spindleSpeed/1.07), mFormat.format(tool.clockwise ? 3 : 4)
);
}
if (spindleSpeed > 6000) {
writeBlock(
"G04 p0.05"
);
}
if (spindleSpeed > 6000) {
writeBlock(
sOutput.format(spindleSpeed/1.058), mFormat.format(tool.clockwise ? 3 : 4)
);
}
if (spindleSpeed > 6000) {
writeBlock(
"G04 p0.05"
);
}
if (spindleSpeed > 6000) {
writeBlock(
sOutput.format(spindleSpeed/1.04), mFormat.format(tool.clockwise ? 3 : 4)
);
}
if (spindleSpeed > 6000) {
writeBlock(
"G04 p0.05"
);
}
if (spindleSpeed > 6000) {
writeBlock(
sOutput.format(spindleSpeed/1.03), mFormat.format(tool.clockwise ? 3 : 4)
);
}
if (spindleSpeed > 6000) {
writeBlock(
"G04 p0.05"
);
}
if (spindleSpeed > 6000) {
writeBlock(
sOutput.format(spindleSpeed/1.02), mFormat.format(tool.clockwise ? 3 : 4)
);
}
if (spindleSpeed > 6000) {
writeBlock(
"G04 p0.05"
);
}
if (spindleSpeed > 4000) {
writeBlock(
sOutput.format(spindleSpeed), mFormat.format(tool.clockwise ? 3 : 4)
);
}
if (spindleSpeed > 4000) {
writeBlock(
"G04 P0.2"
);
}
if (spindleSpeed <= 4000) {
writeBlock(
sOutput.format(spindleSpeed), mFormat.format(tool.clockwise ? 3 : 4)
);
}
if (spindleSpeed < 1) {
error(localize("Spindle speed out of range."));
return;
}
if (spindleSpeed > 12000) {
warning(localize("Spindle speed exceeds maximum value."));
}