Improved handling of Manual NC commands
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
The new entry function onManualNC has been added to the post processor kernel in the latest version of Fusion, allowing for a single point of entry for handling Manual NC commands. When the onManualNC function is defined in your post processor, this function will be called for all Manual NC commands, rather than the method of calling different entry functions (onCommand, onPassthrough, onParameter, etc.). If this function is not defined, then the standard method will be used, as it currently is in all generic post processors, so existing post processors do not have to be updated.
A helper function, expandManualNC, has also been added. This function is not defined in the post processor, but rather is called to process a Manual NC command using the standard methods as described above. Both of these functions are passed the command and value for the Manual NC command.
function onManualNC(command, value) expandManualNC(command, value)
The following example shows how the Display message Manual NC command can be processed in the onManualNC function and all other commands in their normal functions.
function onManualNC(command, value) { switch (command) { case COMMAND_DISPLAY_MESSAGE: // prepend ‘MSG,’ to operator messages writeComment("MSG, " + value); break; default: expandManualNC(command, value); // normal processing of Manual NC command } }
Another benefit of these functions is the ability to buffer the Manual NC commands and output them wherever you desire in the program, rather than always prior to the onSection call. You do this by adding the following code to your post processor.
/** Buffer Manual NC commands for processing later */ var manualNC = []; function onManualNC(command, value) { manualNC.push({command:command, value:value}); } /** Processes the Manual NC commands Pass the desired command to process or leave argument list blank to process all buffered commands */ function executeManualNC(command) { for (var i = 0; i < manualNC.length; ++i) { if (!command || (command == manualNC[i].command)) { switch(manualNC[i].command) { /* case COMMAND_DISPLAY_MESSAGE: // sample on explicit execution of Manual NC command writeComment("MSG, " + manualNC[i].value); break;*/ default: expandManualNC(manualNC[i].command, manualNC[i].value); } } } for (var i = 0; i < manualNC.length; ++i) { if (!command || (command == manualNC[i].command)) { manualNC.splice(i, 1); } } }
You can now call the executeManualNC command wherever you want the Manual NC commands to be output, simply by calling it with a parameter to specify which command you want processed at this time, or with a blank argument to process all buffered Manual NC commands. The following example will output the Display message command prior to the tool change block and all other commands after the tool change block.
executeManualNC(COMMAND_DISPLAY_MESSAGE); // display Manual NC messages writeBlock("T" + toolFormat.format(tool.number), mFormat.format(6)); if (tool.comment) { writeComment(tool.comment); } executeManualNC(); // process remaining Manual NC commands

Bob Schultz
Sr. Post Processor Developer