Skip to content

Commit

Permalink
fixed bug with loadTools and measureTools are both 'false'
Browse files Browse the repository at this point in the history
  • Loading branch information
pan261 authored and will1742 committed Sep 7, 2021
1 parent 0ee3644 commit 0c71dc7
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions Haas_Lathes_BIDC/Bechtel ST-20.cps
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ properties = {
description: "Tool loading and probing. By turning this off, you accept responsibility for any resulting crashes.",
group: 99,
type: "boolean",
value: true,
value: false,
scope: "post"
},
loadToolsAtStart: {
Expand Down Expand Up @@ -1363,22 +1363,20 @@ function onOpen() {
writeln("");
}

if (getProperty("loadToolsAtStart") || getProperty("measureToolsAtStart")) {
writeln("");
// will1742 | Gavin Williams | 8/10/21
// Auto probe tools
var tools = getToolTable();
if (tools.getNumberOfTools() > 0) {
for (var i = 0; i < tools.getNumberOfTools(); ++i) {
var tool = tools.getTool(i);
var compensationOffset = tool.isTurningTool() ? tool.compensationOffset : tool.lengthOffset;
var toolPosition = toolFormat.format(tool.number * 100 + compensationOffset % 100);
var writeLoad = getProperty("loadToolsAtStart") ? writeBlock : writeOptionalBlock;
writeLoad("T" + toolFormat.format((tool.number - 3) >= 1 ? tool.number - 3 : tool.number + 9), mFormat.format(6));
writeLoad(mFormat.format(0));
writeComment("LOAD T" + tool.number + ": " + tool.description);
writeToolMeasureBlockBIDC(tool);
}
writeln("");
// will1742 | Gavin Williams | 8/10/21
// Auto probe tools
var tools = getToolTable();
if (tools.getNumberOfTools() > 0) {
for (var i = 0; i < tools.getNumberOfTools(); ++i) {
var tool = tools.getTool(i);
var compensationOffset = tool.isTurningTool() ? tool.compensationOffset : tool.lengthOffset;
var toolPosition = toolFormat.format(tool.number * 100 + compensationOffset % 100);
var writeLoad = getProperty("loadToolsAtStart") ? writeBlock : writeOptionalBlock;
writeLoad("T" + toolFormat.format((tool.number - 3) >= 1 ? tool.number - 3 : tool.number + 9), mFormat.format(6));
writeLoad(mFormat.format(0));
writeComment("LOAD T" + tool.number + ": " + tool.description);
writeToolMeasureBlockBIDC(tool);
}
}

Expand Down

0 comments on commit 0c71dc7

Please sign in to comment.