Good day everyone,
Is there any way to output some text at the very start of the program with PostBuilder?
UDE is one of the most straight forward answers, however, UDE will only be executed after "Start of Program" has been finished. For example, as the following pic shows:
if a UDE, say "Operator Message" is programmed, the message will then be shown AFTER the line G40 G17 G90 G71, like these:
% N0010 G40 G17 G90 G71 N0020 (This is a test program) N0030 G91 G28 Z0.0 N0040 T01 M06 N0050 T02 N0060 G00 G90 X50. Y50. S0 M03 N0070 G43 Z53. H01 N0080 G82 Z50. R53. F250. N0090 G80
What I want is this:
% N0010 (This is a test program) N0020 G40 G17 G90 G71 N0030 G91 G28 Z0.0 N0040 T01 M06 N0050 T02 N0060 G00 G90 X50. Y50. S0 M03 N0070 G43 Z53. H01 N0080 G82 Z50. R53. F250. N0090 G80
Thanks in advance
Solved! Go to Solution.
If you attach the ude to the NC_PROGRAM then it will come out first thing. However it will come out every program group.
What I ended up doing however was split the output into 2 different files and combined them at the end of posting. Then I can run through the whole program and collect data to put at the end of the header file I created.
I guess the issue I was running into was I wanted to output code after my program header and I coudln't get it to go in the right spot. I just have found it nice to output 2 seperate files (or more) so you have total control over what code goes where.
I like to open the file after posting (MOM_end_of_program) and replace stuff (with pointer lines written at post time.) A tool list at the top of the program is an example of this. The problem with this approach (I have realized lately) is that with sync manager and with ISV - the changes made this way are not considered. When I do it - I read the file into an array - look for my pointers - replace with whatever - and dump out the array with the new lines back into the file. I have also taken the approach of not writing anything to a file at post time (override MOM_before_output) and fill an array. There are a few approaches possible - but all have their problems.
You could assign the “text” to the program group as an attribute
Check out mom_attr_PROGRAMVIEW_<name> from the MOM Variables Browser in PB
This can be read at the start of program
I have seen this done to get a program ID out at the start
Or you could assign the attributes to the part itself (File -> Properties -> Attributes tab)
post variable = mom_attr_PART_*
If you want something in START OF PROGRAM you are pretty much stuck with attributes - UDEs get triggered too late to be of help in THAT event. See docs:
CAM (or "Manufacturing" ) -> NX Post -> Post Concepts -> Order of events
UDEs attached to NC_PROGRAM _may_ get triggered early enough for you to output data AFTER "start of program" and before anything else gets output by the post (or maybe not). But their data will NOT be available in "Start of program"
Production: NX10.0.3.5 MP16/TC11.2
I'd rather be e-steamed than e-diseaseled
Good advice on "attribute". This should accomplish the current goal. But come to think about it, if the texts require information that will be grabbed from the program intelligently, this method could be somewhat unsuitable.
For example, I want to output a toollist using the predefined PB_CMD_create_toollist in front of the line G40 G90 G17 G71 in my Start Of Program and I want the toollist output to be controllable, meaning an NC programmer can choose either to output a toollist or not inside NX.