post builder help
post builder help
(OP)
In NX4, i am editing a 5 axis post processor, i have a command which calculates the time to run the program, which states ....
MOM_output_literal "(Time: [format "%.2f" $mom_machine_time] Minutes)"
Firstly, how can i get it to display in Hours, minutes,and seconds.
And secondly, how can i create a command to display The Date it was created ??
Help appreciated
MOM_output_literal "(Time: [format "%.2f" $mom_machine_time] Minutes)"
Firstly, how can i get it to display in Hours, minutes,and seconds.
And secondly, how can i create a command to display The Date it was created ??
Help appreciated





RE: post builder help
I've been meaning to do the alteration on machine time also, just haven't yet and I've made a good time/date that is easily altered if you don't like the format. Right now it would put out (10-18-2008 12:33PM). I'll try to get the machine time done Sunday or Monday evening and get them both posted and you'll see how simple these two really are to do.
Todd Asher
RE: post builder help
Here is the date tcl. I'll get more time later for the time tcl.
# Output date and time the way I prefer.
# Asher 03-14-2007
global mom_date
set month [string range $mom_date 4 6]
if {$month == "Jan"} {
set month 01}
if {$month == "Feb"} {
set month 02}
if {$month == "Mar"} {
set month 03}
if {$month == "Apr"} {
set month 04}
if {$month == "May"} {
set month 05}
if {$month == "Jun"} {
set month 06}
if {$month == "Jul"} {
set month 07}
if {$month == "Aug"} {
set month 08}
if {$month == "Sep"} {
set month 09}
if {$month == "Oct"} {
set month 10}
if {$month == "Nov"} {
set month 11}
if {$month == "Dec"} {
set month 12}
set day [string range $mom_date 8 9]
set year [string range $mom_date 20 23]
set time_h [string range $mom_date 11 12]
set time_m [string range $mom_date 13 15]
if {$time_h >= 12} {
set ap PM
} else {
set ap AM}
if {$time_h >= 13} {
set time_h [expr $time_h-12]}
if {$time_h < 10 && [string length $time_h] == 2} {
set time_h [string range $time_h 1 1]
} else {
set time_h [string range $time_h 0 1]
}
MOM_set_seq_off
MOM_output_literal "($month-$day-$year $time_h$time_m$ap)"
MOM_set_seq_on
}
Todd Asher
RE: post builder help
RE: post builder help
# machine time is output in minutes, this converts
# time to hrs min sec
# Asher 10-20-2008
global mom_machine_time
global t_hours
global t_min
global t_sec
set tt_hours [expr {($mom_machine_time) / 60}]
if {$tt_hours > 0.0} {
set t_hours [expr {int($tt_hours)}]
} else {
set t_hours 0}
set tt_min [expr {$tt_hours - $t_hours}]
set tt_min [expr {60 * ($tt_min)}]
set t_min [expr {int($tt_min)}]
set tt_sec [expr {$tt_min - $t_min}]
set t_sec [expr {60 * ($tt_sec)}]
set t_sec [format "%1.2s" $t_sec]
MOM_set_seq_off
MOM_output_literal "(MACHINE TIME = $t_hours\hrs $t_min\min $t_sec\sec)"
MOM_set_seq_on
}
And if everything goes well I've uploaded and you can import the custom commands.
Todd Asher
RE: post builder help