Community
Fusion Manufacture
Talk shop with the Fusion (formerly Fusion 360) Manufacture Community. Share tool strategies, tips, get advice and solve problems together with the best minds in the industry.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Haas G187

12 REPLIES 12
Reply
Message 1 of 13
Don.Cyr
1812 Views, 12 Replies

Haas G187

Good morning,

Using the latest NGC post, I have been trying to use the built-in G187 option for individual toolpaths. I see the function definition in the post, but think it can/could be defined differently to further correspond with the type of toolpath and the tolerance associated with it, also to default to "1" for adaptive clearing. I have changed some of the code in my post and it seems to work but possibly someone can further improve on it and incorporate it into the stock Autodesk post?

The stock Autodesk post is setup to currently use "Stock to leave" to set the "P" variable but toolpath tolerance in my opinion is better suited to define the 'P" variable and also include the toolpath tolerance in the "E" value.

 
function writeG187() {
  if (hasParameter("operation-strategy") && (getParameter("operation-strategy") == "drill")) {
    writeBlock(gFormat.format(187)); // reset G187 setting to machine default
  } else if (hasParameter("operation:tolerance")) {
    var tolerance = Math.max(getParameter("operation:tolerance"), 0);
    if (tolerance > 0) {
      var stockToLeaveThreshold = toUnit(0.02MM);
      var stockToLeave = 0;
      var verticalStockToLeave = 0;
      if (hasParameter("operation:stockToLeave")) {
        stockToLeave = xyzFormat.getResultingValue(getParameter("operation:stockToLeave"));
      }
      if (hasParameter("operation:verticalStockToLeave")) {
        verticalStockToLeave = xyzFormat.getResultingValue(getParameter("operation:verticalStockToLeave"));
      }

      var workMode;
      if (((stockToLeave > stockToLeaveThreshold) && (verticalStockToLeave > stockToLeaveThreshold)) ||
       (hasParameter("operation:strategy") && getParameter("operation:strategy") == "adaptive2d")) {
        workMode = 1// roughing
      } else {
        if (tolerance <.0005) {
          workMode = 3.// fine
        } else {
          workMode = 2// default
        }
      }
      //writeBlock(gFormat.format(187), "P" + workMode); // set tolerance mode
      writeBlock(gFormat.format(187), "P" + workMode"E" + xyzFormat.format(tolerance)); // set tolerance mode
    } else {
      writeBlock(gFormat.format(187)); // reset G187 setting to machine default
    }
  } else {
    writeBlock(gFormat.format(187)); // reset G187 setting to machine default
  }
}
 
 
Please click "Accept Solution" if I helped with your question or issue.
12 REPLIES 12
Message 2 of 13
Tomek.G
in reply to: Don.Cyr

Hi @Don.Cyr,

 

Haas post was updated last week, and now the smoothing logic looks different.
It should be easier to customize it, but by default autoLevelCriteria use stock to determine levels.
I invite you to test it.

 

 


Tomek.G
Sr. Technical Consultant
Message 3 of 13
Don.Cyr
in reply to: Don.Cyr

Hello @Tomek.G,

Definitely an improvement, maybe a couple adjustments.. The drop-down dialog in the post process screen should either be "Automatic" or "off" and the individual operation drive the smoothing (G187 value).

I tested it out and on features with the listed tolerance and stock allowance got these results:

.0005 tolerance, .005 axial and radial stock to leave- G187 P3

.0004 tolerance, .005 radial / 0 axial stock to leave G187 P2

.004 tolerance, .005 axial and radial stock to leave G187 P3

Seems to be calculating in the wrong direction. 

 

There are 3 modes of smoothing in the Haas control, but the post has logic for 4. 

roughing: 1, // roughing level for smoothing in automatic mode
semi: 3, // semi-roughing level for smoothing in automatic mode
semifinishing: 0, // semi-finishing level for smoothing in automatic mode
finishing: 2, // finishing level for smoothing in automatic mode

semifinishing and finishing are the same smoothing level but post code differently..

semifinishing: 0, posts G187 / finishing: 2, posts G187 P2 *same smoothing level in control*

(maybe eliminate 1 of these?)

 

Also in the post, there is this line:

else { // do not output smoothing for the following operations
    smoothing.isAllowed = !(currentSection.getTool().type == TOOL_PROBE || currentSection.checkGroup(STRATEGY_DRILLING));
  }
 
