Announcements
Autodesk Community will be read-only between April 26 and April 27 as we complete essential maintenance. We will remove this banner once completed. Thanks for your understanding

Can't get coolant through tool to work to POST

andersEQHR7
Contributor

Can't get coolant through tool to work to POST

andersEQHR7
Contributor
Contributor

Why can't I get

onParameter('operation:tool_coolant', 'flood')

to be anything else than 'flood' it doesn't matter what type of coolant I set in the tool library I only get 'flood' type in the POST.

 

B.R.

Anders Tjernström

 

 

 

Anders T
0 Likes
Reply
Accepted solutions (1)
1,166 Views
15 Replies
Replies (15)

boopathi.sivakumar
Autodesk
Autodesk

Hi @andersEQHR7

I could not able to replicate the issue

  if (hasParameter("operation:tool_coolant")){
    var cc = getParameter("operation:tool_coolant");
    writeComment("Coolant Codes: " + cc)
  }

If you paste this codes in the onsection function

you will get the codes as expected 


Boopathi Sivakumar
Senior Technology Consultant

0 Likes

andersEQHR7
Contributor
Contributor

Hi,

I am sorry to say that this suggestion didn't help.
I guess that I should put the code into my post-processor under "function onSection"? or should it be in the "dump.cps"?

 

I don't know if I was clear enough the first time?
If I in the tool setup chose "Through tool" as coolant I would like that the post-processor set M11 if I chose "Flood" I want to have M08, if I chose "Flood and through tool" I want to have M08 M11. I have found where the M-codes should be changed in my post-processor that was easy. But it doesn't matter what I chose in tool setup I always get M08  when put out post file.

B.R.
Anders Tjernström

 

@

Anders T
0 Likes

boopathi.sivakumar
Autodesk
Autodesk

Hi @andersEQHR7 

What post processor (.cps) you are using? is it a generic post or modified one

did you change the coolant codes in this .cps file?

var coolants = [
  {id: COOLANT_FLOOD, on: 8},
  {id: COOLANT_MIST, on:8, off:9},
  {id: COOLANT_THROUGH_TOOL, on: 88, off: 89},
  {id: COOLANT_AIR},
  {id: COOLANT_AIR_THROUGH_TOOL},
  {id: COOLANT_SUCTION},
  {id: COOLANT_FLOOD_MIST,on:88, off:89},
  {id: COOLANT_FLOOD_THROUGH_TOOL, on: [8, 88], off: [9, 89]},
  {id: COOLANT_OFF, off: 9}
];

If you make the coolant ids here it will definitely update. Kindly check on this if not kindly share the .cps file so that i can take a look into it


Boopathi Sivakumar
Senior Technology Consultant

0 Likes

andersEQHR7
Contributor
Contributor

It was a generic FANUC but it has modified to work for my machine.

I can't find your code example in it.


I have attached it as a .RAR file

 

All help are very much appreciated.

 

B.R.
Anders Tjernström

 

@boopathi.sivakumar 

Anders T
0 Likes

boopathi.sivakumar
Autodesk
Autodesk

Hi @andersEQHR7 

it needs some editing in the post open the .cps file in the vs code

delete from line number 1802 to 1872

