I wanted to do something similar to you. In the Program section I wanted to type text; in this case it was Customer name, part number, rev level and op: Acme widget123, rev-a Op1
and in the comment section I would have the program number which would output after the % sign.
How I got there (in addition to programNameIsInteger = false;)
:
Original:
sequenceNumber = properties.sequenceNumberStart;
writeln("%");
if (programName) {
var programId;
try {
programId = getAsInt(programName);
} catch(e) {
error(localize("Program name must be a number."));
return;
}
if (properties.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."));
}
var oFormat = createFormat({width:(properties.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));
}
} else {
error(localize("Program name has not been specified."));
return;
}
Modified:
writeln("%");
if (programComment) {
var programId;
try {
programId = getAsInt(programComment);
} catch(e) {
error(localize("Program name must be a number."));
return;
}
if (properties.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."));
}
var oFormat = createFormat({width:(properties.o8 ? 8 : 4), zeropad:true, decimals:0});
if (programName) {
writeln("O" + oFormat.format(programId) + " (" + filterText(String(programName).toUpperCase(), permittedCommentChars) + ")");
} else {
writeln("O" + oFormat.format(programId));
}
} else {
error(localize("Program name has not been specified."));
return;
}
I inverted the programComment/programName locations.
This allowed me to save the file as a lettered description and still retain a numbering system for the machine to recognize
Does that help you any?
Seth Madore
Owner, Liberty Machine, Inc.
Good. Fast. Cheap. Pick two.