Cancel
Showing results for 
Search instead for 
Did you mean: 

In postbuilder, what variables should I use to skip the program group if the program group is empty?

Genius
Genius

If I have an empty group in the total group, and I want to skip it and continue to the rest programming.

I have the option to Generate Group Output turned on!

8 REPLIES 8

Re: In postbuilder, what variables should I use to skip the program group if the program group is em

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

Use review to tool to find variables. * if there is any for this case at all..

---------------------------------------------
#♫ PB, 5ax, itnc, nx, vericut ♫ #
Highlighted

Re: In postbuilder, what variables should I use to skip the program group if the program group is em

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

The problem is that when you are in the "start of group" event (proc MOM_start_of_group) you don't know what the group contains (as you haven't processed the members of the group yet).

 

You can get this data if you "pre-process" the file (using the MOM_do_template_file, or MOM_run_postprocess commands), but you will need to be careful [e.g. what about a group that contains *just* a group (and that group doesn't contain anything...)]

Ken Akerboom Sr CAx Systems Engr, Moog, Inc.
Production: NX10.0.3.5 MP16/TC11.2
I'd rather be e-steamed than e-diseaseled


Re: In postbuilder, what variables should I use to skip the program group if the program group is em

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

You might want to see if mom_nxt_event (note it is, or may be, an array)

To get this variable, I think you have to turn on "read ahead" with code like this in your "start of program" event:

global mom_kin_read_ahead_next_motion
set mom_kin_read_ahead_next_motion 1
MOM_reload_kinematics
Ken Akerboom Sr CAx Systems Engr, Moog, Inc.
Production: NX10.0.3.5 MP16/TC11.2
I'd rather be e-steamed than e-diseaseled


Re: In postbuilder, what variables should I use to skip the program group if the program group is em

Genius
Genius

I tried to use file delete command, but it never works

global mom_group_name
global mom_text_file
global ptp_file_name mom_output_file_full_name
global out_dir
global group_output_file

 if { ![info exists mom_text_file($mom_group_name)] } {
      file delete -force $group_output_file($mom_group_name)
}

Re: In postbuilder, what variables should I use to skip the program group if the program group is em

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

You might have mentioned you have group output turned on ;-)

 

Where are you trying to do this?  In the "end of group" event?

You may have to close the file before you delete it.

I'd also add a "catch" around the delete in case there is an issue, you can handle it "gracefully" 

 

 

MOM_close_output_file  $group_output_file($mom_group_name)
catch {file delete -force $group_output_file($mom_group_name)}

 

 

 

Ken Akerboom Sr CAx Systems Engr, Moog, Inc.
Production: NX10.0.3.5 MP16/TC11.2
I'd rather be e-steamed than e-diseaseled


Re: In postbuilder, what variables should I use to skip the program group if the program group is em

Genius
Genius

Hello Ken

 

Thanks for your suggestions!

I tried your codes in the Program End Sequence, this time there is no compile issue, But the empty file still exists which means the file delete command is not working.

 

 

Re: In postbuilder, what variables should I use to skip the program group if the program group is em

Genius
Genius

I am considering instead of deleting the empty file, is it possible to prevent creating the empty file.

 

Re: In postbuilder, what variables should I use to skip the program group if the program group is em

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

What you might want to do is see if the code is doing what you think:

 

MOM_output_to_listing_window "Deleting file $mom_group_name ..."
MOM_close_output_file  $group_output_file($mom_group_name)
catch {file delete -force $group_output_file($mom_group_name)}

if {[file exists $mom_group_name]} {
MOM_output_to_listing_window "file $mom_group_name still exists after delete???"
}
set mom_group_name "junk"

One other thing (see last line above)

It could be code in the post (that runs after the above proc) automatically sees the file is closed & re-opens it.  See if the rename to "junk" makes the file not get created, and maybe a file "junk" does get created?

 

If this is the case, what you might want to do is keep a list/array of "empty" group files to delete, and deletethem in "end of program" event.

Ken Akerboom Sr CAx Systems Engr, Moog, Inc.
Production: NX10.0.3.5 MP16/TC11.2
I'd rather be e-steamed than e-diseaseled


Learn online





Solution Information