Jump to content

Welcome to eMastercam

Register now to participate in the forums, access the download area, buy Mastercam training materials, post processors and more. This message will be removed once you have signed in.

Use your display name or email address to sign in:

Post question


Thad
 Share

Recommended Posts

I'm making some minor tweaks to one of our posts and I can't get it to spit out the date and time the way I would like. I would like the line to look like this:

(06-10-03 21:25)

 

I can get it to show the month, then the day if I switch the MM and DD in this line:

n, "(DATE=DD-MM-YY - ", date, " TIME=HH:MM - ", time, ")", e

 

but I want to get rid of the words "DATE=MM-DD-YY -" and "TIME=HH:MM -."

 

I can make the switch between MM and DD, but the only way to get rid of the words is to modify it like this, and then I lose the month/date flip.

n, "(", date, " ", time, ")", e

 

Thad

 

[ 06-10-2003, 10:13 PM: Message edited by: thad ]

Link to comment
Share on other sites

code:

Variable:	Unformatted (strings)	Formatted (values)

mon Sep 9.0

month 09 9.0

year 94 94.0

day 26 26.0

These variables work in two ways: as strings and as values. If the variable has no format assignment, the post assumes it to be a string. If it has a format assignment, it is assumed to be a value. When the variable is used as output on a postline, either the string or the format value will be used.

code:

  

 

fs 6 2 0ln

 

fmt 6 day

fmt 6 month

fmt 6 year2

 

year2 = year + 1900

HTH

 

Doing this you can make it any way you want it.

 

'Rekd teh yeah, what he said

 

[ 06-10-2003, 10:02 PM: Message edited by: Rekd ]

Link to comment
Share on other sites

And don't forget.. The date variable holds the current date. The default format of this variable is fixed: dd-mm-yy. The date and time variables, used in conjunction with a format statement (fmt), give the day of the week and the "hh:mm:ss" formats.

 

code:

Variable:	Unformatted (strings)	Formatted (values)

time HH:MM HH.MMSS

date DD-MM-YY 0-6 day of week

This is a post-calculated variable type.

 

'Rekd teh hindsight

 

[ 06-10-2003, 10:11 PM: Message edited by: Rekd ]

Link to comment
Share on other sites

Rekd,

 

Thanks for the help but you could have wrote that in Swahili and I would have understood just as much. biggrin.gif

 

Where do I find these strings/values to put them in the format that I would like? Or do I have to add it to my post?

 

This seems a little complicated for what it does.

 

Thad

Link to comment
Share on other sites

quote:

I can make the switch between MM and DD, but the only way to get rid of the words is to modify it like this, and then I lose the month/date flip.

n, "(", date, " ", time, ")", e

This in incorrect. I can't get the month and day to switch. I better just go to bed. smile.gif

 

Thad

Link to comment
Share on other sites

Danny,

 

That worked beautiful. I played around with the 45 before the time and found that a 47 would give me a slash instead of a dash. A slash is better than a dash, but a space is ideal. Do you know what would give me a space instead? BTW, what type of code is it that recognizes the numbers as symbols. Is there a list somewhere that tells what numbers are what?

 

While I'm making requests, is it possible to output AM or PM instead of the 24 hour time?

 

Thad teh never satisfied biggrin.gif

Link to comment
Share on other sites

Thad,

 

Try this if you want spaces:

 

"(", month, " ", day, " ", year, " ", time, ")"

 

As for the numbers for symbols, they are ascii codes. I know a few but I do not have an extensive list, sorry.

 

Have a nice day,

Link to comment
Share on other sites

Thank you all for your help. This is what I used to get (06-12-03 13:39)

 

n, "(", month, 45, day, 45, year, 32, time, ")", e

 

That ASCII table may come in handy in the future.

 

Thad

 

[ 06-12-2003, 01:41 PM: Message edited by: thad ]

Link to comment
Share on other sites

Try this...

 

code:

  

#======================================================================

# Need to define the 'formats' to be used for the variables used 'ptime' postblock

# Proper fomatting is IMPORTANT for this to work!

#======================================================================

 

# These formats used only for 'Date' & 'Time'

fs2 25 2.2 2.2lt #Decimal, force two leading & two trailing (time2)

fs2 26 2 0 2 0t #Integer, force trailing (hour)

fs2 27 0 2 0 2lt #Integer, force leading & trailing (min)

code:

#======================================================================

# Need to assign the 'format' to the variables used in 'ptime' postblock

#======================================================================

 

# -------------------- Date & Time Formatting ------------------------------

fmt 25 time2 # Capture 24-hour time value into 'time2' variable

fmt 26 hour # Hour

fmt 27 min # Minutes

# Uncomment the 'fmt' for 'day' and/or 'month' if you only want 1-digit format

#fmt 26 day # Day (2 digit format)

#fmt 26 month # Month (2 digit format)

code:

#======================================================================

# This postblock will create AM/PM time stamp, like -> 8:15 AM

#======================================================================

 

ptime #Turn 24-hour time format into AM/PM format

!spaces # Save current 'spaces' setting

spaces = zero # Turn OFF any extra spacing

if time >= 13, time2 = (time - 12)

else, time2 = time

hour = int(time2)

min = frac(time2)

*hour, ":", *min,

if time > 12, " PM"

else, " AM"

spaces = prv_spaces # Restore previous 'spaces' setting

code:

#======================================================================

# Then from somewhere like the 'pheader' (or 'psof') postblock, call 'ptime' ->

#======================================================================

 

pheader

 

# This generates a comment block like -> ( CREATED ON 06-17-03 AT 8:15 AM )

 

" ( CREATED ON ", *month, "-", *day, "-", *year, " AT ", ptime, " )", e

Note that if your 'spaces' setting is > 0

you will get additional spaces in this comment ->

( CREATED ON 06 -17 -03 AT 8:16 AM )

 

You can eliminate those using the same logic as in the 'ptime' postblock...

 

code:

  

pheader

 

# This generates a comment block like -> ( CREATED ON 06-17-03 AT 8:15 AM )

!spaces # Save current 'spaces' setting

spaces = zero # Turn OFF any extra spacing

 

" ( CREATED ON ", *month, "-", *day, "-", *year, " AT ", ptime, " )", e

spaces = prv_spaces # Restore previous 'spaces' setting

Link to comment
Share on other sites

thad,

 

Basically yes, you can just paste in this code.

You must make sure that you are not stomping on any existing 'fs2' statements.

(That is why I used 25,26,27 since posts usually don't have 'fs2' statements with those high numbers.)

 

For future editing on your PST, it is best to group the 'fs2' format definitions with the existing ones in your PST and group the 'fmt' format assignments with the existing ones.

But this is not required.

 

I tried to copy and paste directly from the forum screen and found that when I pasted that text into a PST in my editor that each 'code' section was one long line. Sure you can break it down, but even I messed up the first time. So... I've uploaded an example "TIME.PST" in the "Text_&_post_files_&_misc" folder on the forum FTP site. This is the std. mill MP_EZ.PST with the code pasted in between the markers ->

# START OF ADDED CODE ...

# END OF ADDED CODE...

Then I altered the area in the PHEADER postblock that actually outputs the date/time. Look for ->

# START OF ALTERED CODE...

# END OF ALTERED CODE...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

Join us!

eMastercam - your online source for all things Mastercam.

Together, we are the strongest Mastercam community on the web with over 56,000 members, and our online store offers a wide selection of training materials for all applications and skill levels.

Follow us

×
×
  • Create New...