Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations MintJulep on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

post builder help

Status
Not open for further replies.

moog2

Mechanical
Jan 16, 2007
441
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
 
Replies continue below

Recommended for you

Greetings-
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
 
Greetings-
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
 
Thanks Todd for your help, but i'm new to modifying these files, and i can't get it to work, i've created a custom command, and pasted all of that in, but i can't get it to work, do you think it would be possible to attach a post-proc so i can just copy that command ?
 
Here is the time tlc:

# 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
 
 http://files.engineering.com/getfile.aspx?folder=3fec6c9f-33d6-43d4-8ff8-b37c35e4212c&file=date_times.tcl
thanks i got them working fine
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor