From 0c2abd4d94d4c48148e49dedc2ee2a0ede4270a0 Mon Sep 17 00:00:00 2001 From: will1742 Date: Thu, 5 Aug 2021 16:56:40 -0400 Subject: [PATCH] Fixed Tool Tolerance, Part Loading --- Haas_Next_Generation/Bechtel VF4.cps | 34 ++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/Haas_Next_Generation/Bechtel VF4.cps b/Haas_Next_Generation/Bechtel VF4.cps index 4685410..30ca0f1 100644 --- a/Haas_Next_Generation/Bechtel VF4.cps +++ b/Haas_Next_Generation/Bechtel VF4.cps @@ -111,6 +111,14 @@ properties = {/* value: "false", scope: "post" },/* + throughSpindle: { + title: "Allow Through Spindle Coolant", + description: "Enables through spindle coolant, if off uses flood", + type: "boolean", + group: 50, + value: true, + scope: "post" + }, useDPMFeeds: { title: "Rotary moves use DPM feeds", description: "Enable to output DPM feeds, disable for Inverse Time feeds with rotary axes moves.", @@ -537,6 +545,10 @@ var secFormat = createFormat({decimals:3, forceDecimal:true}); // seconds - rang var milliFormat = createFormat({decimals:0}); // milliseconds // range 1-9999 var taperFormat = createFormat({decimals:1, scale:DEG}); +var forceX = createFormat({prefix:"X", decimals:4, forceDecimal:true}); +var forceY = createFormat({prefix:"Y", decimals:4, forceDecimal:true}); +var forceZ = createFormat({prefix:"Z", decimals:4, forceDecimal:true}); + var xOutput = createVariable({prefix:"X"}, xyzFormat); var yOutput = createVariable({prefix:"Y"}, xyzFormat); var zOutput = createVariable({onchange: function() {retracted = false;}, prefix:"Z"}, xyzFormat); @@ -914,9 +926,9 @@ function writeToolMeasureBlock(tool, preMeasure) { (tool.bodyLength + tool.holderLength - LENGTH_TOLERANCE).toFixed(2) + "]] THEN #3000 = 1 (Tool length out of tolerance)"); if (probeType == 3) { - writeWords("IF [[#" + (2000 + tool.number) + " GT " + + writeWords("IF [[#" + (2400 + tool.number) + " GT " + (tool.diameter + DIAM_TOLERANCE).toFixed(2) + "] OR [#" + - (2000 + tool.number) + " LT " + + (2400 + tool.number) + " LT " + (tool.diameter - DIAM_TOLERANCE).toFixed(2) + "]] THEN #3000 = 1 (Tool diameter out of tolerance)"); } } @@ -1400,7 +1412,6 @@ function onOpen() { } comment += " - " + getToolTypeName(tool.type); writeComment(tool.description); - //writeComment(comment); if (getProperty("measureToolsAtStart")) { writeBlock("T" + toolFormat.format(tool.number), mFormat.format(6)); //Changes Tool displayMedia("toolLoad" + tool.number + ".jpg"); @@ -2276,11 +2287,14 @@ function onSection() { if (isFirstSection()) { writeln(""); writeComment("STOCK PREP"); - var Stock_X_55 = (stockUpperX - stockLowerX)/2; - writeln(macroFormat.format(100) + "=[[" + (Stock_X_55.toFixed(4) + "-" + macroFormat.format(5241)) + "]*-1.]"); - writeWords("IF [" + macroFormat.format(100) + " GT 0.] THEN " + macroFormat.format(100) + "=0."); - writeWords("IF [" + macroFormat.format(100) + " LT " + (X_TRAVEL_LIMIT*-1) + "." + "] THEN " + macroFormat.format(100) + "=" + (X_TRAVEL_LIMIT*-1) + "."); - writeBlock(gFormat.format(53), "X" + macroFormat.format(100), yOutput.format(0)); + var Stock_X_55 = (stockUpperX + stockLowerX)/2; + // TODO: Tolerance Checks + // writeln(macroFormat.format(100) + "=[" + macroFormat.format(5241) + "+" + xyzFormat.format(Stock_X_55) + "]"); + // writeWords("IF [" + macroFormat.format(100) + " GT 0.] THEN " + macroFormat.format(100) + "=0."); + // writeWords("IF [" + macroFormat.format(100) + " LT " + (X_TRAVEL_LIMIT*-1) + "." + "] THEN " + macroFormat.format(100) + "=" + (X_TRAVEL_LIMIT*-1) + "."); + // writeBlock(gFormat.format(53), "X" + macroFormat.format(100), yOutput.format(0)); + writeBlock(gFormat.format(55), gFormat.format(0), xOutput.format(Stock_X_55)); + writeBlock(gFormat.format(53), gFormat.format(0), yOutput.format(0)); displayMedia("loadStock.jpg"); writeBlock(mFormat.format(0)); } @@ -2296,7 +2310,7 @@ function onSection() { writeComment("Verify WCS"); writeBlock("T" + toolFormat.format(19), mFormat.format(6)); //Changes Tool - writeBlock(gFormat.format(55), gFormat.format(0), xOutput.format(stockMidX), yOutput.format(stockMidY)); + writeBlock(gFormat.format(55), gFormat.format(0), forceX.format(stockMidX), forceY.format(stockMidY)); displayMedia("xyWCSCheck.jpg"); writeBlock(mFormat.format(0), formatComment("Open door")); /* @@ -2481,7 +2495,7 @@ function onSection() { onCommand(COMMAND_STOP_SPINDLE); forceSpindleSpeed = true; } - setCoolant(tool.coolant); + // setCoolant(tool.coolant); } else if ((currentCoolantMode == COOLANT_THROUGH_TOOL) || (currentCoolantMode == COOLANT_AIR_THROUGH_TOOL) || (currentCoolantMode == COOLANT_FLOOD_THROUGH_TOOL)) { onCommand(COMMAND_STOP_SPINDLE); setCoolant(COOLANT_OFF);