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.
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:
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.
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?
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.
@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.
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.
Thanks Bob, I will give it a go!
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
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.
Can't find what you're looking for? Ask the community or share your knowledge.