- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I'm attempting to get my tool list to display the tool number with offsets. I have partially succeeded, but I can only display two of the three offset numbers. I'm using a Doosan SMX2100ST mill-turn with a post that has been slightly modified for my needs.
This is what I'm outputting now:
(T0101 - UPPER CNMG 432-PM 4425)
(T1099 - 1.0" INDXBL MILL R.122" - TOOL GRP 10)
(T1299 - 2.5" INDXBL MILL R.122" W/EXT - TOOL GRP 12)
(T5151 - 1/2" .030R 7FLT ENDMILL)
This is what I would like:
(T01001 - UPPER CNMG 432-PM 4425)
(T10999 - 1.0" INDXBL MILL R.122" - TOOL GRP 10)
(T12999 - 2.5" INDXBL MILL R.122" W/EXT - TOOL GRP 12)
(T51051 - 1/2" .030R 7FLT ENDMILL)
Below is the code from my post. I have tools that use the same tool number, and different offsets, so it's not quite typical:
if (properties.writeTools) {
var tools = [];
var numberOfSections = getNumberOfSections();
for (var i = 0; i < numberOfSections; ++i) {
var section = getSection(i);
var tool = section.getTool();
var isDuplicate = false;
for (var j = 0; j < tools.length; ++j) {
if (tools[j].number == tool.number && tools[j].compensationOffset == tool.compensationOffset) {
isDuplicate = true;
}
}
if (!isDuplicate) {
tools.push(tool);
}
}
var zRanges = {};
if (is3D()) {
var numberOfSections = getNumberOfSections();
for (var i = 0; i < numberOfSections; ++i) {
var section = getSection(i);
var zRange = section.getGlobalZRange();
var tool = section.getTool();
if (zRanges[tool.number + compensationOffset]) {
zRanges[tool.number + compensationOffset].expandToRange(zRange);
} else {
zRanges[tool.number + compensationOffset] = zRange;
}
}
}
for (var i = 0; i < tools.length; ++i) {
var tool = tools[i];
var compensationOffset = tool.isTurningTool() ? tool.compensationOffset : tool.lengthOffset;
var comment = "T" + toolFormat.format(tool.number * 100 + compensationOffset % 100) + " - " + tool.description;
writeComment(comment);
}
}
Thank you in advance!
Solved! Go to Solution.