Announcements

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

Modifying A Post Processor - File Name

Anonymous

Modifying A Post Processor - File Name

Anonymous
Not applicable

Hi guys,

 

I'm taking the generic Fanuc Milling post and making some tweaks.  I want the posted filename to have the extension .fgc, for my Flashcut controller.  I also want to allow the filenames to be text.  I've done this change on a Haas post before and it worked fine.

 

extension = "fgc"; //wd Flashcut extension
programNameIsInteger = false; //wd allow non number file name
setCodePage("ascii");

 

When I post it gives me an error:  Filename is not a number.  Any idea why this doesn't work?

 

Thanks,

Walt

0 Likes
Reply
Accepted solutions (2)
1,985 Views
10 Replies
Replies (10)

LibertyMachine
Mentor
Mentor

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.
0 Likes

Anonymous
Not applicable
Thanks for the reply, but this is not what I'm trying to do. My control is
not limited by the fanuc rules. For example, I the name of my file to be
test-part.fgc. I don't need any other special requirements.

I don't need the name and comments to populate from the program, I can type
in the name when I post the code.

Walt
0 Likes

Anonymous
Not applicable
Thanks for the reply, but this is not what I'm trying to do. My control is
not limited by the fanuc rules. For example, I the name of my file to be
test-part.fgc. I don't need any other special requirements.

I don't need the name and comments to populate from the program, I can type
in the name when I post the code.

Walt
0 Likes

LibertyMachine
Mentor
Mentor

All right, I figured out what you need to do. Do you still start your programs with the "O" followed by text?


Seth Madore
Owner, Liberty Machine, Inc.
Good. Fast. Cheap. Pick two.
0 Likes

Anonymous
Not applicable

No, I don't use the O numbering scheme at all.  Examples:

 

2016-11-16_baseplate.fgc

testcut.fgc

Joes_part.fgc

 

I just name the files as needed.

 

Thanks,

Walt

 

 

0 Likes

LibertyMachine
Mentor
Mentor
Accepted solution

Give this a shot then;

First, change the true to false like you originally did.

Next, find this section of code:

 

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;
  }

And change it to this:

 

if (programName) {
var programId = programName;
if (programComment) {
writeln(programId + " " + formatComment(programComment));
} else {
writeln(programId);
}
} else {
error(localize("Program name has not been specified."));
return;
}

Seth Madore
Owner, Liberty Machine, Inc.
Good. Fast. Cheap. Pick two.
1 Like

Anonymous
Not applicable

Outstanding.  Thank you very much Seth.

 

Walt

0 Likes

Anonymous
Not applicable

Seth,

 

Sorry to pester you, but I tested the code, and it works, mostly.    This is what I get at the top of the program:

 

%
2016_lever-10
(T3 D=3. CR=0. - ZMIN=0. - FACE MILL)
(T6 D=0.375 CR=0. TAPER=45DEG - ZMIN=-0.04 - CHAMFER MILL)

I can't figure out how to place the program name in parentheses, (2016_lever-10).

 

Thanks,

Walt

 

 

0 Likes

LibertyMachine
Mentor
Mentor
Accepted solution

Well, this is where it gets even more basic than what I previously posted.

 

The code above:

 if (programName) {
var programId = programName;
if (programComment) {
writeln(programName + " " + formatComment(programComment));
} else {
writeln(programName);
}
} else {
error(localize("Program name has not been specified."));
return;
}

 

 

Change it to:

 if (programName) {
    writeComment(programName);
  }
  if (programComment) {
    writeComment(programComment);
  }

This will give you:

(PROGRAM)

(COMMENT)


Seth Madore
Owner, Liberty Machine, Inc.
Good. Fast. Cheap. Pick two.
2 Likes

Anonymous
Not applicable

Thanks again Seth, much appreciated.

 

Walt

0 Likes