At the beginning of a probing or drill cycle it should output "G187" to reset machine to default.. it was in the old post:
if (hasParameter("operation-strategy") && (getParameter("operation-strategy") == "drill")) {
    writeBlock(gFormat.format(187)); // reset G187 setting to machine default.
 
I will change a few things here with my post to get it closer to what I would like to see and hopefully my input helps.

 

Please click "Accept Solution" if I helped with your question or issue.
Message 4 of 13
bob.schultz
in reply to: Don.Cyr

Hello @Don.Cyr,

 

A new version of the Haas post is now available in the online Post Library that has the correct settings for the Roughing through Finishing levels when the Automatic smoothing level is enabled.  We also verified the issue with G187 not being output with a drilling cycle and this will be fixed in the next release of the Haas post processors.  You can make the following changes to the post to resolve this issue in your post.

 

First in the onSection function make the following change ...

if (insertToolCall || operationNeedsSafeStart) {
    // <<< CHANGE THE SECOND REFERENCE to 'isActive' to 'isAllowed'.
    smoothing.isActive = !smoothing.isAllowed; // force smoothing on tool changes
  }

 

Next in the setSmoothing function, find this code ...

  if (mode) { // enable smoothing
    writeBlock(gFormat.format(187), conditional((smoothing.level != 0), "P" + smoothing.level));
  }

... and change it to look like this ...

  if (mode) { // enable smoothing
    writeBlock(
      gFormat.format(187),
      conditional((smoothing.level != 0), "P" + smoothing.level),
      conditional((smoothingSettings.differenceCriteria != "level"), "E" + xyzFormat.format(smoothing.tolerance))
    );
  } else {
    writeBlock(gFormat.format(187));
  }

This modification will also allow for you to output the tolerance value in the G187 block.  You can enable the E-value output by making the following modification in your post.

  // <<< CHANGE "level" to "both"
  // differenceCriteria: "level", // options: "level", "tolerance", "both". Specifies criteria when output smoothing codes
  differenceCriteria: "both", // options: "level", "tolerance", "both". Specifies criteria when output smoothing codes

It is also possible to add support for changing the smoothing level on an operation-to-operation basis.  This can be done by either making the useSmoothing property an operation property or by adding support for a Manual NC command.  If you would like to pursue this capability, then let me know and I can show you the necessary modifications.



Bob Schultz
Sr. Post Processor Developer

Message 5 of 13
CNC_Lee
in reply to: bob.schultz

I'm interested in pursuing this capability Bob, Please share the required details!
Thank you
If my post answers your question, please use Accept as Solution.

CNC Lee
Fusion 360 CAM Post Processor Expert
https://linktr.ee/cnclee
Message 6 of 13
dmealer
in reply to: Don.Cyr

I have a question on this subject.

Would it be feasible to allow you to pick what  what level of G187 you wish to use with each operation with a simple drop down box with choices instead of relying on Logic to pick the correct one for you?

Message 7 of 13
bob.schultz
in reply to: CNC_Lee

Hello @CNC_Lee,

 

The simplest method for implementing per-operation smoothing control is to define the useSmoothing property as an operation property.

 

  useSmoothing: {
    title      : "Use G187",
    description: "G187 smoothing mode.",
    type       : "enum",
    group      : 1,
    values     : [
      {title:"Off", id:"-1"},
      {title:"Automatic", id:"9999"},
      {title:"Rough", id:"1"},
      {title:"Medium", id:"2"},
      {title:"Finish", id:"3"}
    ],
    value: "-1",
    scope: ["post", "operation"] // <<< MODIFY THIS LINE
  },

 

The caveats using this method is that you must assign a Machine Configuration to the Setup to see the property in the operations AND you will need to set the smoothing level in each operation.  Operations will be assigned the default value when created.

 

bobschultz_0-1641486108996.png

 

@dmealer operation properties display the same drop down list as post properties.

 

The second option is to add a Manual NC command that will override the default smoothing level (as defined in the Property Table) for the following operation.  You can make the following changes to the post to support the Manual NC command useG187 action command.  Please note that you CANNOT use both an operation property and Manual NC command in the same post.

 

bobschultz_1-1641486467196.png

 

In the onOpen function add the following command.

 

function onOpen() {
  useSmoothingSave = getProperty("useSmoothing"); // <<< ADD THIS LINE

 

In the onManualNC function, add the following code.

 

    } else if (String(value).toUpperCase() == "USEPOLARMODE") {
      usePolarMode = true;
    } else { // << ADD THIS IF-BLOCK CODE
      var sText1 = String(value);
      var sText2 = new Array();
      sText2 = sText1.split(":");
      if (sText2.length != 2) {
        error(localize("Invalid action command: ") + value);
        return;
      }
      if (sText2[0].toUpperCase() == "USEG187") {
        var temp = parseToggle(sText2[1], "OFF", "AUTOMATIC", "ROUGH", "MEDIUM", "FINISH");
        var settings = ["-1", "9999", "1", "2", "3"];
        if (temp == undefined) {
          error(localize("UseG187 must be Off, Automatic, Rough, Medium, or Finish"));
          return;
        }
        setProperty("useSmoothing", settings[temp]);
      }
    }

 

Add the parseToggle function in its entirety.

 

function parseToggle() {
  var stat = undefined;
  for (i = 1; i < arguments.length; i++) {
    if (String(arguments[0]).toUpperCase() == String(arguments[i]).toUpperCase()) {
      if (String(arguments[i]).toUpperCase() == "YES") {
        stat = true;
      } else if (String(arguments[i]).toUpperCase() == "NO") {
        stat = false;
      } else {
        stat = i - 1;
        break;
      }
    }
  }
  return stat;
}

 

And finally, add the following line to onSectionEnd.

 

function onSectionEnd() {
  setProperty("useSmoothing", useSmoothingSave); // <<< ADD THIS LINE

 

Now you can add the useG187 Manual NC command above any operation where you want to override the setting defined in the post properties.

 

bobschultz_2-1641486798381.png

 



Bob Schultz
Sr. Post Processor Developer

Message 8 of 13
CNC_Lee
in reply to: Don.Cyr

Thanks Bob, I will give it a go! 

If my post answers your question, please use Accept as Solution.

CNC Lee
Fusion 360 CAM Post Processor Expert
https://linktr.ee/cnclee
Message 9 of 13
nuptid5
in reply to: CNC_Lee

How do you get the "E" to show up with the G187?

Message 10 of 13
bob.schultz
in reply to: nuptid5

Hello @nuptid5,

 

Inside of the post processor, change the differenceCriteria variable to "both" to get the E-value output in the G187 block.

bobschultz_1-1662491742785.png

 

 



Bob Schultz
Sr. Post Processor Developer

Message 11 of 13
boggsjon141
in reply to: bob.schultz

Good afternoon @bob.schultz 

 

I was wondering if it is possible to set an E value inside the operations properties. This code works for setting the smoothing using the usual levels, and I have changed it so that E values are automatically added, by setting

 

differenceCriteria: "both", // options: "level", "tolerance", "both". Specifies criteria when output smoothing codes

 

 

  useSmoothing: {
    title      : "Use G187",
    description: "G187 smoothing mode.",
    group      : "preferences",
    type       : "enum",
    values     : [
      {title:"Off", id:"-1"},
      {title:"Automatic", id:"9999"},
      {title:"Rough", id:"1"},
      {title:"Medium", id:"2"},
      {title:"Finish", id:"3"}
    ],
    value: "-1",
    scope: ["post", "operation"],
  },
 
I would like to be able to define an E value under, the smoothing levels in the operation properties. Thank you!
Message 12 of 13
bob.schultz
in reply to: boggsjon141

Hello @boggsjon141 ,

 

You can add a property to specify the E-tolerance value for G187 smoothing, but you cannot use the useSmoothing property as this is used to define the P-level for smoothing.

 

To support a user defined smoothing tolerance, add the following property to the post.

  smoothingTolerance: {
    title      : "Smoothing tolerance",
    description: "Specifies the tolerance (E) for smoothing blocks (G187).",
    group      : "preferences",
    type       : "spatial",
    value      : 0,
    scope      : "post"
  },

 

And change the following line in the setSmoothing function ...

conditional((smoothingSettings.differenceCriteria != "level"), "E" + xyzFormat.format(smoothing.tolerance))

 

... to look like this ...

    conditional((smoothingSettings.differenceCriteria != "level"), "E" + xyzFormat.format(getProperty("smoothingTolerance") ? getProperty("smoothingTolerance") : smoothing.tolerance))

 

Setting the property to 0 (default) will use the internally calculated tolerance and setting it to non-zero will use the property value.



Bob Schultz
Sr. Post Processor Developer

Message 13 of 13
boggsjon141
in reply to: bob.schultz

Thank you so much for that! Works awesome.

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report