Skip to content

Commit

Permalink
Probing Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
will1742 committed Aug 17, 2021
1 parent c5fc8ed commit 62b1829
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 39 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ Haas_Next_Generation/Bechtel VF2HP.cps
*.nc
.vscode/
*.dmp
*.failed
*.failed
Personal/*
112 changes: 74 additions & 38 deletions Haas_Lathes_BIDC/haas st-20.cps
Original file line number Diff line number Diff line change
Expand Up @@ -516,8 +516,8 @@ const NORTH = {

const WHOLD = {
name: "Wedge Holder",
x: -24.8257,
z: -13.7333,
x: -24.8094,
z: -13.1233,
sOffset: 0.0
};

Expand Down Expand Up @@ -551,68 +551,93 @@ function getCompleteTool(holder, tool) {
tool.shankWidth = toolSection.getParameter("operation:tool_shankWidth");
tool.cuttingWidth = toolSection.getParameter("operation:tool_cuttingWidth");
tool.holderOverallLength = toolSection.getParameter("operation:tool_holderOverallLength");
tool.threadPitch = toolSection.getParameter("operation:tool_threadPitch")

if (holder == WHOLD) {
switch (tool.type) {
case TOOL_TURNING_GROOVING:
this.offsetType = "Grooving";
this.x = function() {
this.probeX = function() {
return holder.x + tool.holderOverallLength*2;
};
this.z = function() {
return holder.z + tool.shankWidth;
this.probeZ = function() {
return holder.z + tool.shankWidth*.5;
};
break;
return;

case TOOL_TURNING_THREADING:
this.offsetType = "Threading";
this.probeX = function() {
return holder.x + tool.holderOverallLength*2;
};
this.probeZ = function() {
return holder.z + tool.cuttingWidth - (.5*tool.shankWidth);
}

return;
default:
this.offsetType = "General Turning";
this.x = function() {
this.probeX = function() {
return holder.x + tool.holderOverallLength*2;
};
this.z = function() {
return holder.z + (tool.cuttingWidth + tool.shankWidth)*.5;
};
if (tool.hand == 'L') {
this.probeZ = function() {
return holder.z - tool.cuttingWidth*.5;
};
} else {
this.probeZ = function() {
return holder.z + tool.cuttingWidth*.5;
};
}
}
} else {
switch (tool.type) {
case HAAS_DRILL:
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.x = function() {
this.probeX = function() {
return holder.x;
};
this.z = function() {
this.probeZ = function() {
return holder.z + (tool.getBodyLength() + tool.getHolderLength());
};
break;
return;
}
this.offsetType = "Indexible Drilling";
this.x = function() {
this.offsetType = "Indexible Drill";
this.probeX = function() {
return holder.x + tool.diameter*.3;
};
this.z = function() {
this.machineX = function() {
return holder.x;
};
this.probeZ = function() {
return holder.z + (tool.getBodyLength() + tool.getHolderLength() + holder.sOffset);
};
break;
return;

case TOOL_TURNING_THREADING:
this.offsetType = "Threading";
this.x = function() {
this.probeX = function() {
return holder.x - (tool.cuttingWidth - tool.shankWidth*.5);
};
this.z = function() {
this.probeZ = function() {
return holder.z + (tool.holderOverallLength + holder.sOffset);
};
break;
return;

default:
this.offsetType = "General Turning"
this.x = function() {
return holder.x - tool.cuttingWidth*2;
};
this.z = function() {
return holder.z + (tool.holderOverallLength + holder.sOffset);
};
default:
this.offsetType = "General Turning"
this.probeX = function() {
return holder.x - tool.cuttingWidth*2;
};
this.probeZ = function() {
return holder.z + (tool.holderOverallLength + holder.sOffset);
};
}
}
}
Expand Down Expand Up @@ -1136,17 +1161,18 @@ function getToolHolderBIDCST20(toolNum) {
}
}

function getHaasProbingTypeBIDC(tool, internal, axial) {
function getHaasProbingTypeBIDC(tool, internal) {
switch (getHaasToolTypeBIDC(tool.type)) {
case BIDC_BORING_TURNING:
return SOUTHEAST;
case BIDC_GEN_TURNING:
if (internal) {
return SOUTHEAST;
if (tool.type == TOOL_TURNING_THREADING || tool.type == TOOL_TURNING_GROOVING) {
return internal ? SOUTHEAST : NORTHEAST;
}
return tool.hand =='R' ? NORTHEAST : NORTHWEST;
case HAAS_DRILL:
case HAAS_END_MILL:
return axial ? EAST : NORTH;
case HAAS_CENTER:
return EAST;
default:
throw "INVALID PROBING DIRECTION";
}
Expand All @@ -1156,24 +1182,34 @@ function writeToolMeasureBlockBIDC(tool) {
var holder = getToolHolderBIDCST20(tool.number);
let measureTool = new getCompleteTool(holder, tool);
var probeType = getHaasProbingTypeBIDC(tool, measureTool.inner, measureTool.axial);
var probeType = getHaasProbingTypeBIDC(tool, measureTool.inner);
var compensationOffset = tool.isTurningTool() ? tool.compensationOffset : tool.lengthOffset;
if (compensationOffset > 99) {
error(localize("Compensation offset is out of range."));
return;
}

writeBlock(gFormat.format(10), "L10 P" + tool.number, xOffset.format(measureTool.x()));
writeBlock(gFormat.format(10), "L10 P" + tool.number, zOffset.format(measureTool.z()));
writeBlock(gFormat.format(10), "L10 P" + tool.number, xOffset.format(measureTool.probeX()));
writeBlock(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));
}

if (tool.type == TOOL_TURNING_THREADING) {
writeBlock(gFormat.format(10), "L10 P" + tool.number, rOffset.format(tool.threadPitch*2));
}

writeBlock("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));
if (tool.type == TOOL_TURNING_THREADING) {
writeBlock(gFormat.format(10), "L10 P" + tool.number, rOffset.format(0));
}
if (measureTool.offsetType == "Indexible Drill") {
writeBlock(gFormat.format(10), "L10 P" + tool.number, xOffset.format(measureTool.machineX()));
}
writeln("");
}

Expand Down Expand Up @@ -1327,9 +1363,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);
writeComment(tool.description);
writeBlock("T" + toolFormat.format((tool.number - 3) >= 1 ? tool.number - 3 : tool.number + 9), mFormat.format(6));
writeBlock(mFormat.format(0));
writeComment(tool.description);
writeComment("LOAD TOOL " + tool.number);
writeToolMeasureBlockBIDC(tool);
}
Expand Down

0 comments on commit 62b1829

Please sign in to comment.