mom_definition_file_name will output the name of the .def file. This is the post name but it comes with the full path name as well as the extension.
To parse out just the file name:
# Strip path and extension from post name
set full_postname [file rootname $mom_definition_file_name]
set post_filename [lindex [file split $full_postname] end]
MOM_output_literal "(POST NAME = $post_filename)"
Hope this helps.
We also add the programmers name to the header of the program
MOM_output_literal "([string toupper $mom_date])"
MOM_output_literal "(UGPOST NAME: [ string toupper $postname])"
MOM_output_literal "(CREATED BY : [ string toupper $mom_logname])"
this does two things. Lets the operator know who to go see with a question and lets other programmers know who last touched the program.
Yes. We have that in the programs already. I wasn't trying to output the post name in the program. What I was trying to accomplish, was, we have around 15-20 different postprocessors and I have created multiple custom commands to output various things such as, Part Name, Program Name, Programmer, Machine Time, and Program Travel/Smallest Machine, and because of the number of posts if any of these needed to be updated, I was having to go into each post and update separately. So, of course, I got tired of this pretty quickly, so I decided to migrate all my commands to a Source file that each post looks to. Where I got into trouble was, for all of our 3-axis machines we have one post, the rest are machine specific, and in the Program Travel/Smallest Machine command, I had two versions,one that would output the smallest machine capable of running the program based on program travel and one that was for the machine specific posts that output the only Machine it would work on and Program Travel so that operators would know if it would overtravel based on where they placed it on the table. So in order to know which Program Travel command to use I had to be able to tell the commands that if it was not being posted by the 3-axis post, to not include the smallest machine part of the command. Which ended up working perfectly with George's help.
Sorry that's a little long winded. lol.
Production: NX10.0.3.5, Vericut 7.4.1, ICAM V21
Development: VB.NET, Tcl/Tk