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!