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:

How do I add revision number?


Recommended Posts

Drop everything, here is a logfile stuff:

 

Variables:

# --------------------------------------------------------------------------
# Revision number and log file Buffer - 9
rc9    : 1
wc9    : 1
size9   : 0
fbuf 9 1 255 1 1
b9_RevNumber : 0    # Revision number
s_b9_strings : ""   # String definiton for Buffer - 9
s_b9_TimeStamp : ""   # String for TimeStamp
sRevLogExt  : ".log"  # File extension of revision log file
sRevLogSuff  : "_REVISION" # File suffix of revision log file
fs2 24 2.2 2.2lt  #Decimal, force two leading & two trailing - time
fmt 4 b9_RevNumber # Format RevNumber
fmt 24 time$   # Format time
# --------------------------------------------------------------------------

 

 

Postblock:

# Following postblock based on a ".log" ASCII text file, in the same name + suffix and directory of MCX file
# Log file read into Buffer - 9
pReadRevLogFile  # Read and set revision number of NC code
 sbufname9$ = smcpath$ + smcname$ + sRevLogSuff + sRevLogExt
 if fexist(sbufname9$),		    # Check if .log file exist
 [
  size9 = rbuf(9, 0)
  s_b9_strings = rbuf(9, size9)		 # Read last line from log file
  s_b9_TimeStamp = brksps(7, s_b9_strings)	  # Get timestamp string
  b9_RevNumber = size9 - 1		  # Get actual RevNumber, size9 already incremented!
  s_b9_strings = "Set new revision number " + no2str(b9_RevNumber + 1) + "?" + no2asc(13) + "Previous was on: " + s_b9_TimeStamp
  if mprint(s_b9_strings, 5) = 6,		 # Ask to create a new RevNumber or leave last
  [
   b9_RevNumber = b9_RevNumber + 1	    # Set new RevNumber
   s_b9_strings = no2str(b9_RevNumber)	   # Set RevNumber string
   if b9_RevNumber < 10, s_b9_strings = "0" + s_b9_strings  # Set trailing zero of string based on RevNumber length
   if b9_RevNumber < 100, s_b9_strings = "0" + s_b9_strings # Set trailing zero of string based on RevNumber length
   result = updstr(smonth)
   s_b9_strings = s_b9_strings + " - Date: " + smonth + no2str(day$) + no2str(year2) + " - Time: " + no2str(time$)
   s_b9_strings = wbuf(9, size9)	    # size!!! Write additional line to log buffer file
  ]
 ]
 else,		 # Create a simple .log file if not exist and set RevNumber value
 [
  spathext$ = smcpath$    # Set path based on MCX path
  snameext$ = smcname$ + sRevLogSuff # Set filename based on MCX name + suffix
  sextext$ = sRevLogExt    # Set .log extension
  subout$ = 3	   # Create & output into external .log file
  extprg$ = 1	   # Open our log file to write
  result = updstr(smonth)
  s_b9_strings = "001" + " - Date: " + smonth + no2str(day$) + no2str(year2) + " - Time: " + no2str(time$)
  *s_b9_strings, e$	 # Write first line for next run in new log file
  subout$ = 0	   # Set output back to main NC file
  b9_RevNumber = 1	 # Set actual RevNumber @ fist run
 ]

 

 

Outpt @ pheader$:

pReadRevLogFile
"( Revision Number: ", *b9_RevNumber, ")", e$

 

 

This will create a log file with timestamp and ask the programmer about add a new revision log record or ignore it.

Well? :):cheers: anotherhudred :D:laughing:

Link to comment
Share on other sites

Great and the only thing I changed is the YEAH to YEAR$ as the original post defined.

THX! :)

YEAH to YEAR$? Why? Where? :o May be I mistyped something? :question:

 

How do I SAY "YES" then it let me type my own revision if I disagree with what it is given? Thank you Peter, you're the man.

Hmm, I'll think and modify it, when I have time, I'm busy a bit on this week, but I'll work on it.

 

PS: Where is your PAYPAL DONATION logo?

I've tried it, but the forum engine allows only one picure and link for me, so I kept the LinkedIn rather and simply put my mail

address instead of logo :D Work also at PP and U can use it to contact me directly as well. ;) Just in case, we never know.

Link to comment
Share on other sites

Thank you Peter, you made my job much easier than ever before. Because of you now we can open any program and re-post without shivering whether wrong tool length offset (this happens when X file version and opens on X7), wrong cutter comp, wrong retract depth (we scraped one expensive part before), coolant check.

 

 

I'm now trying to figure out about the it can appears all of the G10 as I stated, it's real tough to do. Honestly, I don't know what I can do better to be automatically output the comment from WCS manager.

 

G90 M0 (CHECK WORK OFFSET)

G10 L2 P0 X0 Y0 Z0 B0(G53 ZERO)

G10 L2 P1 X0 Y0 Z0 B0(G54 B90.)

G10 L2 P2 X0 Y0 Z0 B0(G55 B270.)

(*)

 

In the WCS ---> VIEW MANAGER

 

 

G90 M0 (CHECK WORK OFFSET)

G10 L2 P0 X0 Y0 Z0 B0(G53 ZERO)

G10 L2 P1 X0 Y0 Z0 B0(G54 B90.) would be ----> G10 L2 P1 X.258 Y852. Z0 B0(G54 B90.) ======> XYZ manually entered by programmer and the post reads from WCS Comment

G10 L2 P2 X0 Y0 Z0 B0(G55 B270.) would be ----> G10 L2 P2 X-.253 Y-.952 Z.500 B0(G55 B270.) ======> XYZ manually entered by programmer and the post reads from WCS Comment

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...