What the matter?
The official post processor available for download from the Autodesk post processor library for use with LinuxCNC turning seems to work reasonably well but when you select the G28 safe retract option within the post processor dialogue box, the resulting g-code defines the retract coordinates in U & W rather than X & Z.
This is what we get at the end of the file, where we want the machine to do a safe retract:
N592 M9
N593 M5
N594 G28 U0.
N595 M30
%
This is what we need:
N592 M9
N593 M5
N594 G28 X0.
N595 M30
%
Unfortunately, LinuxCNC doesn't recognise movements in U & W, so it barfs when you try to run that line of code. However, when you select the G53 alternative scheme for safe retract, no problem. Hmm.
Let's look at the post processor script (the current version is r43470):
// format home positions
for (var i = 0; i < retractAxes.length; ++i) {
switch (retractAxes[i]) {
case X:
words.push((method == "G28" ? "U" : "X") + xFormat.format(_xHome));
retracted[X] = true;
xOutput.reset();
break;
case Y:
if (yOutput.isEnabled()) {
words.push((method == "G28" ? "V" : "Y") + yFormat.format(_yHome));
yOutput.reset();
}
break;
case Z:
words.push((method == "G28" ? "W" : "Z") + zFormat.format(_zHome));
retracted[Z] = true;
zOutput.reset();
break;
case XZ:
words.push((method == "G28" ? "U" : "X") + xFormat.format(_xHome));
words.push((method == "G28" ? "W" : "Z") + zFormat.format(_zHome));
retracted[X] = true;
retracted[Z] = true;
xOutput.reset();
zOutput.reset();
break;
default:
error(localize("Unsupported axis specified for writeRetract()."));
return;
}
}
for (var i = 0; i < words.length; ++i) {
switch (method) {
case "G28":
writeBlock(gFormat.format(28), singleLineRetract ? words : words[i]);
break;
case "G53":
gMotionModal.reset();
writeBlock(gFormat.format(53), gMotionModal.format(0), singleLineRetract ? words : words[i]);
break;
default:
error(localize("Unsupported safe position method."));
return;
}
if (singleLineRetract) {
break;
}
}
singleLineRetract = false; // singleLineRetract reset
}
The red lines will cause "U" and "W" prefices to be generated if G28 is chosen from the dialogue or "X" and "Z" in any other case. Given that the only alternative selection is G53, this explains what we are seeing ie either G28 X0 W0 or G28 U0 W0 etc.
FYI, the "?" ternary operator allows selection of one of two options according to the condition of the first term. So if the variable "method" has the value "G28", the prefix "U" or "W" will be chosen, otherwise, we will get "X" or "Z".
In the previous-but-one version of the LinuxCNC post (r43417), we saw different content - and furthermore it actually output the correct G28 X0 Z0 code.
// format home positions
for (var i = 0; i < retractAxes.length; ++i) {
switch (retractAxes[i]) {
case X:
words.push((method == "G28","X") + xFormat.format(_xHome));
retracted[X] = true;
xOutput.reset();
break;
case Y:
if (yOutput.isEnabled()) {
words.push((method == "G28" ? "V" : "Y") + yFormat.format(_yHome));
yOutput.reset();
}
break;
case Z:
words.push((method == "G28","Z") + zFormat.format(_zHome));
retracted[Z] = true;
zOutput.reset();
break;
case XZ:
words.push((method == "G28","X") + xFormat.format(_xHome));
words.push((method == "G28","Z") + zFormat.format(_zHome));
retracted[X] = true;
retracted[Z] = true;
xOutput.reset();
zOutput.reset();
break;
default:
error(localize("Unsupported axis specified for writeRetract()."));
return;
}
}
for (var i = 0; i < words.length; ++i) {
switch (method) {
case "G28":
writeBlock(gFormat.format(28), singleLineRetract ? words : words[i]);
break;
case "G53":
gMotionModal.reset();
writeBlock(gFormat.format(53), gMotionModal.format(0), singleLineRetract ? words : words[i]);
break;
default:
error(localize("Unsupported safe position method."));
return;
}
if (singleLineRetract) {
break;
}
}
singleLineRetract = false; // singleLineRetract reset
}
So somebody somewhere in Autodesk managed to fuck this bit up. Nobody knows why of course. The fix is to paste in the red lines from the first section into the latest post processor (ie in place of the red text in the second).
Note that there's also some "orphan" content referring to the Y axis (in blue) that has clearly been left over from a milling post. It shouldn't have any effect but it's not fully approved.
Good to have fixed that. I'd much rather use G28 than specify G53 machine coordinates.
No comments:
Post a Comment