Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit d584dba
Author: Williams, Gavin J <will1742@purdue.edu>
Date:   Thu Sep 16 11:54:12 2021 -0400

    Added Dwell for coolant

commit 72bcd93
Author: pan261 <pan261@purdue.edu>
Date:   Tue Sep 14 13:54:42 2021 -0400

    FIxed tool validation checking in Mills

commit 3ce1950
Author: Williams, Gavin J <will1742@purdue.edu>
Date:   Tue Sep 14 13:42:18 2021 -0400

    Added Tool Selection

commit ca32b19
Author: pan261 <pan261@purdue.edu>
Date:   Tue Sep 14 12:44:01 2021 -0400

    Changed H19 -> H1 for Verify WCS
  • Loading branch information
pan261 committed Sep 16, 2021
1 parent 05921f4 commit 218a399
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 5 deletions.
60 changes: 58 additions & 2 deletions Haas_Gantry_BIDC/Bechtel SR.cps
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ properties = {/*
{title: "Cycles", id: "cycles"},
{title: "Patterns", id: "patterns"}
],
value: "allOperations",
value: "none",
scope: "post"
},/*
useG187: {
Expand Down Expand Up @@ -260,6 +260,14 @@ properties = {/*
value: true,
scope: "post"
}*/
toolsToLoad: {
title: "Tools to load and probe",
description: "List or provide a range of tools to probe e.g. 1, 2, 3 or 1-5. Leaving this empty will probe all tools",
group: 4,
type: "string",
value: "",
scope: "post"
},
pencilWCSValidation: {
title: "WCS Validation",
description: "WCS validation. By turning this off, you accept responsibility for any resulting crashes.",
Expand All @@ -281,7 +289,7 @@ properties = {/*
description: "Tool Probing. By turning this off, you accept responsibility for any resulting crashes.",
group: 99,
type: "boolean",
value: false,
value: true,
scope: "post"
}
};
Expand Down Expand Up @@ -905,11 +913,59 @@ function onOpen() {
writeComment(localize("Once the tools are verified turn BLOCK DELETE on to skip verification"));
*/

parsedTools = []

function defaultFill() {
for (var i = 0; i < tools.getNumberOfTools(); i++){
parsedTools[i] = tools.getTool(i).number;
}
}

function invalidToolNum(toolNum) {
return (toolNum < 1 || toolNum > 10);
}
// parse string for specific tools to load
if (getProperty("toolsToLoad") != "") {
// get list of numbers
let toolNumArray = getProperty("toolsToLoad").split(',');
// iterate through and fill ranges
for (var i = 0; i < toolNumArray.length; i++){
toolNumArray[i] = toolNumArray[i].trim();
// fill range
if (toolNumArray[i].indexOf("-") >= 0) {
let numRange = toolNumArray[i].split("-");
if (invalidToolNum(parseInt(numRange[0])) || invalidToolNum(parseInt(numRange[1]))) {
defaultFill();
break;
}
for(var j = numRange[0]; j <= numRange[1]; j++){
parsedTools.push(parseInt(j));
}
continue;
}
// check if valid num
if (invalidToolNum(parseInt(toolNumArray[i]))) {
defaultFill();
break;
}
// push single num
parsedTools.push(parseInt(toolNumArray[i]));
}
} else {
defaultFill();
}

for (var i = 0; i < tools.getNumberOfTools(); ++i) {
var tool = tools.getTool(i);
if (staticProperties.optionallyMeasureToolsAtStart && (tool.type == TOOL_PROBE)) {
continue;
}

if (parsedTools.indexOf(tool.number) <= -1) {
continue;
}

var comment = "T" + toolFormat.format(tool.number) + " " +
"D=" + xyzFormat.format(tool.diameter) + " " +
localize("CR") + "=" + xyzFormat.format(tool.cornerRadius);
Expand Down
5 changes: 4 additions & 1 deletion Haas_Mills_BIDC/Bechtel DT.cps
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,8 @@ staticProperties = {
const X_TRAVEL_LIMIT = -20;
const Y_TRAVEL_LIMIT = -16;

const MAX_TOOL_NUM = 20;

var singleLineCoolant = false; // specifies to output multiple coolant codes in one line rather than in separate lines
// samples:
// {id: COOLANT_THROUGH_TOOL, on: 88, off: 89}
Expand Down Expand Up @@ -1367,7 +1369,7 @@ function onOpen() {
// also maybe anonymous
// TODO: tool.getNumberOfTools needs to be machine-specific constant
function invalidToolNum(toolNum) {
return (toolNum < 1 || toolNum > tools.getNumberOfTools() || tools.getTool(toolNum) == undefined);
return (toolNum < 1 || toolNum > MAX_TOOL_NUM);
}

// parse string for specific tools to load
Expand Down Expand Up @@ -2815,6 +2817,7 @@ function onSection() {

if (tool.type != TOOL_PROBE) {
setCoolant(tool.coolant);
writeBlock(gFormat.format(4), "P500");
}

writeComment("BEGIN OPERATION");
Expand Down
5 changes: 4 additions & 1 deletion Haas_Mills_BIDC/Bechtel VF2.cps
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,8 @@ staticProperties = {
const X_TRAVEL_LIMIT = -30;
const Y_TRAVEL_LIMIT = -15;

const MAX_TOOL_NUM = 20;

var singleLineCoolant = false; // specifies to output multiple coolant codes in one line rather than in separate lines
// samples:
// {id: COOLANT_THROUGH_TOOL, on: 88, off: 89}
Expand Down Expand Up @@ -1367,7 +1369,7 @@ function onOpen() {
// also maybe anonymous
// TODO: tool.getNumberOfTools needs to be machine-specific constant
function invalidToolNum(toolNum) {
return (toolNum < 1 || toolNum > tools.getNumberOfTools() || tools.getTool(toolNum) == undefined);
return (toolNum < 1 || toolNum > MAX_TOOL_NUM);
}

// parse string for specific tools to load
Expand Down Expand Up @@ -2815,6 +2817,7 @@ function onSection() {

if (tool.type != TOOL_PROBE) {
setCoolant(tool.coolant);
writeBlock(gFormat.format(4), "P500");
}

writeComment("BEGIN OPERATION");
Expand Down
3 changes: 2 additions & 1 deletion Haas_Mills_BIDC/Bechtel VF4.cps
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,7 @@ staticProperties = {
const X_TRAVEL_LIMIT = -50;
const Y_TRAVEL_LIMIT = -20;

const MAX_TOOL_NUM = 20;
var singleLineCoolant = false; // specifies to output multiple coolant codes in one line rather than in separate lines
// samples:
// {id: COOLANT_THROUGH_TOOL, on: 88, off: 89}
Expand Down Expand Up @@ -1367,7 +1368,7 @@ function onOpen() {
// also maybe anonymous
// TODO: tool.getNumberOfTools needs to be machine-specific constant
function invalidToolNum(toolNum) {
return (toolNum < 1 || toolNum > tools.getNumberOfTools() || tools.getTool(toolNum) == undefined);
return (toolNum < 1 || toolNum > MAX_TOOL_NUM);
}

// parse string for specific tools to load
Expand Down

0 comments on commit 218a399

Please sign in to comment.