diff --git a/Haas_Gantry_BIDC/Bechtel SR.cps b/Haas_Gantry_BIDC/Bechtel SR.cps index df73d5b..5c32f4d 100644 --- a/Haas_Gantry_BIDC/Bechtel SR.cps +++ b/Haas_Gantry_BIDC/Bechtel SR.cps @@ -92,6 +92,22 @@ properties = { value: 10, scope: "post" }, + pencilWCSValidation: { + title: "WCS Validation", + description: "WCS validation. By turning this off, you accept responsibility for any resulting crashes.", + group: 99, + type: "boolean", + value: true, + scope: "post" + }, + toolHeightValidation: { + title: "Tool Length Validation", + description: "Length validation. By turning this off, you accept responsibility for any resulting crashes.", + group: 99, + type: "boolean", + value: true, + scope: "post" + }, sequenceNumberIncrement: { title: "Sequence number increment", description: "The amount by which the sequence number is incremented by in each block.", @@ -625,12 +641,16 @@ function BIDCWriteToolMeasureBlock(tool, rotating) { writeBlock(gFormat.format(43), hFormat.format(tool.number), zOutput.format(tool.bodyLength + tool.holderLength)); if (rotating) { writeBlock(gFormat.format(59), gFormat.format(0), xOutput.format(0), yOutput.format(tool.diameter/2)); - writeBlock(sOutput.format(tool.spindleRPM), mFormat.format(!tool.clockwise ? 3 : 4)); + writeBlock(sOutput.format(400), mFormat.format(!tool.clockwise ? 3 : 4)); } else { writeBlock(gFormat.format(59), gFormat.format(0), xOutput.format(0), yOutput.format(0)); } writeBlock(gFormat.format(37), hFormat.format(tool.number), zOutput.format(0), "F10."); writeBlock(gFormat.format(91), gFormat.format(0), zOutput.format(.1), "F100."); + if (rotating) { + writeBlock(sOutput.format(800)); + writeBlock(gFormat.format(4), "P1."); + } writeBlock(gFormat.format(37), hFormat.format(tool.number), zOutput.format(0), "F2."); onCommand(COMMAND_STOP_SPINDLE); writeRetract(Z); @@ -1357,11 +1377,34 @@ function printProbeResults() { } var probeOutputWorkOffset = 1; +var stockTopZ = -1; +var stockUpperX; +var stockLowerX; +var stockUpperY; +var stockLowerY; function onParameter(name, value) { if (name == "probe-output-work-offset") { probeOutputWorkOffset = (value > 0) ? value : 1; } + + // Added 6/15/21 | Gavin Williams | will1742 + // Issue 001 Input and Validation + if (name == "stock-upper-z") { + stockTopZ = value; + } + if (name == "stock-upper-x") { + stockUpperX = value; + } + if (name == "stock-lower-x") { + stockLowerX = value; + } + if (name == "stock-upper-y") { + stockUpperY = value; + } + if (name == "stock-lower-y") { + stockLowerY = value; + } } /** Returns true if the spatial vectors are significantly different. */ @@ -1607,6 +1650,22 @@ function setAbsoluteMode(xyz, abc) { } function onSection() { + + if (isFirstSection() && getProperty("pencilWCSValidation")) { + var stockMidX = (stockUpperX + stockLowerX)/2; + var stockMidY = (stockUpperY + stockLowerY)/2; + writeln(""); + 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)); + writeComment("Is the pencil centered above your stock?"); + writeBlock(mFormat.format(0), formatComment("Open door")); + + writeBlock(gFormat.format(55), gFormat.format(43), hFormat.format(19), zOutput.format(stockTopZ)); + writeComment("Is the pencil touching your stock?"); + writeBlock(mFormat.format(0), formatComment("Open door")); + } var forceToolAndRetract = optionalSection && !currentSection.isOptional(); optionalSection = currentSection.isOptional(); @@ -1942,6 +2001,36 @@ function onSection() { inspectionProcessSectionStart(); } } + + if (getProperty("toolHeightValidation")) { + writeComment("BEGIN VALIDATION SECTION"); + // Added 06/15/21 | Gavin Williams | will1742 + // Verifies tool-stock distance. Post fails if tool fails clearance standards + if (toolDistance < CLEARANCE_HEIGHT) { + throw "Error: Clearance height must be " + CLEARANCE_HEIGHT + " or more inches from stock"; + } + + if (toolDistance == Infinity) { + throw "Error: invalid tool distance. Contact a TA."; + } + var toolDistance = initialPosition.z - stockTopZ; + + // Prompt user to check stock-tool distance + writeComment("Is your tool " + toolDistance.toPrecision(2).toString() + "in from your stock?"); + writeBlock(mFormat.format(0), formatComment("Open door")); + + writeComment("END VALIDATION SECTION"); + + // initialize spindle and engage coolant if heights are correct + if (tool.type != TOOL_PROBE) { + writeBlock(mFormat.format((tool.clockwise ? 3 : 4)), formatComment("Restart spindle")); + } + } + + if (tool.type != TOOL_PROBE) { + setCoolant(tool.coolant); + } + // define subprogram subprogramDefine(initialPosition, abc, retracted, zIsOutput); } diff --git a/Haas_Next_Generation/Bechtel DT.cps b/Haas_Next_Generation/Bechtel DT.cps index 4f0a418..212d5a5 100644 --- a/Haas_Next_Generation/Bechtel DT.cps +++ b/Haas_Next_Generation/Bechtel DT.cps @@ -2288,6 +2288,8 @@ function onSection() { writeBlock(gFormat.format(55), gFormat.format(43), hFormat.format(19), zOutput.format(stockTopZ)); displayMedia("Net Share/Media/zWCSCheck.jpg"); writeBlock(mFormat.format(0), formatComment("Open door")); + writeBlock(mFormat.format(131), formatComment("End Multimedia")); + /* displayMedia("Net Share/Media/checkPrompt.jpg"); gotoRef = takeInput("Is the pencil touching the center of your stock? [Y/N]", ['N', 'Y']); diff --git a/Haas_Next_Generation/Bechtel VF.cps b/Haas_Next_Generation/Bechtel VF.cps index cd90387..1c393fc 100644 --- a/Haas_Next_Generation/Bechtel VF.cps +++ b/Haas_Next_Generation/Bechtel VF.cps @@ -2288,6 +2288,8 @@ function onSection() { writeBlock(gFormat.format(55), gFormat.format(43), hFormat.format(19), zOutput.format(stockTopZ)); displayMedia("Net Share/Media/zWCSCheck.jpg"); writeBlock(mFormat.format(0), formatComment("Open door")); + writeBlock(mFormat.format(131), formatComment("End Multimedia")); + /* displayMedia("Net Share/Media/checkPrompt.jpg"); gotoRef = takeInput("Is the pencil touching the center of your stock? [Y/N]", ['N', 'Y']);