Skip to content

Commit

Permalink
Organization, Compliance
Browse files Browse the repository at this point in the history
  • Loading branch information
will1742 committed Aug 24, 2021
1 parent c192714 commit aedd7c9
Show file tree
Hide file tree
Showing 2 changed files with 161 additions and 121 deletions.
177 changes: 91 additions & 86 deletions Haas_Lathes_BIDC/Bechtel ST-20.cps
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -76,15 +76,15 @@ properties = {
description: "Output a tool list in the header of the code.",
group: 0,
type: "boolean",
value: true,
value: false,
scope: "post"
},
writeVersion: {
title: "Write version",
description: "Write the version number in the header of the code.",
group: 0,
type: "boolean",
value: true,
value: false,
scope: "post"
},
showSequenceNumbers: {
Expand Down Expand Up @@ -370,7 +370,9 @@ properties = {
};

staticProperties = {
postVersion: "ST0G8A21"
postVersion: "BIDC-ST0.G8.A21",
useG187: false,
safeStartAllOperations: true
};

var permittedCommentChars = " ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,=_-";
Expand Down Expand Up @@ -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;
}
}

Expand Down Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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()));
}

Expand Down Expand Up @@ -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"));
Expand All @@ -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);
Expand All @@ -1343,6 +1328,8 @@ function onOpen() {

// dump tool information
if (getProperty("writeTools")) {
writeln("");
var zRanges = {};
if (is3D()) {
var numberOfSections = getNumberOfSections();
Expand All @@ -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();
Expand Down
Loading

0 comments on commit aedd7c9

Please sign in to comment.