diff --git a/Haas_Lathes_BIDC/Bechtel ST-20Y.cps b/Haas_Lathes_BIDC/Bechtel ST-20Y.cps index 1ef6de3..649885c 100644 --- a/Haas_Lathes_BIDC/Bechtel ST-20Y.cps +++ b/Haas_Lathes_BIDC/Bechtel ST-20Y.cps @@ -578,22 +578,22 @@ function getCompleteTool(holder, tool) { tool.threadPitch = toolSection.getParameter("operation:tool_threadPitch") if (holder == KM50R || holder == WBLOCK) { - switch (tool.type) { - case TOOL_TURNING_GROOVING: - var kmZ = function() { - return holder.z + tool.shankWidth; - } - var wbZ = function() { - return holder.z + (.5*tool.shankWidth); - } + // Defaults + this.probeX = function() { + return holder.x = tool.holderOverallLength*2; + } - this.probeX = function() { - return holder.x = tool.holderOverallLength*2; - } + if (tool.type == TOOL_TURNING_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; - default: + this.probeZ = (holder == KM50R) ? kmZ : wbZ; + return; + } else { var leftHandZ = function() { return holder.z - tool.cuttingWidth + (.5*tool.shankWidth); }; @@ -601,18 +601,68 @@ function getCompleteTool(holder, tool) { return holder.z + tool.cuttingWidth - (.5*tool.shankWidth); }; - this.probeX = function() { - return holder.x = tool.holderOverallLength*2; - } - - this.probeZ = tool.hand == 'L' ? leftHandZ : rightHandZ; + 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; + } + + if (getHaasToolTypeBIDC(tool.type) == HAAS_DRILL) { + var stanProbeX = function() { + return holder.z - 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.z; + } + return; + } + + if (tool.type == TOOL_TURNING_THREADING) { + this.probeX = function() { + return holder.x - (tool.cuttingWidth - (.5*tool.shankWidth)); + } + } } else if (holder == KM40R) { + 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.probeX = function() { + return holder.z - PROBE_CENTERING_OFFSET; + } + this.machineX = function() { + return holder.z; + } + this.probeZ = function() { + return holder.z + (tool.getBodyLength() + tool.getHolderLength())*2 + } } else { throw "TOOL: " + tool.number + ", INVALID HOLDER" }