How to get output Machine Time or Cutting Time at the top of NC Program?
2021-10-06T23:28:02Z
Summary
Details
The variable mom_machine_time and mom_cutting_time give a value only at the end of the program. The requirement is to have these values at the top of the NC program. How to get output Machine Time or Cutting Time at the top of NC Program?
Solution
In order to output the machine time at the top of the program, the following code needs to be placed at the End of Program Event in Post Builder.
#######
global ptp_file_name
set tmp_file_name "${ptp_file_name}_"
if {[file exists $tmp_file_name]} {
MOM_remove_file $tmp_file_name
}
MOM_close_output_file $ptp_file_name
file rename $ptp_file_name $tmp_file_name
set ifile [open $tmp_file_name r]
set ofile [open $ptp_file_name w]
global mom_machine_time
puts $ofile "(MACHINE TIME = [format "%.2f" $mom_machine_time] MIN.)"
set buf ""
while { [gets $ifile buf] > 0 } {
puts $ofile $buf
}
close $ifile
close $ofile
MOM_remove_file $tmp_file_name
MOM_open_output_file $ptp_file_name
####
The output is as follows: Similarly, Cutting Time can be added using the syntax in the above code .
global mom_cutting_time
puts $ofile "(CUTTING TIME = [format "%.2f" $mom_cutting_time] MIN.)"
Hardware/Software Configuration
Platform: INTL64 OS: windows OS Version: 1064 Product: NX Application: CAM Version: V1973 Function: POSTBUILDER