Hoe om te gaan met Z0 en de tool-lengtes

Hier alle merken gekochte machine`s waar vragen over zijn of wat je met ons wilt delen.

Moderator: Moderators

Plaats reactie
Gebruikersavatar
Kars-cnc
Donateur
Berichten: 1967
Lid geworden op: 07 okt 2015 05:33
Locatie: Heerde (Gelderland)

Hoe om te gaan met Z0 en de tool-lengtes

Bericht door Kars-cnc »

Ik heb bij mijn machine een vaste tool-lengte sensor en een 3D probe waarmee ik de werkstuk hoogte kan opmeten. Ik ging hier altijd wat houtje-touwtje mee om. Best vaak bepaalde ik Z0 nog gewoon door de aanwezige frees te nullen op het werkstuk.

Als een project meerdere tools heeft, gebruik ik een macro waarmee ik de lengte van de "ge-nulde" tool op meet met de tool-lengte sensor om te verrekenen met een volgende tool. Ik gebruik G43 niet, een en ander wordt in de macro's verrekend.

Ook heb ik macro's om met de 3D probe de werkstuk hoogte op te meten en dat op te slaan zodat dat voor elke tool verrekend kan worden.

Beide manieren werken, maar bij toolwissels heb toch altijd het onbehaagelijke gevoel dat e.e.a. lelijk mis kan gaan (hoe zou dat nou toch komen 8) ). Die angst wordt nog versterkt doordat ik in Eding nog al eens heb dat tijdens een toolwissel de software de draad kwijt raakt en ik de eerder opgeslagen waardes al helemaal niet meer vertrouw...

Ik heb tegenwoordig een nieuwe spindel met een (A)TC waarmee ik de tools gemakkelijker handmatig kan wisselen. Ik wil van de gelegenheid gebruik maken om de macro's voor het tool-lengte gebeuren op de schop te nemen. Hebben jullie wat adviezen en/of ervaringen hoe ik dit het beste kan aanpakken?
Gebruikersavatar
Ballegooijen
Donateur
Berichten: 5218
Lid geworden op: 20 sep 2016 15:45
Locatie: 's-Gravendeel
Contacteer:

Re: Hoe om te gaan met Z0 en de tool-lengtes

Bericht door Ballegooijen »

Ik maak ook gebruik van een vaste toollengte meter. Ik heb een spindel met een ATC maar wissel de tools handmatig. Als ik een tool heb gewisseld en weer op start druk opent er een dialoog waar ik het toolnummer en de ongeveer lengte invoer. Als ik dan weer op start druk dan gaat de spindel naar de locatie van de toolsetter, hij meet de lengte, slaat die op in de tooldatabase en begint met de verwerking.
Iemand heeft deze macro ooit voor mij gemaakt en ik heb er al vele jaren heel veel plezier van.

PS. Ik zit nog even terug te zoeken maar zie nu dat de toollengte meting wordt aangestuurd door de PP. Deze PP is geschreven voor Fusion360
Iedere wijze uil is ooit een uilskuiken geweest!
https://www.Baldas.nl
Gebruikersavatar
Kars-cnc
Donateur
Berichten: 1967
Lid geworden op: 07 okt 2015 05:33
Locatie: Heerde (Gelderland)

Re: Hoe om te gaan met Z0 en de tool-lengtes

Bericht door Kars-cnc »

Ballegooijen schreef: 25 okt 2025 11:29 PS. Ik zit nog even terug te zoeken maar zie nu dat de toollengte meting wordt aangestuurd door de PP. Deze PP is geschreven voor Fusion360
Ik wist niet dat dat kon. Ik gebruik ook Fusion360, dus daar moet ik dan nog eens studie van maken hoe dat werkt.

Verschijnt die dialoog ook al als je begint met de eerste tool? En hoe heb je voordat je begint het nulpunt bepaald?
Gebruikersavatar
Ballegooijen
Donateur
Berichten: 5218
Lid geworden op: 20 sep 2016 15:45
Locatie: 's-Gravendeel
Contacteer:

Re: Hoe om te gaan met Z0 en de tool-lengtes

Bericht door Ballegooijen »

Kars-cnc schreef: 25 okt 2025 13:30
Ballegooijen schreef: 25 okt 2025 11:29 PS. Ik zit nog even terug te zoeken maar zie nu dat de toollengte meting wordt aangestuurd door de PP. Deze PP is geschreven voor Fusion360
Ik wist niet dat dat kon. Ik gebruik ook Fusion360, dus daar moet ik dan nog eens studie van maken hoe dat werkt.

Verschijnt die dialoog ook al als je begint met de eerste tool? En hoe heb je voordat je begint het nulpunt bepaald?
Ik heb Z 0 meestal op het bed staan. Ik hoef dat dus maar zelden te wijzigen. Als ik toch een keer de bovenkant van het werkstuk wil nullen dan doe ik dat "ouderwets" met een papiertje, of als het heel nauwkeurig moet met een losse digitale toolsetter.
(https://nl.aliexpress.com/item/10050084 ... W4QAvD_BwE)
Verschijnt die dialoog ook al als je begint met de eerste tool?
Ja, ook bij de eerste tool verschijnt de dialoog.

Met deze PP zou het moeten werken:

Code: Selecteer alles

/**
  Copyright (C) 2012-2017 by Autodesk, Inc.
  All rights reserved.

  Eding CNC/USBCNC post processor configuration.

  $Revision: 42115 bdeb2e221ae970b5318768fc88f8111865513bf5 $
  $Date: 2018-09-06 14:16:13 $
  
  FORKID {F1515682-04F5-42E5-975B-BF5FCB39AEDC}
*/

description = "Eding CNC/USBCNC";
vendor = "Eding CNC";
vendorUrl = "http://www.edingcnc.com";
legal = "Copyright (C) 2012-2017 by Autodesk, Inc.";
certificationLevel = 2;
minimumRevision = 40783;

longDescription = "Generic milling post for Eding CNC/USBCNC.";

extension = "cnc";
setCodePage("ascii");

capabilities = CAPABILITY_MILLING;
tolerance = spatial(0.002, MM);

minimumChordLength = spatial(0.25, MM);
minimumCircularRadius = spatial(0.01, MM);
maximumCircularRadius = spatial(1000, MM);
minimumCircularSweep = toRad(0.01);
maximumCircularSweep = toRad(180);
allowHelicalMoves = true;
allowedCircularPlanes = undefined; // allow any circular motion



// user-defined properties
properties = {
  FreesLengteMeting: true, // (carlo) automatisch opmeten van de freeslengte
  writeMachine: true, // write machine
  writeTools: true, // writes the tools
  preloadTool: true, // preloads next tool on tool change if any
  showSequenceNumbers: false, // show sequence numbers (carlo) veranderd naar false omdat het anders fout geeft in de controller            
  sequenceNumberStart: 10, // first sequence number
  sequenceNumberIncrement: 5, // increment for sequence numbers
  optionalStop: true, // optional stop
  separateWordsWithSpace: true, // specifies that the words should be separated with a white space
  useRadius: false, // specifies that arcs should be output using the radius (R word) instead of the I, J, and K words.
  showNotes: false, // specifies that operation notes should be output.
  smoothingTolerance: 0 // smoothing tolerance (0 for disabled)
};

// user-defined property definitions
propertyDefinitions = {
  writeMachine: {title:"Write machine", description:"Output the machine settings in the header of the code.", group:0, type:"boolean"},
  writeTools: {title:"Write tool list", description:"Output a tool list in the header of the code.", group:0, type:"boolean"},
  preloadTool: {title:"Preload tool", description:"Preloads the next tool at a tool change (if any).", group:1, type:"boolean"},
  showSequenceNumbers: {title:"Use sequence numbers", description:"Use sequence numbers for each block of outputted code.", group:1, type:"boolean"},
  sequenceNumberStart: {title:"Start sequence number", description:"The number at which to start the sequence numbers.", group:1, type:"integer"},
  sequenceNumberIncrement: {title:"Sequence number increment", description:"The amount by which the sequence number is incremented by in each block.", group:1, type:"integer"},
  optionalStop: {title:"Optional stop", description:"Outputs optional stop code during when necessary in the code.", type:"boolean"},
  separateWordsWithSpace: {title:"Separate words with space", description:"Adds spaces between words if 'yes' is selected.", type:"boolean"},
  useRadius: {title:"Radius arcs", description:"If yes is selected, arcs are outputted using radius values rather than IJK.", type:"boolean"},
  showNotes: {title:"Show notes", description:"Writes operation notes as comments in the outputted code.", type:"boolean"},
  smoothingTolerance: {title:"Smoothing tolerance", description:"Smoothing tolerance (-1 for disabled).", type:"number"}
};

// samples:
// throughTool: {on: 88, off: 89}
// throughTool: {on: [8, 88], off: [9, 89]}
var coolants = {
  flood: {on: 8},
  mist: {on: 7},
  throughTool: {on: 7, off: 9},
  air: {on: 7},
  airThroughTool: {},
  suction: {},
  floodMist: {},
  floodThroughTool: {},
  off: 9
};

var numberOfToolSlots = 9999;

var gFormat = createFormat({prefix:"G", decimals:0});
var mFormat = createFormat({prefix:"M", decimals:0});
var hFormat = createFormat({prefix:"H", decimals:0});
var dFormat = createFormat({prefix:"D", decimals:0});

var xyzFormat = createFormat({decimals:(unit == MM ? 3 : 4)});
var abcFormat = createFormat({decimals:3, forceDecimal:true, scale:DEG});
var feedFormat = createFormat({decimals:(unit == MM ? 1 : 2)});
var toolFormat = createFormat({decimals:0});
var rpmFormat = createFormat({decimals:0});
var secFormat = createFormat({decimals:3, forceDecimal:true}); // seconds - range 0.001-1000
var taperFormat = createFormat({decimals:1, scale:DEG});

var xOutput = createVariable({prefix:"X"}, xyzFormat);
var yOutput = createVariable({prefix:"Y"}, xyzFormat);
var zOutput = createVariable({onchange: function() {retracted = false;}, prefix:"Z"}, xyzFormat);
var aOutput = createVariable({prefix:"A"}, abcFormat);
var bOutput = createVariable({prefix:"B"}, abcFormat);
var cOutput = createVariable({prefix:"C"}, abcFormat);
var feedOutput = createVariable({prefix:"F"}, feedFormat);
var sOutput = createVariable({prefix:"S", force:true}, rpmFormat);
var dOutput = createVariable({}, dFormat);

// circular output
var iOutput = createReferenceVariable({prefix:"I"}, xyzFormat);
var jOutput = createReferenceVariable({prefix:"J"}, xyzFormat);
var kOutput = createReferenceVariable({prefix:"K"}, xyzFormat);

var gMotionModal = createModal({}, gFormat); // modal group 1 // G0-G3, ...
var gPlaneModal = createModal({onchange:function () {gMotionModal.reset();}}, gFormat); // modal group 2 // G17-19
var gAbsIncModal = createModal({}, gFormat); // modal group 3 // G90-91
var gFeedModeModal = createModal({}, gFormat); // modal group 5 // G93-94
var gUnitModal = createModal({}, gFormat); // modal group 6 // G20-21
var gCycleModal = createModal({}, gFormat); // modal group 9 // G81, ...
var gRetractModal = createModal({force:true}, gFormat); // modal group 10 // G98-99

var WARNING_WORK_OFFSET = 0;

// collected state
var sequenceNumber;
var currentWorkOffset;
var g64Active = false;
var retracted = false; // specifies that the tool has been retracted to the safe plane

/**
  Writes the specified block.
*/
function writeBlock() {
  var text = formatWords(arguments);
  if (!text) {
    return;
  }
  if (properties.showSequenceNumbers) {
    writeWords2("N" + sequenceNumber, arguments);
    sequenceNumber += properties.sequenceNumberIncrement;
  } else {
    writeWords(arguments);
  }
}

function formatComment(text) {
  return "(" + String(text).replace(/[()]/g, "") + ")";
}

/**
  Output a comment.
*/
function writeComment(text) {
  writeln(formatComment(text));
}

function onOpen() {
  if (properties.useRadius) {
    maximumCircularSweep = toRad(90); // avoid potential center calculation errors for CNC
  }

  if (false) { // note: setup your machine here
    var aAxis = createAxis({coordinate:0, table:true, axis:[1, 0, 0], range:[-0.0001, 90.0001], preference:0});
    var cAxis = createAxis({coordinate:2, table:true, axis:[0, 0, 1], range:[-360, 360], preference:0, cyclic:true});
    machineConfiguration = new MachineConfiguration(aAxis, cAxis);

    setMachineConfiguration(machineConfiguration);
    optimizeMachineAngles2(1); // TCP mode
  }
  
  if (!machineConfiguration.isMachineCoordinate(0)) {
    aOutput.disable();
  }
  if (!machineConfiguration.isMachineCoordinate(1)) {
    bOutput.disable();
  }
  if (!machineConfiguration.isMachineCoordinate(2)) {
    cOutput.disable();
  }
  
  if (!properties.separateWordsWithSpace) {
    setWordSeparator("");
  }

  sequenceNumber = properties.sequenceNumberStart;
  writeln("%");

  if (programName) {
    writeComment(programName);
  }
  if (programComment) {
    writeComment(programComment);
  }

  // dump machine configuration
  var vendor = machineConfiguration.getVendor();
  var model = machineConfiguration.getModel();
  var description = machineConfiguration.getDescription();

  if (properties.writeMachine && (vendor || model || description)) {
    writeComment(localize("Machine"));
    if (vendor) {
      writeComment("  " + localize("vendor") + ": " + vendor);
    }
    if (model) {
      writeComment("  " + localize("model") + ": " + model);
    }
    if (description) {
      writeComment("  " + localize("description") + ": "  + description);
    }
  }

  // dump tool information
  if (properties.writeTools) {
    var zRanges = {};
    if (is3D()) {
      var numberOfSections = getNumberOfSections();
      for (var i = 0; i < numberOfSections; ++i) {
        var section = getSection(i);
        var zRange = section.getGlobalZRange();
        var tool = section.getTool();
        if (zRanges[tool.number]) {
          zRanges[tool.number].expandToRange(zRange);
        } else {
          zRanges[tool.number] = zRange;
        }
      }
    }

    var tools = getToolTable();
    if (tools.getNumberOfTools() > 0) {
      for (var i = 0; i < tools.getNumberOfTools(); ++i) {
        var tool = tools.getTool(i);
        var comment = "T" + toolFormat.format(tool.number) + " " +
          "D=" + xyzFormat.format(tool.diameter) + " " +
          localize("CR") + "=" + xyzFormat.format(tool.cornerRadius);
        if ((tool.taperAngle > 0) && (tool.taperAngle < Math.PI)) {
          comment += " " + localize("TAPER") + "=" + taperFormat.format(tool.taperAngle) + localize("deg");
        }
        if (zRanges[tool.number]) {
          comment += " - " + localize("ZMIN") + "=" + xyzFormat.format(zRanges[tool.number].getMinimum());
        }
        comment += " - " + getToolTypeName(tool.type);
        writeComment(comment);
      }
    }
  }

  if ((getNumberOfSections() > 0) && (getSection(0).workOffset == 0)) {
    for (var i = 0; i < getNumberOfSections(); ++i) {
      if (getSection(i).workOffset > 0) {
        error(localize("Using multiple work offsets is not possible if the initial work offset is 0."));
        return;
      }
    }
  }

  // absolute coordinates and feed per min
  writeBlock(gAbsIncModal.format(90), gFeedModeModal.format(94));
  writeBlock(gPlaneModal.format(17));

  switch (unit) {
  case IN:
    writeBlock(gUnitModal.format(20));
    break;
  case MM:
    writeBlock(gUnitModal.format(21));
    break;
  }
}

function onComment(message) {
  writeComment(message);
}

/** Force output of X, Y, and Z. */
function forceXYZ() {
  xOutput.reset();
  yOutput.reset();
  zOutput.reset();
}

/** Force output of A, B, and C. */
function forceABC() {
  aOutput.reset();
  bOutput.reset();
  cOutput.reset();
}

/** Force output of X, Y, Z, A, B, C, and F on next output. */
function forceAny() {
  forceXYZ();
  forceABC();
  feedOutput.reset();
}

var currentWorkPlaneABC = undefined;

function forceWorkPlane() {
  currentWorkPlaneABC = undefined;
}

function setWorkPlane(abc) {
  if (!machineConfiguration.isMultiAxisConfiguration()) {
    return; // ignore
  }

  if (!((currentWorkPlaneABC == undefined) ||
        abcFormat.areDifferent(abc.x, currentWorkPlaneABC.x) ||
        abcFormat.areDifferent(abc.y, currentWorkPlaneABC.y) ||
        abcFormat.areDifferent(abc.z, currentWorkPlaneABC.z))) {
    return; // no change
  }

  onCommand(COMMAND_UNLOCK_MULTI_AXIS);

  if (!retracted) {
    writeRetract(Z);
  }

  writeBlock(
    gMotionModal.format(0),
    conditional(machineConfiguration.isMachineCoordinate(0), "A" + abcFormat.format(abc.x)),
    conditional(machineConfiguration.isMachineCoordinate(1), "B" + abcFormat.format(abc.y)),
    conditional(machineConfiguration.isMachineCoordinate(2), "C" + abcFormat.format(abc.z))
  );
  
  onCommand(COMMAND_LOCK_MULTI_AXIS);

  currentWorkPlaneABC = abc;
}

var closestABC = false; // choose closest machine angles
var currentMachineABC;

function getWorkPlaneMachineABC(workPlane) {
  var W = workPlane; // map to global frame

  var abc = machineConfiguration.getABC(W);
  if (closestABC) {
    if (currentMachineABC) {
      abc = machineConfiguration.remapToABC(abc, currentMachineABC);
    } else {
      abc = machineConfiguration.getPreferredABC(abc);
    }
  } else {
    abc = machineConfiguration.getPreferredABC(abc);
  }
  
  try {
    abc = machineConfiguration.remapABC(abc);
    currentMachineABC = abc;
  } catch (e) {
    error(
      localize("Machine angles not supported") + ":"
      + conditional(machineConfiguration.isMachineCoordinate(0), " A" + abcFormat.format(abc.x))
      + conditional(machineConfiguration.isMachineCoordinate(1), " B" + abcFormat.format(abc.y))
      + conditional(machineConfiguration.isMachineCoordinate(2), " C" + abcFormat.format(abc.z))
    );
  }
  
  var direction = machineConfiguration.getDirection(abc);
  if (!isSameDirection(direction, W.forward)) {
    error(localize("Orientation not supported."));
  }
  
  if (!machineConfiguration.isABCSupported(abc)) {
    error(
      localize("Work plane is not supported") + ":"
      + conditional(machineConfiguration.isMachineCoordinate(0), " A" + abcFormat.format(abc.x))
      + conditional(machineConfiguration.isMachineCoordinate(1), " B" + abcFormat.format(abc.y))
      + conditional(machineConfiguration.isMachineCoordinate(2), " C" + abcFormat.format(abc.z))
    );
  }

  var tcp = false;
  if (tcp) {
    setRotation(W); // TCP mode
  } else {
    var O = machineConfiguration.getOrientation(abc);
    var R = machineConfiguration.getRemainingOrientation(abc, W);
    setRotation(R);
  }
  
  return abc;
}

function isProbeOperation() {
  return hasParameter("operation-strategy") && (getParameter("operation-strategy") == "probe");
}

function onSection() {
  var insertToolCall = isFirstSection() ||
    currentSection.getForceToolChange && currentSection.getForceToolChange() ||
    (tool.number != getPreviousSection().getTool().number);
  
  retracted = false;
  var newWorkOffset = isFirstSection() ||
    (getPreviousSection().workOffset != currentSection.workOffset); // work offset changes
  var newWorkPlane = isFirstSection() ||
    !isSameDirection(getPreviousSection().getGlobalFinalToolAxis(), currentSection.getGlobalInitialToolAxis()) ||
    (currentSection.isOptimizedForMachine() && getPreviousSection().isOptimizedForMachine() &&
      Vector.diff(getPreviousSection().getFinalToolAxisABC(), currentSection.getInitialToolAxisABC()).length > 1e-4) ||
    (!machineConfiguration.isMultiAxisConfiguration() && currentSection.isMultiAxis()) ||
    (!getPreviousSection().isMultiAxis() && currentSection.isMultiAxis() ||
      getPreviousSection().isMultiAxis() && !currentSection.isMultiAxis()); // force newWorkPlane between indexing and simultaneous operations
  if (insertToolCall || newWorkOffset || newWorkPlane) {
    
    // stop spindle before retract during tool change
    if (insertToolCall && !isFirstSection()) {
      onCommand(COMMAND_STOP_SPINDLE);
    }
    if (insertToolCall) {
      setCoolant(COOLANT_OFF);
    }
    // retract to safe plane
    writeRetract(Z);
  }

  writeln("");
  
  if (hasParameter("operation-comment")) {
    var comment = getParameter("operation-comment");
    if (comment) {
      writeComment(comment);
    }
  }
  
  if (properties.showNotes && hasParameter("notes")) {
    var notes = getParameter("notes");
    if (notes) {
      var lines = String(notes).split("\n");
      var r1 = new RegExp("^[\\s]+", "g");
      var r2 = new RegExp("[\\s]+$", "g");
      for (line in lines) {
        var comment = lines[line].replace(r1, "").replace(r2, "");
        if (comment) {
          writeComment(comment);
        }
      }
    }
  }

  if (insertToolCall) {
    forceWorkPlane();
    
    onCommand(COMMAND_COOLANT_OFF);
  
    if (!isFirstSection() && properties.optionalStop) {
      onCommand(COMMAND_OPTIONAL_STOP);
    }

    if (tool.number > numberOfToolSlots) {
      warning(localize("Tool number exceeds maximum value."));
    }

    writeBlock("T" + toolFormat.format(tool.number), mFormat.format(6));
    if (tool.comment) {
      writeComment(tool.comment);
    }
    	// (carlo) automatisch opmeten van tool
    	if (tool.number<(92)){  // tools vanaf nr 92 hebben een grotere diameter dan toolsensor 
		if (properties.FreesLengteMeting){
			writeBlock("gosub m_tool");
		}
		else {
			writeBlock ('DlgMsg "Manueel freeslengte opmeten"'); // voorlopig tools met de hand opmeten
		}	
    }
    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) {
      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(spindleSpeed, sOutput.getCurrent())) ||
      (tool.clockwise != getPreviousSection().getTool().clockwise)) {
    if (spindleSpeed < 1) {
      error(localize("Spindle speed out of range."));
    }
    if (spindleSpeed > 99999) {
      warning(localize("Spindle speed exceeds maximum value."));
    }
    writeBlock(
      sOutput.format(spindleSpeed), 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 code = workOffset - 6;
      if (code > 3) {
        error(localize("Work offset out of range."));
        return;
      }
      if (workOffset != currentWorkOffset) {
        writeBlock(gFormat.format(59) + "." + code);
        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();
      abc = currentSection.getInitialToolAxisABC();
      gMotionModal.reset();
      writeBlock(
        gMotionModal.format(0),
        conditional(machineConfiguration.isMachineCoordinate(0), "A" + abcFormat.format(abc.x)),
        conditional(machineConfiguration.isMachineCoordinate(1), "B" + abcFormat.format(abc.y)),
        conditional(machineConfiguration.isMachineCoordinate(2), "C" + abcFormat.format(abc.z))
      );
    } 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
  setCoolant(tool.coolant);

  forceAny();

  var initialPosition = getFramePosition(currentSection.getInitialPosition());
  if (!retracted && !insertToolCall) {
    if (getCurrentPosition().z < initialPosition.z) {
      writeBlock(gMotionModal.format(0), zOutput.format(initialPosition.z));
    }
  }

  if (insertToolCall || retracted) {
    var lengthOffset = tool.lengthOffset;
    if (lengthOffset > numberOfToolSlots) {
      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));
    } else {
      writeBlock(
        gAbsIncModal.format(90),
        gMotionModal.format(0),
        gFormat.format(43), xOutput.format(initialPosition.x),
        yOutput.format(initialPosition.y),
        zOutput.format(initialPosition.z)
      );
    }
  } else {
    writeBlock(
      gAbsIncModal.format(90),
      gMotionModal.format(0),
      xOutput.format(initialPosition.x),
      yOutput.format(initialPosition.y)
    );
  }

  if (hasParameter("operation-strategy") && (getParameter("operation-strategy") != "drill")) {
    if (properties.smoothingTolerance > 0) {
      if (!g64Active) {
        writeBlock(gFormat.format(64), "P" + xyzFormat.format(properties.smoothingTolerance));
        g64Active = true;
      }
    } else {
      if (g64Active) {
        writeBlock(gFormat.format(61));
        g64Active = false;
      }
    }
  }
}

function onDwell(seconds) {
  if (seconds > 99999.999) {
    warning(localize("Dwelling time is out of range."));
  }
  seconds = clamp(0.001, seconds, 99999.999);
  writeBlock(gFormat.format(4), "P" + secFormat.format(seconds));
}

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)];
}

function onCyclePoint(x, y, z) {
  if (isFirstCyclePoint()) {
    repositionToCycleClearance(cycle, x, y, z);
    
    // return to initial Z which is clearance plane and set absolute mode

    var F = cycle.feedrate;
    var P = !cycle.dwell ? 0 : clamp(0.001, cycle.dwell, 99999.999); // in seconds

    switch (cycleType) {
    case "drilling":
      writeBlock(
        gRetractModal.format(98), gAbsIncModal.format(90), gCycleModal.format(81),
        getCommonCycle(x, y, z, cycle.retract),
        feedOutput.format(F)
      );
      break;
    case "counter-boring":
      if (P > 0) {
        writeBlock(
          gRetractModal.format(98), gAbsIncModal.format(90), gCycleModal.format(82),
          getCommonCycle(x, y, z, cycle.retract),
          "P" + secFormat.format(P), // not optional
          feedOutput.format(F)
        );
      } else {
        writeBlock(
          gRetractModal.format(98), gAbsIncModal.format(90), gCycleModal.format(81),
          getCommonCycle(x, y, z, cycle.retract),
          feedOutput.format(F)
        );
      }
      break;
    case "chip-breaking":
      expandCyclePoint(x, y, z);
      break;
    case "deep-drilling":
      if (P > 0) {
        expandCyclePoint(x, y, z);
      } else {
        writeBlock(
          gRetractModal.format(98), gAbsIncModal.format(90), gCycleModal.format(83),
          getCommonCycle(x, y, z, cycle.retract),
          "Q" + xyzFormat.format(cycle.incrementalDepth),
          feedOutput.format(F)
        );
      }
      break;
    case "tapping":
      if (!F) {
        F = tool.getTappingFeedrate();
      }
      writeBlock(
        gRetractModal.format(98), gAbsIncModal.format(90), gCycleModal.format((tool.type == TOOL_TAP_LEFT_HAND) ? 74 : 84),
        getCommonCycle(x, y, z, cycle.retract),
        feedOutput.format(F)
      );
      break;
    case "left-tapping":
      if (!F) {
        F = tool.getTappingFeedrate();
      }
      writeBlock(
        gRetractModal.format(98), gAbsIncModal.format(90), gCycleModal.format(74),
        getCommonCycle(x, y, z, cycle.retract),
        feedOutput.format(F)
      );
      break;
    case "right-tapping":
      if (!F) {
        F = tool.getTappingFeedrate();
      }
      writeBlock(
        gRetractModal.format(98), gAbsIncModal.format(90), gCycleModal.format(84),
        getCommonCycle(x, y, z, cycle.retract),
        feedOutput.format(F)
      );
      break;
    case "fine-boring": // not supported
      expandCyclePoint(x, y, z);
      break;
    case "back-boring":
      if (P > 0) {
        expandCyclePoint(x, y, z);
      } else {
        var I = cycle.shift * 1;
        var J = cycle.shift * 0;
        writeBlock(
          gRetractModal.format(98), gAbsIncModal.format(90), gCycleModal.format(87),
          getCommonCycle(x, y, z, cycle.retract),
          "I" + xyzFormat.format(I),
          "J" + xyzFormat.format(J),
          "K" + xyzFormat.format(cycle.bottom - cycle.backBoreDistance),
          feedOutput.format(F)
        );
      }
      break;
    case "reaming":
      writeBlock(
        gRetractModal.format(98), gAbsIncModal.format(90), gCycleModal.format(85),
        getCommonCycle(x, y, z, cycle.retract),
        feedOutput.format(F)
      );
      break;
    case "stop-boring":
      writeBlock(
        gRetractModal.format(98), gAbsIncModal.format(90), gCycleModal.format(86),
        getCommonCycle(x, y, z, cycle.retract),
        feedOutput.format(F),
        // conditional(P > 0, "P" + secFormat.format(P)),
        "P" + secFormat.format(P) // not optional
      );
      break;
    case "manual-boring":
      writeBlock(
        gRetractModal.format(98), gAbsIncModal.format(90), gCycleModal.format(88),
        getCommonCycle(x, y, z, cycle.retract),
        "P" + secFormat.format(P), // not optional
        feedOutput.format(F)
      );
      break;
    case "boring":
      if (P > 0) {
        writeBlock(
          gRetractModal.format(98), gAbsIncModal.format(90), gCycleModal.format(89),
          getCommonCycle(x, y, z, cycle.retract),
          "P" + secFormat.format(P), // not optional
          feedOutput.format(F)
        );
      } else {
        writeBlock(
          gRetractModal.format(98), gAbsIncModal.format(90), gCycleModal.format(85),
          getCommonCycle(x, y, z, cycle.retract),
          feedOutput.format(F)
        );
      }
      break;
    default:
      expandCyclePoint(x, y, z);
    }
  } else {
    if (cycleExpanded) {
      expandCyclePoint(x, y, z);
    } else {
      var _x = xOutput.format(x);
      var _y = yOutput.format(y);
      if (!_x && !_y) {
        xOutput.reset(); // at least one axis is required
        _x = xOutput.format(x);
      }
      writeBlock(_x, _y);
    }
  }
}

function onCycleEnd() {
  if (!cycleExpanded) {
    writeBlock(gCycleModal.format(80));
    zOutput.reset();
    gMotionModal.reset();
  }
}

var pendingRadiusCompensation = -1;

function onRadiusCompensation() {
  pendingRadiusCompensation = radiusCompensation;
}

function onRapid(_x, _y, _z) {
  var x = xOutput.format(_x);
  var y = yOutput.format(_y);
  var z = zOutput.format(_z);
  if (x || y || z) {
    if (pendingRadiusCompensation >= 0) {
      error(localize("Radius compensation mode cannot be changed at rapid traversal."));
      return;
    }
    writeBlock(gMotionModal.format(0), x, y, z);
    feedOutput.reset();
  }
}

function onLinear(_x, _y, _z, feed) {
  // at least one axis is required
  if (pendingRadiusCompensation >= 0) {
    // ensure that we end at desired position when compensation is turned off
    xOutput.reset();
    yOutput.reset();
  }
  var x = xOutput.format(_x);
  var y = yOutput.format(_y);
  var z = zOutput.format(_z);
  var f = feedOutput.format(feed);
  if (x || y || z) {
    if (pendingRadiusCompensation >= 0) {
      pendingRadiusCompensation = -1;
      var d = tool.diameterOffset;
      if (d > numberOfToolSlots) {
        warning(localize("The diameter offset exceeds the maximum value."));
      }
      writeBlock(gPlaneModal.format(17));
      switch (radiusCompensation) {
      case RADIUS_COMPENSATION_LEFT:
        dOutput.reset();
        writeBlock(gMotionModal.format(1), x, y, z, f);
        writeBlock(gFormat.format(41), dOutput.format(d));
        break;
      case RADIUS_COMPENSATION_RIGHT:
        dOutput.reset();
        writeBlock(gMotionModal.format(1), x, y, z, f);
        writeBlock(gFormat.format(42), dOutput.format(d));
        break;
      default:
        writeBlock(gMotionModal.format(1), gFormat.format(40), x, y, z, f);
      }
    } else {
      writeBlock(gMotionModal.format(1), x, y, z, f);
    }
  } else if (f) {
    if (getNextRecord().isMotion()) { // try not to output feed without motion
      feedOutput.reset(); // force feed on next line
    } else {
      writeBlock(gMotionModal.format(1), f);
    }
  }
}

function onRapid5D(_x, _y, _z, _a, _b, _c) {
  if (!currentSection.isOptimizedForMachine()) {
    error(localize("This post configuration has not been customized for 5-axis simultaneous toolpath."));
    return;
  }
  if (pendingRadiusCompensation >= 0) {
    error(localize("Radius compensation mode cannot be changed at rapid traversal."));
    return;
  }
  var x = xOutput.format(_x);
  var y = yOutput.format(_y);
  var z = zOutput.format(_z);
  var a = aOutput.format(_a);
  var b = bOutput.format(_b);
  var c = cOutput.format(_c);
  writeBlock(gMotionModal.format(0), x, y, z, a, b, c);
  feedOutput.reset();
}

function onLinear5D(_x, _y, _z, _a, _b, _c, feed) {
  if (!currentSection.isOptimizedForMachine()) {
    error(localize("This post configuration has not been customized for 5-axis simultaneous toolpath."));
    return;
  }
  // at least one axis is required
  if (pendingRadiusCompensation >= 0) {
    error(localize("Radius compensation cannot be activated/deactivated for 5-axis move."));
    return;
  }
  var x = xOutput.format(_x);
  var y = yOutput.format(_y);
  var z = zOutput.format(_z);
  var a = aOutput.format(_a);
  var b = bOutput.format(_b);
  var c = cOutput.format(_c);
  var f = feedOutput.format(feed);
  if (x || y || z || a || b || c) {
    writeBlock(gMotionModal.format(1), x, y, z, a, b, c, f);
  } else if (f) {
    if (getNextRecord().isMotion()) { // try not to output feed without motion
      feedOutput.reset(); // force feed on next line
    } else {
      writeBlock(gMotionModal.format(1), f);
    }
  }
}

function onCircular(clockwise, cx, cy, cz, x, y, z, feed) {
  // one of X/Y and I/J are required and likewise
  
  if (pendingRadiusCompensation >= 0) {
    error(localize("Radius compensation cannot be activated/deactivated for a circular move."));
    return;
  }

  var start = getCurrentPosition();

  if (isFullCircle()) {
    if (properties.useRadius) { // radius mode does not support full arcs
      linearize(tolerance);
      return;
    }
    if (isHelical()) {
      linearize(tolerance);
      return;
    }
    // TAG: are 360deg arcs supported
    switch (getCircularPlane()) {
    case PLANE_XY:
      writeBlock(gPlaneModal.format(17), gMotionModal.format(clockwise ? 2 : 3), xOutput.format(x), iOutput.format(cx - start.x, 0), jOutput.format(cy - start.y, 0), feedOutput.format(feed));
      break;
    case PLANE_ZX:
      writeBlock(gPlaneModal.format(18), gMotionModal.format(clockwise ? 2 : 3), zOutput.format(z), iOutput.format(cx - start.x, 0), kOutput.format(cz - start.z, 0), feedOutput.format(feed));
      break;
    case PLANE_YZ:
      writeBlock(gPlaneModal.format(19), gMotionModal.format(clockwise ? 2 : 3), yOutput.format(y), jOutput.format(cy - start.y, 0), kOutput.format(cz - start.z, 0), feedOutput.format(feed));
      break;
    default:
      linearize(tolerance);
    }
  } else if (!properties.useRadius) {
    switch (getCircularPlane()) {
    case PLANE_XY:
      writeBlock(gPlaneModal.format(17), gMotionModal.format(clockwise ? 2 : 3), xOutput.format(x), yOutput.format(y), zOutput.format(z), iOutput.format(cx - start.x, 0), jOutput.format(cy - start.y, 0), feedOutput.format(feed));
      break;
    case PLANE_ZX:
      writeBlock(gPlaneModal.format(18), gMotionModal.format(clockwise ? 2 : 3), xOutput.format(x), yOutput.format(y), zOutput.format(z), iOutput.format(cx - start.x, 0), kOutput.format(cz - start.z, 0), feedOutput.format(feed));
      break;
    case PLANE_YZ:
      writeBlock(gPlaneModal.format(19), gMotionModal.format(clockwise ? 2 : 3), xOutput.format(x), yOutput.format(y), zOutput.format(z), jOutput.format(cy - start.y, 0), kOutput.format(cz - start.z, 0), feedOutput.format(feed));
      break;
    default:
      linearize(tolerance);
    }
  } else { // use radius mode
    var r = getCircularRadius();
    if (toDeg(getCircularSweep()) > (180 + 1e-9)) {
      r = -r; // allow up to <360 deg arcs
    }
    switch (getCircularPlane()) {
    case PLANE_XY:
      writeBlock(gPlaneModal.format(17), gMotionModal.format(clockwise ? 2 : 3), xOutput.format(x), yOutput.format(y), zOutput.format(z), "R" + rFormat.format(r), feedOutput.format(feed));
      break;
    case PLANE_ZX:
      writeBlock(gPlaneModal.format(18), gMotionModal.format(clockwise ? 2 : 3), xOutput.format(x), yOutput.format(y), zOutput.format(z), "R" + rFormat.format(r), feedOutput.format(feed));
      break;
    case PLANE_YZ:
      writeBlock(gPlaneModal.format(19), gMotionModal.format(clockwise ? 2 : 3), xOutput.format(x), yOutput.format(y), zOutput.format(z), "R" + rFormat.format(r), feedOutput.format(feed));
      break;
    default:
      linearize(tolerance);
    }
  }
}

var currentCoolantMode = undefined;
var coolantOff = undefined;

function setCoolant(coolant) {
  var coolantCodes = getCoolantCodes(coolant);
  if (Array.isArray(coolantCodes)) {
    for (var c in coolantCodes) {
      writeBlock(coolantCodes[c]);
    }
    return undefined;
  }
  return coolantCodes;
}

function getCoolantCodes(coolant) {
  if (!coolants) {
    error(localize("Coolants have not been defined."));
  }
  if (!coolantOff) { // use the default coolant off command when an 'off' value is not specified for the previous coolant mode
    coolantOff = coolants.off;
  }

  if (isProbeOperation()) { // avoid coolant output for probing
    coolant = COOLANT_OFF;
  }

  if (coolant == currentCoolantMode) {
    return undefined; // coolant is already active
  }

  var multipleCoolantBlocks = new Array(); // create a formatted array to be passed into the outputted line
  if ((coolant != COOLANT_OFF) && (currentCoolantMode != COOLANT_OFF)) {
    multipleCoolantBlocks.push(mFormat.format(coolantOff));
  }

  var m;
  if (coolant == COOLANT_OFF) {
    m = coolantOff;
    coolantOff = coolants.off;
  }

  switch (coolant) {
  case COOLANT_FLOOD:
    if (!coolants.flood) {
      break;
    }
    m = coolants.flood.on;
    coolantOff = coolants.flood.off;
    break;
  case COOLANT_THROUGH_TOOL:
    if (!coolants.throughTool) {
      break;
    }
    m = coolants.throughTool.on;
    coolantOff = coolants.throughTool.off;
    break;
  case COOLANT_AIR:
    if (!coolants.air) {
      break;
    }
    m = coolants.air.on;
    coolantOff = coolants.air.off;
    break;
  case COOLANT_AIR_THROUGH_TOOL:
    if (!coolants.airThroughTool) {
      break;
    }
    m = coolants.airThroughTool.on;
    coolantOff = coolants.airThroughTool.off;
    break;
  case COOLANT_FLOOD_MIST:
    if (!coolants.floodMist) {
      break;
    }
    m = coolants.floodMist.on;
    coolantOff = coolants.floodMist.off;
    break;
  case COOLANT_MIST:
    if (!coolants.mist) {
      break;
    }
    m = coolants.mist.on;
    coolantOff = coolants.mist.off;
    break;
  case COOLANT_SUCTION:
    if (!coolants.suction) {
      break;
    }
    m = coolants.suction.on;
    coolantOff = coolants.suction.off;
    break;
  case COOLANT_FLOOD_THROUGH_TOOL:
    if (!coolants.floodThroughTool) {
      break;
    }
    m = coolants.floodThroughTool.on;
    coolantOff = coolants.floodThroughTool.off;
    break;
  }
  
  if (!m) {
    onUnsupportedCoolant(coolant);
    m = 9;
  }

  if (m) {
    if (Array.isArray(m)) {
      for (var i in m) {
        multipleCoolantBlocks.push(mFormat.format(m[i]));
      }
    } else {
      multipleCoolantBlocks.push(mFormat.format(m));
    }
    currentCoolantMode = coolant;
    return multipleCoolantBlocks; // return the single formatted coolant value
  }
  return undefined;
}

var mapCommand = {
  COMMAND_STOP:0,
  COMMAND_OPTIONAL_STOP:1,
  COMMAND_END:2,
  COMMAND_SPINDLE_CLOCKWISE:3,
  COMMAND_SPINDLE_COUNTERCLOCKWISE:4,
  COMMAND_STOP_SPINDLE:5,
  COMMAND_ORIENTATE_SPINDLE:19,
  COMMAND_LOAD_TOOL:6
};

function onCommand(command) {
  switch (command) {
  case COMMAND_COOLANT_OFF:
    setCoolant(COOLANT_OFF);
    return;
  case COMMAND_COOLANT_ON:
    setCoolant(COOLANT_FLOOD);
    return;
  case COMMAND_START_SPINDLE:
    onCommand(tool.clockwise ? COMMAND_SPINDLE_CLOCKWISE : COMMAND_SPINDLE_COUNTERCLOCKWISE);
    return;
  case COMMAND_LOCK_MULTI_AXIS:
    return;
  case COMMAND_UNLOCK_MULTI_AXIS:
    return;
  case COMMAND_BREAK_CONTROL:
    return;
  case COMMAND_TOOL_MEASURE:
    return;
  }

  var stringId = getCommandStringId(command);
  var mcode = mapCommand[stringId];
  if (mcode != undefined) {
    writeBlock(mFormat.format(mcode));
  } else {
    onUnsupportedCommand(command);
  }
}

function onSectionEnd() {
  writeBlock(gPlaneModal.format(17));
  forceAny();
  if (g64Active) {
    writeBlock(gFormat.format(61));
    g64Active = false;
  }
}

/** Output block to do safe retract and/or move to home position. */
function writeRetract() {
  if (arguments.length == 0) {
    error(localize("No axis specified for writeRetract()."));
    return;
  }
  var words = []; // store all retracted axes in an array
  for (var i = 0; i < arguments.length; ++i) {
    let instances = 0; // checks for duplicate retract calls
    for (var j = 0; j < arguments.length; ++j) {
      if (arguments[i] == arguments[j]) {
        ++instances;
      }
    }
    if (instances > 1) { // error if there are multiple retract calls for the same axis
      error(localize("Cannot retract the same axis twice in one line"));
      return;
    }
    switch (arguments[i]) {
    case X:
      words.push("X" + xyzFormat.format(machineConfiguration.hasHomePositionX() ? machineConfiguration.getHomePositionX() : 0));
      break;
    case Y:
      words.push("Y" + xyzFormat.format(machineConfiguration.hasHomePositionY() ? machineConfiguration.getHomePositionY() : 0));
      break;
    case Z:
      writeBlock(gFormat.format(28)); // retract
      writeBlock(gAbsIncModal.format(90));
      retracted = true; // specifies that the tool has been retracted to the safe plane
      zOutput.reset();
      break;
    default:
      error(localize("Bad axis specified for writeRetract()."));
      return;
    }
  }
  if (words.length > 0) {
    gMotionModal.reset();
    writeBlock(gAbsIncModal.format(90), gFormat.format(53), gMotionModal.format(0), words); // retract
  }
}

function onClose() {
  setCoolant(COOLANT_OFF);

  writeRetract(Z);

  setWorkPlane(new Vector(0, 0, 0)); // reset working plane

  // writeRetract(X, Y);

  onImpliedCommand(COMMAND_END);
  onImpliedCommand(COMMAND_STOP_SPINDLE);
  writeBlock(mFormat.format(30)); // stop program, spindle stop, coolant off
  writeln("%");
}
Iedere wijze uil is ooit een uilskuiken geweest!
https://www.Baldas.nl
Caesar
Berichten: 474
Lid geworden op: 30 sep 2014 13:26

Re: Hoe om te gaan met Z0 en de tool-lengtes

Bericht door Caesar »

Sorotec verkoopt de losse macro waarbij gereedschap ingemetne wordt en waarmee je met je probe automatisch kan (3d) nullen. Normaal gesproken krijg je hem bij hun probe, maar je kunt hem dus los kopen als je ze een email stuurt.

Ikm oest geloof ik 200 euro betalen, ja dat is veel geld, maar zelf schrijven is ook geen pretje. Is een goede macro die makkelijk in te stellen is met hun handleiding. In hun macro zijn ook een hele hoop fout afgevangers/testers (probe aanwezig? onverwachte probe input of geen input, tool aanwezig? Machine gehomed? etc etc)

Ik geloof dat ik het in nog geen 30min aan de praat had. Gereedschap wordt ingemeten na elke toolwissel en weggeschreven naar tabel (of je kunt de vlag op 0 zetten en dan wordt niet gemeten, maar lengte uit tabel gehaald).

De macro is ook zodanig geschreven dat je zelf een ATC routine kan schrijven zodat de wissel via een magazijn automatisch gaat. Dat is uiteraard heel machine specifiek. Echter het toolbeheer/magazijn beheer is al verwerkt in de macro.


Tesamen met automatisch proben heb je eigenlijk alles geautomatiseerd wat je wilt.


Ik had ook altijd schrik dat de tool compensatie niet goed werkt, maar nu vertrouw ik het 100%.
rolandvs
Berichten: 204
Lid geworden op: 17 apr 2014 01:06
Locatie: ravenstein
Contacteer:

Re: Hoe om te gaan met Z0 en de tool-lengtes

Bericht door rolandvs »

Snap eigenlijk niet waar het voor nodig is.
Ja snap het wel maar meet het gereedschap na het vervangen in en set maatvoering van beitel in cnc met diameter. Meet het tussendoor eigenlijk nauwelijks op. Toolcompensatie werkt automatisch.
Heb eigenlijk nooit problemen mee gehad en heb wisselaar voor 10 en kunnen 30 gereedschappen in cnc.
In postprocessor zijn verdere maten ingegeven. ( werkbereik enz. )
Bij het uitgooien van g codes geef ik hoogte van spoilboard aan en draaien.
Je werkt om te leven en je leeft niet om te werken.
Daarom werk ik niet maar heb een hobby!
keesfrees
Berichten: 3580
Lid geworden op: 08 jan 2008 20:25
Locatie: Grönnen

Re: Hoe om te gaan met Z0 en de tool-lengtes

Bericht door keesfrees »

Zo maar een eerder onderwerp er over :
Gebruik Lengte sensor
viewtopic.php?p=115999#p115999
Gebruikersavatar
serum
Berichten: 5900
Lid geworden op: 08 mar 2008 20:37
Locatie: Zwolle
Has thanked: 1 time
Been thanked: 1 time

Re: Hoe om te gaan met Z0 en de tool-lengtes

Bericht door serum »

Dat je vertrouwen in de tooltabel gedaald is heeft naar alle waarschijnlijkheid te maken met het G92 dat Eding standaard gebruikte voor de offsets. Destijds ging alles in G92, (ook de G54/G55 offsets, die daardoor zeer onlogisch werkten). (ging je naar G55 om daar iets te nullen, verliep door de G92 ook meteen de offset in je G54) en de G92 tool offset heeft op mijn machine destijds ook wel eens een werkstuk naar de eeuwige jachtvelden geholpen (en uiteraard net op uur 3 van de laatste finish pass) Heb toen de nodige weesgegroetjes en de blote voetentocht naar een bedevaartsoort moeten doen om weer marginaal krediet op te bouwen.

G10L20zeroing lost dit op.

Iedere besturing heeft wel iets. Op de Syntec heb ik wel eens per ongeluk op 'set z-delta' gedrukt (knop measure tools veranderd van functie als die actief is, als je er dan per ongeluk 2x direct achter elkaar op dezelfde knop drukt, stel je ze z-delta in op een willekeurige z-hoogte zonder dat je het door hebt). (weer het blotevoetenboetepad moeten bewandelen).

Tools meet je vooraf, dat laat je niet door de CAM afhandelen, proben. Dat doe je vanuit de CAM, maar tools inmeten hoeft wat mij betreft niet perse. En voor iedere opdracht een tool meten; je hebt niet voor niets een tool-tabel?

We hadden destijds een Haas machine staan met een 50krpm spindel. Die was nog wel zinnig. (natuurlijk ook niet de allerbeste machine) maar als het echt nauwkeurig moest en de laatste finish pass in een mal met een 0,25r freesje gedaan moest worden was het zaak om dat freesje in te meten op het gewenste toerental bij een spindel die op bedrijfstemperatuur was bij dat toerental, door de warmte verliep de lengte domweg, waardoor de finish pass die op 0 uit moest komen toch te diep eindigde als de spindel warm was.

In mijn huidige werk heb ik dat niet meer nodig. Nooit meer nullen, alleen maar tools inmeten als ze versleten ziin en niet meer aan denken.

Het gaat mis als je handmatig gaat wisselen. Met labeltjes werken en de tools vooraf klaar zetten die je ingemeten hebt en nodig hebt kan nog wel werken, maar het mooiste is een inline array, carousel, robotje of wat dan ook.. Je hebt niet voor niets een ATC en een gereedschaps-tabel.
Gebruikersavatar
Kars-cnc
Donateur
Berichten: 1967
Lid geworden op: 07 okt 2015 05:33
Locatie: Heerde (Gelderland)

Re: Hoe om te gaan met Z0 en de tool-lengtes

Bericht door Kars-cnc »

Ballegooijen schreef: 25 okt 2025 13:55 Met deze PP zou het moeten werken:
Bedankt voor die code. Ik heb het zorgvuldig apart gezet en ga er mee testen zodra ik weer iets in Fusion ontwerp.
serum schreef: 25 okt 2025 20:22 Dat je vertrouwen in de tooltabel gedaald is heeft naar alle waarschijnlijkheid te maken met het G92 dat Eding standaard gebruikte voor de offsets.

G10L20zeroing lost dit op.
Klopt, ik heb G10L20zeroing dan ook aan staan.
Caesar schreef: 25 okt 2025 17:27 Sorotec verkoopt de losse macro waarbij gereedschap ingemetne wordt en waarmee je met je probe automatisch kan (3d) nullen.
Voor mijn 3D probe heb ik macro's die ook echt goed werken. Ik had de 3D-Finder macro's eens gekregen via het ritsel circuit. Dat heb ik gebruikt als inspiratie voor mijn eigen macro's maar ook niet meer dan dat. Het grote probleem met de 3D-Finder macro's vond ik dat ze de variabelen uitstrooien over het hele bereik wat Eding ter beschikking stelt, overal zit wat. Op zich zelf zal het prima werken maar als je andere macro's gaat toevoegen moet je vreselijk uitkijken om geen conflict met 3D-Finder te creëren.

Voor de toollengte bij een wissel heb ik ook zelf macro's geschreven, maar die wil ik dus nu eens goed tegen het licht houden. Deze macro's waren vooral bedoeld voor een handmatig gebeuren. Ik meet dan de lengte van de eerste tool, nul daarmee op het werkstuk of ik gebruikt de 3D probe voor het werkstuk nullen. Met die waardes kan een en ander uitgerekend worden. Als dan een volgende tool aan de beurt is stopt de G-code met de melding dat de volgende tool geplaatst moet worden. Bij een spantang wissel ga ik dan tijdens die stilstand de nieuwe tool plaatsen en opmeten. Daarvoor moet ik joggen, de toolengte macro aanroepen, Nieuwe tool-lengte toepassen, weer joggen en dan verder. In principe werkt dat allemaal, maar er gaat bij mij nog wel eens wat mis. Als ik tijdens die "G-code wachttijd" een dingetje doe wat niet mag van Eding, b.v. op de escape toets drukken, ben ik het haasje :evil: OK dat is dan natuurlijk mijn eigen schuld, maar het blijft irritant...

Met de nieuwe ISO20 adapter moet dat beter kunnen!

Wat ik zo van jullie leer: Ik moet de tools van te voren inmeten en met de tool-tabel (G43) gaan werken.
Wat ik nog even zoek is hoe ik een 3D probe nulling en een tool-tip nulling door elkaar kan gebruiken zonder nieuwe verwarring te Voor mijn 3D probe heb ik macro's die ook echt goed werken. Ik had de 3D-Finder macro's eens gekregen via het ritsel circuit. Dat heb ik gebruikt als inspiratie voor mjn eigen macro's maar ook niet meer dan dat. Het grote probleem met de 3D-Finder macro's vond ik dat ze de variabelen uitstrooien over het hele bereik wat Eding ter beschikking stelt, overal zit wat. Op zich zelf zal het prima werken maar als je andere macro's gaat toevoegen moet je vreselijk uitkijken om geen conflict met 3D-Finder te creeeren.

Voor de toollengte bij een wissel heb ik ook zelf macro's geschreven, maar die wil ik dus nu eens goed tegen het licht houden. Deze macro's waren vooral bedoeld voor een handmatig gebeuren. Ik meet dan de lengte van de eerste tool, nul daarmee op het werkstuk of ik gebruikt de 3D probe voor het werstuk nullen. Met die waardes kan een en ander uitgerekend worden. Als dan een volgende tool aan de beurt is stopt de G-code met de melding dat de volgende tool geplaatst moet worden. Bij een spantang wissel ga ik dan tijdens die stilstand de nieuwe tool plaatsen en opmeten. Daarvoor moet ik joggen, de toolengte macro aanroepen, Nieuwe tool-lengte toepassen, weer joggen en dan verder. In principe werkt dat allemaal, maar er gaat bij mij nog wel eens wat mis. Als ik tijdens die "G-code wachttijd" een dingetje doe wat niet mag van Eding, b.v. op de escape toets drukken, ben ik het haasje :evil: OK dat is dan natuurlijk mijn eigen schuld, maar het blijft irritant...

Met de nieuwe ISO20 adapter moet dat beter kunnen!

Wat ik zo van jullie leer: Ik moet de tools van te voren inmeten en met de tool-tabel (G43) gaan werken.
Wat ik nog even zoek is hoe ik een 3D probe nulling en een tool-tip nulling door elkaar kan gebruiken zonder nieuwe verwarring te creëren.
Gebruikersavatar
Kars-cnc
Donateur
Berichten: 1967
Lid geworden op: 07 okt 2015 05:33
Locatie: Heerde (Gelderland)

Re: Hoe om te gaan met Z0 en de tool-lengtes

Bericht door Kars-cnc »

keesfrees schreef: 25 okt 2025 18:44 Zo maar een eerder onderwerp er over :
Gebruik Lengte sensor
viewtopic.php?p=115999#p115999
Dank voor de link naar dit oude topic! Ik heb het doorgenomen en het begint me aardig te dagen, ik kan gewoon met elke tool nullen op de tooltip, mits G43 actief, het juiste toolnummer geselecteerd is, en de betreffende tool ingemeten is...

Dat G43 aktief wordt vrees ik nog wel weer een dingetje, als je dat vergeet gaat het alsnog gierend mis... Nou ja, meestal heb ik aan 1 keer
"weesgegroetjes en de blote voetentocht naar een bedevaartsoort moeten doen"
wel genoeg :mrgreen:
Gebruikersavatar
P1-Engineering
Donateur
Berichten: 636
Lid geworden op: 27 aug 2019 23:28
Locatie: Haarlem

Re: Hoe om te gaan met Z0 en de tool-lengtes

Bericht door P1-Engineering »

Als je de ATC spindel alleen gebruikt voor handmatig wisselen van de ISO20 houders kan je volgens mij ook de gratis Sorotec macro gebruiken. Daarin kan je ook de G43 functie activeren.

Voor het werkstuknulpunt kan je dan gewoon je de 3D-taster gebruiken en de macro daarvan ook G43 activeren, is een optie binnen de z-hoogte sub.
Wel van belang is dan een goede kalibratie van de 3D-taster lengte maar dat spreekt hopelijk voor zich.

Voor het organiseren heb ik voor mijzelf onderstaand systeem uitgewerkt.
Alles heeft een vast nummer binnen de Fusion bibliotheek en zelfde soort van benamen. Alles komt vanuit een Master Excel bestand waar ook met 1 druk op de knop de labels geprint kunnen worden.
Houders geprint voor de freesjes in een toolhouder

25837

Gesorteerde freesjes

25836

25838

Heb nog een houder voor alle tools die in de ATC zitten waar de clips in opgeborgen kunnen worden.
Toen ik nog handmatig wisselde heb ik een verzamel station geprint waar alle gereedschappen voor het desbetreffende programma op volgorde in geplaatst kunnen worden, scheelt een hoop denk en zoek werk tijdens het frezen.
Gebruikersavatar
Kars-cnc
Donateur
Berichten: 1967
Lid geworden op: 07 okt 2015 05:33
Locatie: Heerde (Gelderland)

Re: Hoe om te gaan met Z0 en de tool-lengtes

Bericht door Kars-cnc »

Whow..., dat is strak georganiseerd! Ik heb voorlopig maar zes ISO20 houders, dus zal veel vaker moeten wisselen per houder. Maar het idee om een verzamel station te maken waar alle gereedschappen voor een programma in volgorde in gezet kunnen worden vind ik wel erg nuttig. Ga ik zeker doen!
Plaats reactie