from function setCoolant(coolant{

to  currentCoolantMode = coolant;

}

and paste this set of codes

function getCoolantCodes(coolant) {
  var multipleCoolantBlocks = new Array(); // create a formatted array to be passed into the outputted line
  if (!coolants) {
    error(localize("Coolants have not been defined."));
  }
  if (isProbeOperation()) { // avoid coolant output for probing
    coolant = COOLANT_OFF;
  }
  if (coolant == currentCoolantMode) {
    return undefined; // coolant is already active
  }
  if ((coolant != COOLANT_OFF) && (currentCoolantMode != COOLANT_OFF) && (coolantOff != undefined)) {
    if (Array.isArray(coolantOff)) {
      for (var i in coolantOff) {
        multipleCoolantBlocks.push(mFormat.format(coolantOff[i]));
      }
    } else {
      multipleCoolantBlocks.push(mFormat.format(coolantOff));
    }
  }

  var m;
  var coolantCodes = {};
  for (var c in coolants) { // find required coolant codes into the coolants array
    if (coolants[c].id == coolant) {
      coolantCodes.on = coolants[c].on;
      if (coolants[c].off != undefined) {
        coolantCodes.off = coolants[c].off;
        break;
      } else {
        for (var i in coolants) {
          if (coolants[i].id == COOLANT_OFF) {
            coolantCodes.off = coolants[i].off;
            break;
          }
        }
      }
    }
  }
  if (coolant == COOLANT_OFF) {
    m = !coolantOff ? coolantCodes.off : coolantOff; // use the default coolant off command when an 'off' value is not specified
  } else {
    coolantOff = coolantCodes.off;
    m = coolantCodes.on;
  }

  if (!m) {
    onUnsupportedCoolant(coolant);
    m = 9;
  } else {
    if (Array.isArray(m)) {
      for (var i in m) {
        multipleCoolantBlocks.push(mFormat.format(m[i]));
      }
    } else {
      multipleCoolantBlocks.push(mFormat.format(m));
    }
    currentCoolantMode = coolant;
    return multipleCoolantBlocks; // return the single formatted coolant value
  }
  return undefined;
}

 

and go and find this line

var permittedCommentChars = " ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,=_-";
and paste the below codes above this line
var singleLineCoolant = false;
var coolants = [
  {id: COOLANT_FLOOD, on: 8},
  {id: COOLANT_MIST, on:8, off:9},
  {id: COOLANT_THROUGH_TOOL, on: 88, off: 89},
  {id: COOLANT_AIR},
  {id: COOLANT_AIR_THROUGH_TOOL},
  {id: COOLANT_SUCTION},
  {id: COOLANT_FLOOD_MIST,on:88, off:89},
  {id: COOLANT_FLOOD_THROUGH_TOOL, on: [8, 88], off: [9, 89]},
  {id: COOLANT_OFF, off: 9}
];

var permittedCommentChars = " ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,=_-";

and add the on, off codes based on your requirement

 


Boopathi Sivakumar
Senior Technology Consultant

0 Likes

andersEQHR7
Contributor
Contributor

I am sorry to report that this suggestion didn't work, I got 4 fault in a long log file.
I think that I will give it up for now and change the M-code manual instead, much faster.

I also tested the newest FANUC generic file and FYI; trying to change to something else than "Flood" dosen't work in that either and another thing that doesn't work are SubPrograms in separate files. Everything stays in a very big single file instead of subprograms in separate files.

 

Thanks for your help,

Anders

@boopathi.sivakumar 

Anders T
0 Likes

andersEQHR7
Contributor
Contributor

I am sorry to report that this suggestion didn't work, I got 4 fault in a long log file.
I think that I will give it up for now and change the M-code manual instead, much faster.

I also tested the newest FANUC generic file and FYI; trying to change to something else than "Flood" doesn't work in that either and another thing that doesn't work are SubPrograms in separate files. Everything stays in a very big single file instead of subprograms in separate files.

 

Thanks for your help,

Anders

@boopathi.sivakumar 

Anders T
0 Likes

boopathi.sivakumar
Autodesk
Autodesk

Hi @andersEQHR7 

It is working fine at my end.. probably you might missed something while copy paste stuff 

temp1.png

if you could attach the modified cps i can able see what you have made

also FYI the generic post looks bit different than yours.. it seems you are using heavily modified post


Boopathi Sivakumar
Senior Technology Consultant

0 Likes

andersEQHR7
Contributor
Contributor

Strange, here it do not work.

Attached log and cps

 

@boopathi.sivakumar 

Anders T
0 Likes

boopathi.sivakumar
Autodesk
Autodesk

@andersEQHR7 

missed the setCoolant function 

copy and paste this code above

function getCoolantCodes(coolant{
function setCoolant(coolant) {
  var coolantCodes = getCoolantCodes(coolant);
  if (Array.isArray(coolantCodes)) {
    if (singleLineCoolant) {
      writeBlock(coolantCodes.join(getWordSeparator()));
    } else {
      for (var c in coolantCodes) {
        writeBlock(coolantCodes[c]);
      }
    }
    return undefined;
  }
  return coolantCodes;
}

now it should work fine

also if you want to post M11 for through coolant then

{id: COOLANT_THROUGH_TOOL, on: 88, off: 89},

 you might need to change this to

{id: COOLANT_THROUGH_TOOL, on: 11, off: 9},

 like wise you can give the required code in the top


Boopathi Sivakumar
Senior Technology Consultant

0 Likes

andersEQHR7
Contributor
Contributor

No luck this time, log file attached

 

@boopathi.sivakumar 

Anders T
0 Likes

boopathi.sivakumar
Autodesk
Autodesk

did you added the function  setCoolant(coolant) 

as mentioned in the previous thread ? seems like you haven't added the codes also save the post after modification if not working attach the cps file as well

 


Boopathi Sivakumar
Senior Technology Consultant

0 Likes

andersEQHR7
Contributor
Contributor

Made a mistake used wrong version of cps. 😞

Code is copied into the cps as you described and it is working except for the "Through tool" still generates M08 instead of M11 tool

 

Anders

 

@boopathi.sivakumar 

Anders T
0 Likes

boopathi.sivakumar
Autodesk
Autodesk

coolant.png

I can still see in the nc you are using flood kindly check in the operation you have used right coolant.
else share the .f3d file

File>Export>.F3d
save the file and reattach the file to this thread.


Boopathi Sivakumar
Senior Technology Consultant

0 Likes

andersEQHR7
Contributor
Contributor
Accepted solution

Got it to work now, my 2:nd mistake. 😞
didn't realize that I needed to change in 2 places in Fusion 360.

Now I got M11 as it should 🙂

 

Thank you for all of your help.

 

B.R.

Anders Tjernström

Anders T
0 Likes