12
« on: April 27, 2018, 11:28:12 PM »
Hi,
Thanks for the help. I think I've found the relevant post processor code. Ill post it below. Ill try to describe one of my ideas: So in Fusion 360, you can set a retract plane, a feed plane, a safe plane, it's like 3-4 different planes that admittedly are a bit confusing. I'm wondering if there is something I'm doing something slightly different on the failing runs with the z height that is interacting with one of the plane heights in a strange way, like it doesnt know what to do if it starts above vs below a certain point. I guess I could test by trying a completly different post processor and see if anything changes. I'm going to be doing another prototype production run this weekend, so im sure ill run into this issue again. I might even try to capture it on video. It happens on at least 1 out of 5 runs. I agree it does seem like it would be a step or motor issue. It's super frustrating to know that at any moment the end mill will try to plunge 2" below the table.
Thanks again.
function onSection() {
var insertToolCall = isFirstSection() ||
currentSection.getForceToolChange && currentSection.getForceToolChange() ||
(tool.number != getPreviousSection().getTool().number);
var retracted = false; // specifies that the tool has been retracted to the safe plane
var newWorkOffset = isFirstSection() ||
(getPreviousSection().workOffset != currentSection.workOffset); // work offset changes
var newWorkPlane = isFirstSection() ||
!isSameDirection(getPreviousSection().getGlobalFinalToolAxis(), currentSection.getGlobalInitialToolAxis());
if (insertToolCall || newWorkOffset || newWorkPlane) {
if (properties.useG28) {
// retract to safe plane
retracted = true;
//writeBlock(gFormat.format(28), gAbsIncModal.format(91), "Z" + xyzFormat.format(machineConfiguration.getRetractPlane())); // retract
writeBlock(gFormat.format(53), "Z-2");// FRANCO 1-22-17
writeBlock(gFormat.format(53), "Y2");// FRANCO 1-22-17
writeBlock(gAbsIncModal.format(90));
zOutput.reset();
}
}
writeln("");
if (hasParameter("operation-comment")) {
var comment = getParameter("operation-comment");
if (comment) {
writeComment(comment);
}
}
if (insertToolCall) {
forceWorkPlane();
onCommand(COMMAND_STOP_SPINDLE);
onCommand(COMMAND_COOLANT_OFF);
if (!isFirstSection() && properties.optionalStop) {
onCommand(COMMAND_OPTIONAL_STOP);
}
if (tool.number > 256) {
warning(localize("Tool number exceeds maximum value."));
}
if (properties.useM6) {
writeBlock("T" + toolFormat.format(tool.number), mFormat.format(6));
writeBlock(mFormat.format(0), "(CHANGE-TOOL)"); // FRANCO 1-22-17
} else {
writeBlock("T" + toolFormat.format(tool.number));
}
if (tool.comment) {
writeComment(tool.comment);
}
var showToolZMin = false;
if (showToolZMin) {
if (is3D()) {
var numberOfSections = getNumberOfSections();
var zRange = currentSection.getGlobalZRange();
var number = tool.number;
for (var i = currentSection.getId() + 1; i < numberOfSections; ++i) {
var section = getSection(i);
if (section.getTool().number != number) {
break;
}
zRange.expandToRange(section.getGlobalZRange());
}
writeComment(localize("ZMIN") + "=" + zRange.getMinimum());
}
}
if (properties.preloadTool && properties.useM6) {
var nextTool = getNextTool(tool.number);
if (nextTool) {
writeBlock("T" + toolFormat.format(nextTool.number));
} else {
// preload first tool
var section = getSection(0);
var firstToolNumber = section.getTool().number;
if (tool.number != firstToolNumber) {
writeBlock("T" + toolFormat.format(firstToolNumber));
}
}
}
}
if (insertToolCall ||
isFirstSection() ||
(rpmFormat.areDifferent(tool.spindleRPM, sOutput.getCurrent())) ||
(tool.clockwise != getPreviousSection().getTool().clockwise)) {
if (tool.spindleRPM < 1) {
error(localize("Spindle speed out of range."));
return;
}
if (tool.spindleRPM > 99999) {
warning(localize("Spindle speed exceeds maximum value."));
}
writeBlock(
sOutput.format(tool.spindleRPM), mFormat.format(tool.clockwise ? 3 : 4)
);
}
// wcs
if (insertToolCall) { // force work offset when changing tool
currentWorkOffset = undefined;
}
var workOffset = currentSection.workOffset;
if (workOffset == 0) {
warningOnce(localize("Work offset has not been specified. Using G54 as WCS."), WARNING_WORK_OFFSET);
workOffset = 1;
}
if (workOffset > 0) {
if (workOffset > 6) {
var p = workOffset; // 1->... // G59 P1 is the same as G54 and so on
if (p > 254) {
error(localize("Work offset out of range."));
} else {
if (workOffset != currentWorkOffset) {
writeBlock(gFormat.format(59), "P" + p); // G59 P
currentWorkOffset = workOffset;
}
}
} else {
if (workOffset != currentWorkOffset) {
writeBlock(gFormat.format(53 + workOffset)); // G54->G59
currentWorkOffset = workOffset;
}
}
}
forceXYZ();
if (machineConfiguration.isMultiAxisConfiguration()) { // use 5-axis indexing for multi-axis mode
// set working plane after datum shift
var abc = new Vector(0, 0, 0);
if (currentSection.isMultiAxis()) {
forceWorkPlane();
cancelTransformation();
} else {
abc = getWorkPlaneMachineABC(currentSection.workPlane);
}
setWorkPlane(abc);
} else { // pure 3D
var remaining = currentSection.workPlane;
if (!isSameDirection(remaining.forward, new Vector(0, 0, 1))) {
error(localize("Tool orientation is not supported."));
return;
}
setRotation(remaining);
}
// set coolant after we have positioned at Z
{
var c = mapCoolantTable.lookup(tool.coolant);
if (c) {
writeBlock(mFormat.format(c));
} else {
warning(localize("Coolant not supported."));
}
}
forceAny();
gMotionModal.reset();
var initialPosition = getFramePosition(currentSection.getInitialPosition());
if (!retracted) {
if (getCurrentPosition().z < initialPosition.z) {
writeBlock(gMotionModal.format(0), zOutput.format(initialPosition.z));
}
}
if (insertToolCall || retracted) {
var lengthOffset = tool.lengthOffset;
if (lengthOffset > 256) {
error(localize("Length offset out of range."));
return;
}
gMotionModal.reset();
writeBlock(gPlaneModal.format(17));
if (!machineConfiguration.isHeadConfiguration()) {
writeBlock(
gAbsIncModal.format(90),
gMotionModal.format(0), xOutput.format(initialPosition.x), yOutput.format(initialPosition.y)
);
writeBlock(gMotionModal.format(0), gFormat.format(43), zOutput.format(initialPosition.z), hFormat.format(lengthOffset));
writeBlockSkip(mFormat.format(0), "(CHECK-TOOL)");// FRANCO 1-22-17
gMotionModal.reset(); // FRANCO 2/7/17
} else {
writeBlock(
gAbsIncModal.format(90),
gMotionModal.format(0),
gFormat.format(43), xOutput.format(initialPosition.x),
yOutput.format(initialPosition.y),
zOutput.format(initialPosition.z), hFormat.format(lengthOffset)
);
}
} else {
writeBlock(
gAbsIncModal.format(90),
gMotionModal.format(0),
xOutput.format(initialPosition.x),
yOutput.format(initialPosition.y)
);
}
}
function onDwell(seconds) {
if (seconds > 99999.999) {
warning(localize("Dwelling time is out of range."));
}
if (properties.dwellInSeconds) {
writeBlock(gFormat.format(4), "P" + secFormat.format(seconds));
} else {
milliseconds = clamp(1, seconds * 1000, 99999999);
writeBlock(gFormat.format(4), "P" + milliFormat.format(milliseconds));
}
}
function onSpindleSpeed(spindleSpeed) {
writeBlock(sOutput.format(spindleSpeed));
}
function onCycle() {
writeBlock(gPlaneModal.format(17));
}
function getCommonCycle(x, y, z, r) {
forceXYZ();
return [xOutput.format(x), yOutput.format(y),
zOutput.format(z),
"R" + xyzFormat.format(r)];
}