Hello Guest it is December 11, 2019, 08:21:12 AM

Author Topic: Continual issue of Z zero being automatcially changed.  (Read 1557 times)

0 Members and 1 Guest are viewing this topic.

Continual issue of Z zero being automatcially changed.
« on: April 27, 2018, 11:40:33 AM »
Hello,

  I'm having a strange issue where my Z will reset itself to be a few inches below what I set it to. It does not do this all the time, but very often. I set my X and Y, then Z. I leave the mill at Z zero and hit run. Due to the post processor I am using, the arbor then moves up and forward expecting a tool change, which i just skip though and then it goes and hovers to what I think is the retract plane I set in fusion 360, usually .6" above the part, until I hit run again and it finally starts cutting. Very often though it does not stop and hover, but somehow it keeps setting the z to be a few inches below the part, and it tries to plunge itself down into the table. I can usually catch it, just very frustrating. I have to stop, reset zero, then it will work usually.

I'm starting to think this might be some sort of conflict with my post processor and how I have the retract and clearance planes set up in Fusion 360. I don't think it's missing steps. Ive tuned my motors well.

Anyone have any ideas? Ive attached my post processor that shows the starting moves it's doing.

Thanks,
Ben
Taig Micro Mill. 1/4-20" lead screw. Powered by 1.25hp router with a 4:1 pulley reduction. Driven by Ethernet SmoothStepper to a Gecko 6540. Nema 23 motors. 3 Axis.
Re: Continual issue of Z zero being automatcially changed.
« Reply #1 on: April 27, 2018, 05:18:56 PM »
Hi,
when this happens what do the DRO's show?

Do they reflect that controlled point is a couple of inches lower than you expected or do they show that they are where you expected
but the controlled poit is lower than it should be?

Craig
My wife left with my best friend...
     and I miss him!
Re: Continual issue of Z zero being automatcially changed.
« Reply #2 on: April 27, 2018, 09:50:53 PM »
Hi,
I see you've posted on this exact same topic before. Did you do what was suggested last time?

http://www.machsupport.com/forum/index.php/topic,36707.0.html

Craig
My wife left with my best friend...
     and I miss him!
Re: Continual issue of Z zero being automatcially changed.
« Reply #3 on: April 27, 2018, 09:59:30 PM »
Hi Craig,  Yes, I did follow the exercising of the Z axis as suggested and it followed the commands perfectly. Also, the DRO will suddenly set itself to be lower than what I set it to be before hitting run. I haven’t been able to document the exact moment it does this, but it’s within the first few moves I described in the above text.

Thanks
Ben
Taig Micro Mill. 1/4-20" lead screw. Powered by 1.25hp router with a 4:1 pulley reduction. Driven by Ethernet SmoothStepper to a Gecko 6540. Nema 23 motors. 3 Axis.
Re: Continual issue of Z zero being automatcially changed.
« Reply #4 on: April 27, 2018, 10:04:31 PM »
Hi,
post the toolchange code. If the DRO is suddenly jumping to another location then the machine cannot be expected to keep up.

Craig
My wife left with my best friend...
     and I miss him!
Re: Continual issue of Z zero being automatcially changed.
« Reply #5 on: April 27, 2018, 11:05:15 PM »
Hi,
a post processor produces Gcode from a CAM program. The post processor has no role in Machs motion other than produce the code that its runs.

You have said that the code has run correctly on a number of occasions, therefore the code must be good and the post processor that produced it must likewise be good.

You describe the DRO suddenly changing. If that were in response to some bad code it would happen on every occasion you ran it. I'm struggling to think of any fault that would
cause an intermittent substantial chnge in a DRO like that. Its not to say it can't happen, I just can't think how. If I'm correct and its not a code or intermittent Mach DRO fault
then the only other cause is either stalling or missing steps.

Craig
My wife left with my best friend...
     and I miss him!
Re: Continual issue of Z zero being automatcially changed.
« Reply #6 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.

Code: [Select]
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)];
}
Taig Micro Mill. 1/4-20" lead screw. Powered by 1.25hp router with a 4:1 pulley reduction. Driven by Ethernet SmoothStepper to a Gecko 6540. Nema 23 motors. 3 Axis.
Re: Continual issue of Z zero being automatcially changed.
« Reply #7 on: April 27, 2018, 11:41:42 PM »
Hi,
is this a post processor? If so IT DOES NOT RUN  when Mach3 runs.

You pass CAM data through the post processor and it produces the Gcode and THAT Gcode is what runs when Mach runs.

Post the Gcode that Mach runs.

Craig
My wife left with my best friend...
     and I miss him!
Re: Continual issue of Z zero being automatcially changed.
« Reply #8 on: April 28, 2018, 12:56:52 AM »
Hi,

Quote
I think I've found the relevant post processor code
But this code is not relevant. If you were to delete it from your PC Mach would run as it normally does....all Mach needs is conforming Gcode.

The Post Processor code you have posted is NOT Gcode. I don't know what language its in but its not VB so Mach couldn't run it anyway.

Please post the Gcode for which the fault occurrs.

Craig
My wife left with my best friend...
     and I miss him!
Re: Continual issue of Z zero being automatcially changed.
« Reply #9 on: April 29, 2018, 09:53:33 AM »
Hi Craig,

   Sorry about that. You are right, this code is from the post processor. I had it in my head that it is what is causing the issue and needs to be changed. Please find the Gcode below.

The error occurs before the final descent to start cutting.  I might start a new run today and try to get it on video.

Code: [Select]
(1001)
( .125 MILL)
(T4  D=0.25 CR=0. - ZMIN=-0.325 - FLAT END MILL)
N1 G90 G94 G91.1 G80 G40 G49 G17 G0
N2 G20
N3 G53 Z-2
N4 G53 Y2

(SINGLE POCKET)
N6 M5
N7 M9
N8 T4 M6
N9 M0 (CHANGE-TOOL)
(14 2 FLUTE ENDMILL)
N10 S5500 M3
N11 G54
N12 M9
N13 G17
N14 G0 X2.0681 Y2.0217
N15 G43 Z0.925 H4
/ N16 M0 (CHECK-TOOL)
N17 G0 Z0.255
N18 G1 Z0.1345 F10.
N19 G3 X2.0687 Y2.0214 Z0.1288 I0.0569 J0.1033
N20 X2.0704 Y2.0205 Z0.1235 I0.0563 J0.1036
N21 X2.0732 Y2.0191 Z0.1186 I0.0546 J0.1046
N22 X2.0769 Y2.0173 Z0.1147 I0.0518 J0.106
N23 X2.0815 Y2.0154 Z0.1117 I0.0481 J0.1077
N24 X2.0866 Y2.0135 Z0.11 I0.0435 J0.1096
« Last Edit: April 29, 2018, 09:57:40 AM by Benjammann »
Taig Micro Mill. 1/4-20" lead screw. Powered by 1.25hp router with a 4:1 pulley reduction. Driven by Ethernet SmoothStepper to a Gecko 6540. Nema 23 motors. 3 Axis.