Is it possible to change the value of programName from inside the post-processor ?

Is it possible to change the value of programName from inside the post-processor ?

bernard5BABD
Advocate Advocate
271 Views
4 Replies
Message 1 of 5

Is it possible to change the value of programName from inside the post-processor ?

bernard5BABD
Advocate
Advocate

To say it differently how could I use the value of the parameter "document-path" to make it the program filename? Is it possible, and if yes, how?

Thanks for your help.
Bernard

Bernard Grosperrin, Retired, Maker, and Autodesk Certified Instructor
Blog : Le Bear CNC | Forum : Le Bear CNC Forum | Addin : Airfoil Sketch from file
0 Likes
272 Views
4 Replies
Replies (4)
Message 2 of 5

componentscience
Advocate
Advocate

Have you tried adding something like: getParameter("document-path") somewhere in the 'programName' logic? Also 'programName' is often required to be an integer so we can assume 'document-path' would have to be the same, depending on the machine.

If you feel your question was answered, please accept it as a solution. Thanks!
0 Likes
Message 3 of 5

bernard5BABD
Advocate
Advocate

Sorry, I am not sure to understand what you mean by "programName logic" ???


@componentscience wrote:

Also 'programName' is often required to be an integer so we can assume 'document-path' would have to be the same, depending on the machine.




Hum this is totally wrong , sorry. They have absolutely nothing to do with one another. programName is the name given to the NC file from within the post-processor dialog, while document-path is the name of the fusion 360 document.

Bernard Grosperrin, Retired, Maker, and Autodesk Certified Instructor
Blog : Le Bear CNC | Forum : Le Bear CNC Forum | Addin : Airfoil Sketch from file
0 Likes
Message 4 of 5

componentscience
Advocate
Advocate

Your question asks if it is possible to assign the value of 'document-path' to the program filename (the NC file). The name of the NC file typically filters through some logic as shown in a Fanuc post below. It is assumed that somewhere in this logic, or by creating some similar logic, you could parse the value of 'document-path', and assign it to programName.

 

However some machines require that the name of the NC file is an integer or some specific format, or else it won't run on the machine. The Fusion document would have match whatever format the machine requires if it is being used to name the program file.

 

 

 

Fanuc post programName formatting:

 

 

 

  if (programName) {
    var programId;
    try {
      programId = getAsInt(programName);
    } catch (e) {
      error(localize("Program name must be a number."));
      return;
    }
    if (getProperty("o8")) {
      if (!((programId >= 1) && (programId <= 99999999))) {
        error(localize("Program number is out of range."));
        return;
      }
    } else {
      if (!((programId >= 1) && (programId <= 9999))) {
        error(localize("Program number is out of range."));
        return;
      }
    }
    if ((programId >= 8000) && (programId <= 9999)) {
      warning(localize("Program number is reserved by tool builder."));
    }
    oFormat = createFormat({width:(getProperty("o8") ? 8 : 4), zeropad:true, decimals:0});
    if (programComment) {
      writeln("O" + oFormat.format(programId) + " (" + filterText(String(programComment).toUpperCase(), permittedCommentChars) + ")");
    } else {
      writeln("O" + oFormat.format(programId));
    }
    lastSubprogram = programId;
  } else {
    error(localize("Program name has not been specified."));
    return;
  }

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

If you feel your question was answered, please accept it as a solution. Thanks!
0 Likes
Message 5 of 5

bernard5BABD
Advocate
Advocate

I am sorry, I know you are doing your best to try to help, but I am afraid you are ending up wasting your time, and mine.

The post-processor I am working on is not for "some machine", but for a very specific one. You don't need to copy and paste code from the Processor Training Guide. I have it, printed it, and sleep with it... (OK, the last part is not really true... 🙂 )

 

This machine does not require at all to have a number as program name (which is a pretty bad practice no modern machine should need), so, when I ask how to change the value of programName for another string of characters, I know why.


Bernard Grosperrin, Retired, Maker, and Autodesk Certified Instructor
Blog : Le Bear CNC | Forum : Le Bear CNC Forum | Addin : Airfoil Sketch from file
0 Likes