Community
HSM Post Processor Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Post Processor Coolant - Here is how to support additional coolant modes

3 REPLIES 3
Reply
Message 1 of 4
charles
4019 Views, 3 Replies

Post Processor Coolant - Here is how to support additional coolant modes

Here are the coolant modes and their corresponding post integer values (switch values):
0=Disabled
1=Flood
2=Mist
3=Through Tool
4=Air
5=Air Through Tool
6=Suction
7=Flood and Mist

In the post (pst) file, find the "var mapCoolantTable" line.
Simply place the coolant code to output, in sequence with the corresponding switch value. Insert null if the code is not supported between codes which are supported.
For example, to support the following coolant codes:
0= Disabled (M09)
1=Flood (M08)
2=Mist (Not supported=null)
3=Through Tool (M51)
4=Air (M7)

Atter the post line (second line) as follow:

var mapCoolantTable = new Table(
 [9, 8, null, 51, 7],
 {initial:COOLANT_OFF, force:true},
 "Invalid coolant mode"
);

Note:
M9=Off (Switch=0), M8=Flood (Switch=1), null = Mist (Switch =2), M51=Through Tool (Switch=3), M7=Air (Switch=4)

For Switch Value that are higher than those supported by the machine, you do not need to enter NULL as a placeholder. In this case for example for switch value>4, (Air Through Tool, etc) there is no need to enter null.
3 REPLIES 3
Message 2 of 4
charles
in reply to: charles

Here is some code that shows how to turn off Coolant if the machine has multiple coolant Off codes.

var currentCoolantMode = COOLANT_OFF;

function setCoolant(coolant) {
  if (coolant == currentCoolantMode) {
    return; // coolant is already active
  }

  if (coolant == COOLANT_OFF) {
    if (currentCoolantMode == COOLANT_THROUGH_TOOL) {
      m = 89;
    } else if (currentCoolantMode == COOLANT_AIR) {
      m = 84;
  } else if (currentCoolantMode == COOLANT_MIST) {
      m = 11;
    } else {
      m = 9;
    }
    writeBlock(mFormat.format(m));
    currentCoolantMode = COOLANT_OFF;
    return;
  }

  if (currentCoolantMode != COOLANT_OFF) {
    setCoolant(COOLANT_OFF);
  }

var m = undefined;
  switch (coolant) {
  //case COOLANT_OFF:
  case COOLANT_FLOOD:
    m = 8;
    break;
  //case COOLANT_MIST:
  case COOLANT_MIST:
    m = 10;
    break;
  case COOLANT_AIR:
    m = 83;
    break;
  //case COOLANT_AIR_THROUGH_TOOL:
  default:
    warning(localize("Coolant not supported."));
    if (currentCoolantMode == COOLANT_OFF) {
      return;
    }
    coolant = COOLANT_OFF;
    m = 9;
  }

  writeBlock(mFormat.format(m));
  currentCoolantMode = coolant;
}
Message 3 of 4
charles
in reply to: charles

Some machines require multiple coolant on/off codes.

For example, Flood and Through Tool might require two M-codes on separate lines:
M51 (Coolant Through Tool)
M8 (Flood)

The machine will also require two separate M-codes to turn coolant Off
M50 (Coolant Through Tool Off)
M9 (Flood Off)

You can ammend the code in the previous post slightly to accomplish this.
if (currentCoolantMode == COOLANT_THROUGH_TOOL) {
writeBlock("M51");
writeBlock(M8");
} else if {

Then take out the line:
writeBlock(mFormat.format(m)); because you are writing the M-codes as a string rather than outputting them with the (m) variable.

I can't see to find a complete list of all currentCoolantMode values and their switch value. Here are the ones I know:
0=COOLANT_OFF
1=COOLANT_FLOOD
2=COOLANT_MIST
3=COOLANT_THROUGH_TOOL
4=COOLANT_AIR
5=COOLANT_AIR_THROUGH_TOOL
6=COOLANT_SUCTION
7=COOLANT_FLOOD_MIST
8=COOLANT_FLOOD_THROUGH_TOOL

Message 4 of 4
travis
in reply to: charles

I've just started running air blast a bit (M50) and it's triggering on just fine with my post - but i need it to give an M09 before i switch to flood, or it will just leave the air blast running as well. how would i achieve that? here's my coolant section in my post.

 

var currentCoolantMode = COOLANT_OFF;

function setCoolant(coolant) {
  if (coolant == currentCoolantMode) {
    return; // coolant is already active
  }
  
  if (coolant == COOLANT_OFF) {
    writeBlock(mFormat.format((currentCoolantMode == COOLANT_THROUGH_TOOL) ? 89 : 9));
    currentCoolantMode = COOLANT_OFF;
    return;
  }

  var m;
  switch (coolant) {
  case COOLANT_FLOOD:
    m = 8;
    break;
  case COOLANT_AIR:
    m = 50;
    break;
  default:
    onUnsupportedCoolant(coolant);
    m = 9;
  }
  
  if (m) {
    writeBlock(mFormat.format(m));
    currentCoolantMode = coolant;
  }
}

var mapCommand = {
  COMMAND_STOP:0,
  COMMAND_OPTIONAL_STOP:1,
  COMMAND_END:2,
  COMMAND_SPINDLE_CLOCKWISE:3,
  COMMAND_SPINDLE_COUNTERCLOCKWISE:4,
  COMMAND_STOP_SPINDLE:5,
  COMMAND_ORIENTATE_SPINDLE:19,
  COMMAND_CLEAN:0
};

function onCommand(command) {
  switch (command) {
  case COMMAND_COOLANT_OFF:
    setCoolant(COOLANT_OFF);
    return;
  case COMMAND_COOLANT_ON:
    setCoolant(COOLANT_FLOOD);
    return;
  case COMMAND_STOP:
    writeBlock(mFormat.format(0));
    forceSpindleSpeed = true;
    return;
  case COMMAND_START_SPINDLE:
    onCommand(tool.clockwise ? COMMAND_SPINDLE_CLOCKWISE : COMMAND_SPINDLE_COUNTERCLOCKWISE);
    return;
  case COMMAND_LOCK_MULTI_AXIS:
    return;
  case COMMAND_UNLOCK_MULTI_AXIS:
    return;
  case COMMAND_START_CHIP_TRANSPORT:
    return;
  case COMMAND_STOP_CHIP_TRANSPORT:
    return;
  case COMMAND_BREAK_CONTROL:
    return;
  case COMMAND_TOOL_MEASURE:
    return;

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report