diff --git a/Haas_Lathes_BIDC/Bechtel ST-20.cps b/Haas_Lathes_BIDC/Bechtel ST-20.cps index 8ec3918..2fc91a9 100644 --- a/Haas_Lathes_BIDC/Bechtel ST-20.cps +++ b/Haas_Lathes_BIDC/Bechtel ST-20.cps @@ -4,7 +4,7 @@ HAAS Lathe post processor configuration. - $Revision: 43295 06360a6b2ff0d13b975cf2a27b03d8a4d3760ca5 $ + $Revision: BIDCST0G8A21 06360a6b2ff0d13b975cf2a27b03d8a4d3760ca5 $ $Date: 2021-05-27 22:34:05 $ FORKID {14D60AD3-4366-49dc-939C-4DB5EA48FF68} @@ -76,7 +76,7 @@ properties = { description: "Output a tool list in the header of the code.", group: 0, type: "boolean", - value: true, + value: false, scope: "post" }, writeVersion: { @@ -84,7 +84,7 @@ properties = { description: "Write the version number in the header of the code.", group: 0, type: "boolean", - value: true, + value: false, scope: "post" }, showSequenceNumbers: { @@ -370,7 +370,9 @@ properties = { }; staticProperties = { - postVersion: "ST0G8A21" + postVersion: "BIDC-ST0.G8.A21", + useG187: false, + safeStartAllOperations: true }; var permittedCommentChars = " ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,=_-"; @@ -571,84 +573,69 @@ function getCompleteTool(holder, tool) { tool.threadPitch = toolSection.getParameter("operation:tool_threadPitch") if (holder == WHOLD) { - switch (tool.type) { - case TOOL_TURNING_GROOVING: - this.offsetType = "Grooving"; - this.probeX = function() { - return holder.x + (tool.holderOverallLength*2); - }; - this.probeZ = function() { - return holder.z + (tool.shankWidth*.5); - }; + this.probeX = function() { + return holder.x + (tool.holderOverallLength*2); + }; + if (tool.type == TOOL_TURNING_GROOVING) { + this.offsetType = "Grooving"; + this.probeZ = function() { + return holder.z + (tool.shankWidth*.5); + }; + } else { + var lhZ = function() { + return holder.z - tool.cuttingWidth + (tool.shankWidth*.5); + }; + var rhZ = function() { + return holder.z + tool.cuttingWidth - (tool.shankWidth*.5); + }; - return; - default: - this.offsetType = "General Turning"; - this.probeX = function() { - return holder.x + (tool.holderOverallLength*2); - }; - if (tool.hand == 'L') { - this.probeZ = function() { - return holder.z - tool.cuttingWidth + (tool.shankWidth*.5); - }; - } else { - this.probeZ = function() { - return holder.z + tool.cuttingWidth - (tool.shankWidth*.5); - }; - } + this.offsetType = (tool.hand =='L') ? "General Turning, L" : "General Turning, R"; + this.probeZ = (tool.hand =='L') ? lhZ : rhZ; } } else { - switch (tool.type) { - case TOOL_DRILL: - case TOOL_DRILL_CENTER: - case TOOL_DRILL_SPOT: - case TOOL_COUNTER_BORE: - case TOOL_COUNTER_SINK: - case TOOL_MILLING_CHAMFER: - if (tool.numberOfFlutes != 1) { - this.offsetType = "General Drilling"; - this.probeX = function() { - return holder.x - PROBE_CENTERING_OFFSET; - }; - this.machineX = function() { - return holder.x; - } - this.probeZ = function() { - return holder.z + (tool.getBodyLength() + tool.getHolderLength()); - }; - return; - } - this.offsetType = "Indexable Drill"; - this.probeX = function() { - return holder.x + tool.diameter*.3 - PROBE_CENTERING_OFFSET; - }; - this.machineX = function() { - return holder.x; - }; - this.probeZ = function() { - return holder.z + (tool.getBodyLength() + tool.getHolderLength() + holder.sOffset); - }; - return; + var defaultX = function() { + return holder.x - (tool.cuttingWidth*2); + }; + var defaultZ = function() { + return holder.z + tool.holderOverallLength + holder.sOffset; + }; + + var haasType = getHaasToolTypeBIDC(tool.type); + if (haasType == HAAS_DRILL || haasType == HAAS_CENTER) { + var stanProbeX = function() { + return holder.x - PROBE_CENTERING_OFFSET; + }; + var indexProbeX = function() { + return holder.x + (.3*tool.diameter) - PROBE_CENTERING_OFFSET; + }; + var stanProbeZ = function() { + return holder.z + (tool.getBodyLength() + tool.getHolderLength()); + }; + var indexProbeZ = function() { + return holder.z + (tool.getBodyLength() + tool.getHolderLength()) + holder.sOffset; + }; + + this.offsetType = (tool.numberOfFlutes != 1) ? "General Drill" : "Indexable Drill"; + this.probeZ = (tool.numberOfFlutes != 1) ? stanProbeZ : indexProbeZ; + this.probeX = (tool.numberOfFlutes != 1) ? stanProbeX : indexProbeX; + this.machineX = function() { + return holder.x; + }; + return; + } - case TOOL_TURNING_THREADING: - this.offsetType = "Threading"; - this.probeX = function() { - return holder.x - (2*(tool.cuttingWidth) - tool.shankWidth); - }; - this.probeZ = function() { - return holder.z + tool.holderOverallLength + holder.sOffset; - }; - return; - - default: - this.offsetType = "General Turning" - this.probeX = function() { - return holder.x - (tool.cuttingWidth*2); - }; - this.probeZ = function() { - return holder.z + tool.holderOverallLength + holder.sOffset; - }; + if (tool.type == TOOL_TURNING_THREADING) { + this.offsetType = "Threading"; + this.probeX = function() { + return holder.x - (2*tool.cuttingWidth - tool.shankWidth); + }; + this.probeZ = defaultZ; + return; } + + this.offsetType = "General Turning"; + this.probeX = defaultX; + this.probeZ = defaultZ; } } @@ -1101,6 +1088,9 @@ function formatComment(text) { return "(" + String(text).replace(/[()]/g, "") + ")"; } + +// will1742 | Gavin Williams | 8/20/21 +// Added support for comments over max length /** Output a comment. */ @@ -1217,20 +1207,13 @@ function writeToolMeasureBlockBIDC(tool) { writeMeasure(gFormat.format(10), "L10 P" + tool.number, rOffset.format(tool.cornerRadius != 0 ? tool.cornerRadius : tool.noseRadius)); } - // if (tool.type == TOOL_TURNING_THREADING) { - // writeMeasure(gFormat.format(10), "L10 P" + tool.number, rOffset.format(tool.threadPitch*2)); - // } - writeMeasure("T" + toolFormat.format(tool.number * 100 + compensationOffset % 100)); writeComment("PROBE: " + measureTool.offsetType + ", " + probeType.name); writeMeasure(mFormat.format(104)); writeMeasure(gFormat.format(212), "H" + probeType.num); writeMeasure(mFormat.format(105)); - // if (tool.type == TOOL_TURNING_THREADING) { - // writeMeasure(gFormat.format(10), "L10 P" + tool.number, rOffset.format(0)); - // } - if (measureTool.offsetType == "Indexible Drill") { + if (typeof measureTool.machineX == 'function') { writeMeasure(gFormat.format(10), "L10 P" + tool.number, xOffset.format(measureTool.machineX())); } @@ -1307,6 +1290,7 @@ function onOpen() { return; } + // will1742 | Gavin Williams | 8/20/21 writeComment("Career Account Username: " + getGlobalParameter("username")); writeComment("Filename: " + getGlobalParameter("document-path")); writeComment("Date: " + getGlobalParameter("generated-at")); @@ -1329,6 +1313,7 @@ function onOpen() { var description = machineConfiguration.getDescription(); if (getProperty("writeMachine") && (vendor || model || description)) { + writeln(""); writeComment(localize("Machine")); if (vendor) { writeComment(" " + localize("vendor") + ": " + vendor); @@ -1343,6 +1328,8 @@ function onOpen() { // dump tool information if (getProperty("writeTools")) { + writeln(""); + var zRanges = {}; if (is3D()) { var numberOfSections = getNumberOfSections(); @@ -1356,9 +1343,27 @@ function onOpen() { zRanges[tool.number] = zRange; } } - writeln(""); } + 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 comment = "T" + toolFormat.format(tool.number * 100 + compensationOffset % 100) + " " + + (tool.diameter != 0 ? "D=" + spatialFormat.format(tool.diameter) + " " : "") + + (tool.isTurningTool() ? localize("NR") + "=" + spatialFormat.format(tool.noseRadius) : localize("CR") + "=" + spatialFormat.format(tool.cornerRadius)) + + (tool.taperAngle > 0 && (tool.taperAngle < Math.PI) ? " " + localize("TAPER") + "=" + taperFormat.format(tool.taperAngle) + localize("deg") : "") + + (zRanges[tool.number] ? " - " + localize("ZMIN") + "=" + spatialFormat.format(zRanges[tool.number].getMinimum()) : "") + + " - " + localize(getToolTypeName(tool.type)); + writeComment(comment); + } + } + writeln(""); + } + + if (getProperty("loadToolsAtStart") || getProperty("measureToolsAtStart")) { + writeln(""); // will1742 | Gavin Williams | 8/10/21 // Auto probe tools var tools = getToolTable(); diff --git a/Haas_Lathes_BIDC/Bechtel ST-20Y.cps b/Haas_Lathes_BIDC/Bechtel ST-20Y.cps index d351a50..b2578a8 100644 --- a/Haas_Lathes_BIDC/Bechtel ST-20Y.cps +++ b/Haas_Lathes_BIDC/Bechtel ST-20Y.cps @@ -354,7 +354,7 @@ properties = { }; staticProperties = { - postVersion: "STYG8A21" + postVersion: "BIDC-STY.G8.A21" }; var permittedCommentChars = " ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,=_-"; @@ -578,18 +578,18 @@ function getCompleteTool(holder, tool) { tool.threadPitch = toolSection.getParameter("operation:tool_threadPitch") if (holder == KM50R || holder == WBLOCK) { - // Defaults this.probeX = function() { return holder.x = tool.holderOverallLength*2; - } + }; if (tool.type == TOOL_TURNING_GROOVING) { + this.offsetType = "Grooving"; var kmZ = function() { return holder.z + tool.shankWidth; - } + }; var wbZ = function() { return holder.z + (.5*tool.shankWidth); - } + }; this.probeZ = (holder == KM50R) ? kmZ : wbZ; return; @@ -601,69 +601,72 @@ function getCompleteTool(holder, tool) { return holder.z + tool.cuttingWidth - (.5*tool.shankWidth); }; + this.offsetType = (tool.hand =='L') ? "General Turning, L" : "General Turning, R"; this.probeZ = (tool.hand == 'L') ? leftHandZ : rightHandZ; } - } else if (holder == KM50A || holder == RBLOCKY) { var defaultX = function() { return holder.x - (tool.cuttingWidth*2); - } - + }; var defaultZ = function() { return holder.z + tool.holderOverallLength + holder.sOffset; - } + }; - if (getHaasToolTypeBIDC(tool.type) == HAAS_DRILL) { + var haasType = getHaasToolTypeBIDC(tool.type); + if (haasType == HAAS_DRILL || haasType == HAAS_CENTER) { var stanProbeX = function() { - return holder.z - PROBE_CENTERING_OFFSET; - } + return holder.x - PROBE_CENTERING_OFFSET; + }; var indexProbeX = function() { return holder.x + (.3*tool.diameter) - PROBE_CENTERING_OFFSET; - } + }; var stanProbeZ = function() { return holder.z + (tool.getBodyLength() + tool.getHolderLength()); - } + }; var indexProbeZ = function() { - return holder.z + tool.getBodyLength() + tool.getHolderLength() + holder.sOffset; - } + return holder.z + (tool.getBodyLength() + tool.getHolderLength()) + holder.sOffset; + }; this.offsetType = (tool.numberOfFlutes != 1) ? "General Drill" : "Indexable Drill"; this.probeZ = (tool.numberOfFlutes != 1) ? stanProbeZ : indexProbeZ; this.probeX = (tool.numberOfFlutes != 1) ? stanProbeX : indexProbeX; this.machineX = function() { return holder.z; - } + }; return; } if (tool.type == TOOL_TURNING_THREADING) { + this.offsetType = "Threading" this.probeX = function() { return holder.x - (tool.cuttingWidth - (.5*tool.shankWidth)); - } + }; this.probeZ = defaultZ; return; } + this.offsetType = "General Turning"; this.probeX = defaultX; this.probeZ = defaultZ; - } else if (holder == KM40R) { + this.offsetType = "General Turning"; this.probeX = function() { return holder.x + (tool.getBodyLength() + tool.getHolderLength())*2 - } + }; this.probeZ = function() { return holder.z - PROBE_CENTERING_OFFSET; - } + }; this.machineZ = function() { return holder.z; - } + }; } else if (holder == KM40A) { + this.offsetType = "General Turning"; this.probeX = function() { return holder.z - PROBE_CENTERING_OFFSET; } this.machineX = function() { - return holder.z; + return holder.x; } this.probeZ = function() { return holder.z + (tool.getBodyLength() + tool.getHolderLength())*2 @@ -1222,6 +1225,8 @@ function getHaasProbingTypeBIDC(tool, internal) { } function writeToolMeasureBlockBIDC(tool) { + var writeMeasure = getProperty("measureToolsAtStart") ? writeBlock : writeOptionalBlock; + var holder = getToolHolderBIDCST20(tool.number); let measureTool = new getCompleteTool(holder, tool); @@ -1232,21 +1237,25 @@ function writeToolMeasureBlockBIDC(tool) { return; } - writeBlock(gFormat.format(10), "L10 P" + tool.number, xOffset.format(measureTool.probeX())); - writeBlock(gFormat.format(10), "L10 P" + tool.number, zOffset.format(measureTool.probeZ())); + writeMeasure(gFormat.format(10), "L10 P" + tool.number, xOffset.format(measureTool.probeX())); + writeMeasure(gFormat.format(10), "L10 P" + tool.number, zOffset.format(measureTool.probeZ())); if(tool.noseRadius != 0 || tool.cornerRadius != 0) { - writeBlock(gFormat.format(10), "L10 P" + tool.number, rOffset.format(tool.cornerRadius != 0 ? tool.cornerRadius : tool.noseRadius)); + writeMeasure(gFormat.format(10), "L10 P" + tool.number, rOffset.format(tool.cornerRadius != 0 ? tool.cornerRadius : tool.noseRadius)); } - writeBlock("T" + toolFormat.format(tool.number * 100 + compensationOffset % 100)); + writeMeasure("T" + toolFormat.format(tool.number * 100 + compensationOffset % 100)); writeComment("PROBE: " + measureTool.offsetType + ", " + probeType.name); - writeBlock(mFormat.format(104)); - writeBlock(gFormat.format(212), "H" + probeType.num); - writeBlock(mFormat.format(105)); + writeMeasure(mFormat.format(104)); + writeMeasure(gFormat.format(212), "H" + probeType.num); + writeMeasure(mFormat.format(105)); if (typeof measureTool.machineX == 'function') { - writeBlock(gFormat.format(10), "L10 P" + tool.number, xOffset.format(measureTool.machineX())); + writeMeasure(gFormat.format(10), "L10 P" + tool.number, xOffset.format(measureTool.machineX())); + } + if (typeof measureTool.machineZ == 'function') { + writeMeasure(gFormat.format(10), "L10 P" + tool.number, xOffset.format(measureTool.machineZ())); } + writeln(""); } @@ -1343,6 +1352,7 @@ function onOpen() { var description = machineConfiguration.getDescription(); if (getProperty("writeMachine") && (vendor || model || description)) { + writeln(""); writeComment(localize("Machine")); if (vendor) { writeComment(" " + localize("vendor") + ": " + vendor); @@ -1357,6 +1367,8 @@ function onOpen() { // dump tool information if (getProperty("writeTools")) { + writeln(""); + var zRanges = {}; if (is3D()) { var numberOfSections = getNumberOfSections(); @@ -1370,10 +1382,28 @@ function onOpen() { zRanges[tool.number] = zRange; } } - writeln(""); } - // will1742 | Gavin Williams | 8/20/21 + 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 comment = "T" + toolFormat.format(tool.number * 100 + compensationOffset % 100) + " " + + (tool.diameter != 0 ? "D=" + spatialFormat.format(tool.diameter) + " " : "") + + (tool.isTurningTool() ? localize("NR") + "=" + spatialFormat.format(tool.noseRadius) : localize("CR") + "=" + spatialFormat.format(tool.cornerRadius)) + + (tool.taperAngle > 0 && (tool.taperAngle < Math.PI) ? " " + localize("TAPER") + "=" + taperFormat.format(tool.taperAngle) + localize("deg") : "") + + (zRanges[tool.number] ? " - " + localize("ZMIN") + "=" + spatialFormat.format(zRanges[tool.number].getMinimum()) : "") + + " - " + localize(getToolTypeName(tool.type)); + writeComment(comment); + } + } + writeln(""); + } + + if (getProperty("loadToolsAtStart") || getProperty("measureToolsAtStart")) { + writeln(""); + // will1742 | Gavin Williams | 8/10/21 // Auto probe tools var tools = getToolTable(); if (tools.getNumberOfTools() > 0) { @@ -1381,8 +1411,9 @@ function onOpen() { var tool = tools.getTool(i); var compensationOffset = tool.isTurningTool() ? tool.compensationOffset : tool.lengthOffset; var toolPosition = toolFormat.format(tool.number * 100 + compensationOffset % 100); - writeBlock("T" + toolFormat.format((tool.number - 3) >= 1 ? tool.number - 3 : tool.number + 9), mFormat.format(6)); - writeBlock(mFormat.format(0)); + 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); } @@ -1446,6 +1477,10 @@ function onOpen() { writeln("N1 (START MAIN PROGRAM)"); } + writeBlock(mFormat.format(0)); + writeComment("LOAD STOCK"); + writeln(""); + // absolute coordinates and feed per min writeBlock(getCode("FEED_MODE_UNIT_MIN"), gPlaneModal.format(18));