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

In our shop we have many versions of NC files and we would like it posts out revision number everytime we generate g-code. How do I do that? Please help. Here is the sample that I would like to have. Thank you

 

##########

%

O0000 (T)

(This Post Is Only For - HAAS)

(Unproven/ Proven By: )

(Post Revision "1") -----------> I want some thing like this, thank you

(ALUMINUM INCH - 2024)

 

(***** Posted Date And Time *****)

(JUL.05.2012 @ 7:17PM)

(Source - C:\USERS\MASTER\DOCUMENTS\MY MCAMX5\MCX\T.MCX-5)

(NC - C:\USERS\MASTER\DOCUMENTS\MY MCAMX5\MILL\NC\T.NC)

 

(****** Note From Programmer ******)

(MANUAL ENTRY)

 

(********* Tool List Info *********)

(T1 -2" FACE MILL - H1 - D1)

(T2 - 3/4 FLAT ENDMILL - H2 - D2)

(T4 - 1/2 DRILL - H4 - D4)

(T5 - 3/4-10 TAPRH - H5 - D5)

(T3 - 1/2 FLAT ENDMILL - H3 - D3)

 

(******* Work Offset List *******)

G90 G10 L2 P1 X0 Y0 Z0

G90 G10 L P X0 Y0 Z0 (Optional)

 

N1 ( FACING )

G91 G28 Z0

G0 G17 G40 G49 G80 G90

T1 M06 (2" FACE MILL)

G0 G90 G54 X-7.2 Y-.5001 S5000 M3

G43 H1 Z2. T2 M8

Z.2 G1 Z-.0001 F100.

X1.2 F50.

G2 Y-1.4999 I0. J-.4999 F200.

G1 X-7.2 F50.

G0 Z2. M9

G91 G28 Z0 M5

M1

 

N2(CONTOUR)

G91 G28 Z0

G0 G17 G40 G49 G80 G90

T2 M06 ( 3/4 FLAT ENDMILL)

G0 G90 G54 X-3.25 Y1.875 S700 M3

G43 H2 Z2. T4 M8

Z.2 G1 Z-1. F100.

G41 D2 Y1.125 F70.

G3 X-2.5 Y.375 I.75 J0.

G1 X0.

G2 X.375 Y0. I0. J-.375

G1 Y-2.

G2 X0. Y-2.375 I-.375 J0.

G1 X-5.

G2 X-5.375 Y-2. I0. J.375

G1 Y0.

G2 X-5. Y.375 I.375 J0.

G1 X-2.5

G3 X-1.75 Y1.125 I0. J.75

G1 G40 Y1.875

Z.2 F6.42

G0 Z2. M9

G91 G28 Z0 M5

M1

 

N4(DRILLL)

G91 G28 Z0

G0 G17 G40 G49 G80 G90

T4 M06 ( 1/2 DRILL)

G0 G90 G54 X-2.3998 Y-.9136 S2000 M3

G43 H4 Z2. T5 M8

G98 G82 Z-.75 R.1 P100. F20.

M9

G91 G28 Z0 M5

M1

 

N5(TAP)

G91 G28 Z0

G0 G17 G40 G49 G80 G90

T5 M06 ( 3/4-10 TAPRH)

G0 G90 G54 X-2.3998 Y-.9136

G43 H5 Z2. T3 M8

M29 S200

G98 G84 Z-1. R.1 F20. P100

M9

G91 G28 Z0 M5

M1

 

N3(OD)

G91 G28 Z0

G0 G17 G40 G49 G80 G90

T3 M06 ( 1/2 FLAT ENDMILL)

G0 G90 G54 X-2. Y-3.25 S7000 M3

G43 H3 Z2. T1 M8

Z.2 G1 Z-2. F6.42

G41 D3 Y-2.75 F40.

G3 X-2.5 Y-2.25 I-.5 J0.

G1 X-5.

G2 X-5.25 Y-2. I0. J.25

G1 Y0.

G2 X-5. Y.25 I.25 J0.

G1 X0.

G2 X.25 Y0. I0. J-.25

G1 Y-2.

G2 X0. Y-2.25 I-.25 J0.

G1 X-2.5

G3 X-3. Y-2.75 I0. J-.5

G1 G40 Y-3.25

Z.2 F6.42

G0 Z2. M5

G91 G28 Z0 M9

G28 Y0

M30

%

Link to comment
Share on other sites
  • 2 weeks later...

Here is how I did it sorry Chris. :welcome:

 

Up in the notes:

 

# mr9 - Control Program Revision A to Z control in the post.
#   	0 = N/C
#   	1 = A
#   	2 = B
#   	26 = Z
#
# mr10 - Customer Selection output when posted.
#   	0 = ADD CUSTOMER
#   	1 = BOEING
#   	2 = FUJI
#   	3 = LEFIELL
#   	4 = GE AEROSPACE
#   	5 = MITSUBISHI
#   	6 = SPIRIT
#   	7 = GOODRICH LANDING
#   	8 = ROCKWELL COLLINS
#   	9 = SPIRIT
#   	10 = D.O.D.
#   	11 = LOCKHEED
#   	12 = VOUGHT
#  	

 

Then down in the body of the post where strings are defined it this:

 

[# --------------------------------------------------------------------------
# Customer selector
scust0   : "ADD CUSTOMER"
scust1   : "BOEING"
scust2   : "FUJI"
scust3   : "LEFIELL"
scust4   : "GE AEROSPACE"
scust5   : "MITSUBISHI"
scust6   : "SPIRIT"
scust7   : "GOODRICH LANDING"
scust8   : "ROCKWELL COLLINS"
scust9   : "SPIRIT"
scust10  : "D.O.D."
scust11  : "LOCKHEED"
scust12  : "VOUGHT"
scust : ""

fstrsel scust0 mr10$ scust 13 -1
# --------------------------------------------------------------------------
# Program Rev Complience with Boeing/Spirit MBD Requirements
sr00  : "N/C"
sr01  : "A"
sr02  : "B"
sr03  : "C"
sr04  : "D"
sr05  : "E"
sr06  : "F"
sr07  : "G"
sr08  : "H"
sr09  : "I"
sr10  : "J"
sr11  : "K"
sr12  : "L"
sr13  : "M"
sr14  : "N"
sr15  : "O"
sr16  : "P"
sr17  : "Q"
sr18  : "R"
sr19  : "S"
sr20  : "T"
sr21  : "U"
sr22  : "V"
sr23  : "W"
sr24  : "X"
sr25  : "Y"
sr26  : "Z"
srev : ""

fstrsel sr00 mr9$ srev 27 -1
# --------------------------------------------------------------------------

 

Then in the definitions section of the post:

 

prdbcustp
	*scust

psrev
	*srev

 

Then in the header it is called this way:

 

  	#"%", e
 	#!spaces$
 	spaces$ = 0
 	#*progno$, " (", sprogname$,")", e$
 	#spaces$ = prv_spaces$
 	#pbld, n$, *smetric, e
 	"(PROGRAM NAME - ", sprogname$, ")", e$
 	"(CUSTOMER 	- ", prdbcustp, ")", e$ # Added RDB
 	"(PART NUMBER  - ", smachgrp_name, ")", e$ # ADDED Roger Martin
 	"(MODEL #  	- ", smachgrp_name, ".CATPART)", e$ # Added RDB 		
 	"(PROGRAMMER   - RON ", e$ # Added RDB
 	"(DATE 		- ", *smonth,"-",day$,"-",*year2,")", e$ #Date output as month,day,year - Ex. Feb. 12 2005
 	"(TIME 		- ",ptime,")", e$  #12 hour time output 3:52 PM
 	"(PROGRAM REV  - ", psrev, ")", e$
 	"(TOOL LIST)", e$ #Giving it a title 
 	"(--------------------------------------------------------------------------)", e$
 	spaces$ = 1

 

Hopefully that is helpful and gets you on your way. I developed most of this but I did get some help along the way so glad to share.

Link to comment
Share on other sites
  • 1 year later...

Well, If you don't mind that you have an additional but very small text file in the same directory, then here is my

solution what I put together in the afternoon. Just for fun and training. :)

This simple postblock read this tiny file, which holds rev number in the very first line.

If this file not exist (at first post run) it creates one with the same name of MCX but with different extension (.data in my sample)

Extension is doesn't really matter, it only needs to be a plain ASCII text file.

Now as I said, it's based on MCX name and same folder. Easy to change to NC name (or path too)

Additionally this postblock try read more line from this small line if there is.

What is it mean? It's mean that you can use this file as a job definition if you like. So if you write more line after

the first line (that's only rev number) like Programmer, Drawing number, Fixture, Comment, etc, this postblok

will output also. So you can hold the job details in this file, and then output into the header of NC code.

Sounds good? :)

 

This postblock also can override the revision number. You can switch on a question during posting, so you

have an option if you don't want to increase the revision number, then you can input yours and the post will

use that from that moment. Otherwise just hit ESC or ENTER to 0 and post will go ahead the actual REV number.

I built in this, because many times people just post a part of OPs or just wanna look something.

 

With the tools of MP language, many-many thing is possible, just need to imagine-define-think.

 

 

So I hope someday, someone will found this useful:

Variables, buffer-8

# --------------------------------------------------------------------------
# Revision number and header Buffer - 8
rc8 : 1
wc8 : 1
size8 : 0
fbuf 8 1 255 1 1

s_b8_strings : "" # String definiton for Buffer - 8
b8_RevNumber : 0 # Revision number
RevNoReset : 0 # RevNo reset number after question
CheckRevNum : yes$ # Ask RevNumber to change during posting?
sRevExtension : ".data" # File extension of revision/header file

fmt 4 b8_RevNumber # Format RevNumber

fq 20 RevNoReset "Revision number will be //b8_RevNumber// is it OK?" # Question to ensure of RevNumber
# --------------------------------------------------------------------------

 

 

Postblock:

# Following postblock based on a ".data" ASCII text file, in the same name and directory of MCX file
# Data file read into Buffer - 8
pReadRevNumber # Read and set revision number of NC code
 sbufname8$ = smcpath$ + smcname$ + sRevExtension
 if fexist(sbufname8$),		    # Check if .data file exist
 [
  size8 = rbuf(8, 0)
  rc8 = 1
  # Read first line from buffer, revision number
  s_b8_strings = rbuf(8, rc8)		  # Read first line from data file
  b8_RevNumber = plcval(s_b8_strings, 3) * 100	 # 1st digit in string
  b8_RevNumber = b8_RevNumber + (plcval(s_b8_strings, 2) * 10) # 2nd digit in string
  b8_RevNumber = b8_RevNumber + plcval(s_b8_strings, 1)   # 3rd digit in string
  if CheckRevNum, q20		    # Ask question of revise RevNumber
  if RevNoReset, b8_RevNumber = RevNoReset	  # Set RevNumber by question if not zero answer
  s_b8_strings = no2str(b8_RevNumber + 1)	   # Increment RevNumber
  if b8_RevNumber + 1 < 10, s_b8_strings = "0" + s_b8_strings  # Set trailing zero of string based on RevNumber length
  if b8_RevNumber + 1 < 100, s_b8_strings = "0" + s_b8_strings # Set trailing zero of string based on RevNumber length
  s_b8_strings = wbuf(8, wc8)		  # Write back the first line to data buffer file
  # Read additional lines if already exist in .data file, Customer, Programmer, Drawing No, etc...
  while rc8 <= size8,
  [
   s_b8_strings = rbuf(8, rc8)
   s_b8_strings, e$
  ]
 ]
 else,	    # Create a simple .data file if not exist and set RevNumber value
 [
  spathext$ = smcpath$   # Set path based on MCX path
  snameext$ = smcname$   # Set filename based on MCX name
  sextext$ = sRevExtension  # Set .data extension
  subout$ = 3	  # Create & output into external .data file
  extprg$ = 1	  # Open our data file to write
  "002", e$	  # Write RevNumber for next run in new data file
  subout$ = 0	  # Set output back to main NC file
  b8_RevNumber = 1    # Set actual RevNumber @ fist run
 ]

 

 

Drop this into pheader$ or psof$

pReadRevNumber
"( Revision Number: ", *b8_RevNumber, ")", e$

 

hundredbucksplease :laughing::D

How about my english? Get better? :D:guitar:

  • Like 1
Link to comment
Share on other sites

:cheers: Cheers, Peter! Very nicely done, this method of external file manipulation can be adapted for many different scenarios. Maybe like automated sequential serialization engraving.... Or maybe heat lot numbers...

 

THX Ex-W! :)

...or during posting you can ask a string what you modified at actual revision and collect them into this file, even with timestamp and name!

...or... :D

:cheers:

Link to comment
Share on other sites

I got buffer problem, MasterCam stop respond. Do you know why?

 

This is what I got...

 

# --------------------------------------------------------------------------

# Buffer 8 - Customized tool and sequence numbers

# --------------------------------------------------------------------------

rc8 : 1

wc8 : 1

init : 0

rpttl : 0

rpttl2 : 0

size8 : 0

fbuf 8 1 255 1 1

 

s_b8_strings : "" # String definiton for Buffer - 8

b8_RevNumber : 0 # Revision number

RevNoReset : 0 # RevNo reset number after question

CheckRevNum : yes$ # Ask RevNumber to change during posting?

sRevExtension : ".data" # File extension of revision/header file

 

fmt 4 b8_RevNumber # Format RevNumber

 

fq 20 RevNoReset "Revision number will be //b8_RevNumber// is it OK?" # Question to ensure of RevNumber

 

 

 

# --------------------------------------------------------------------------

# Parameter read postblocks:

# --------------------------------------------------------------------------

pprep$ #Pre-process postblock - Allows post instructions after the post is parsed but before the NC and NCI file are opened.

param_read$ = 1

#DO NOT ATTEMPT TO OUTPUT TO THE NC FILE IN THIS POSTBLOCK (OR ANY POSTBLOCKS YOU MAY CALL FROM HERE) BECAUSE THE NC OUTPUT FILE IS NOT YET OPENED!

rd_mch_ent_no$ = 0 #Read only the machine base parameters (use to collect common parameters from CNC_MACHINE_TYPE)

rd_md$ #Read machine definition parameters

 

#debug

#error_msg$ = 0

#err_file$ = 4

#bug2$ = 40

fastmode$ = yes$

 

pparameter$ # Run parameter table

if opcode$=13 | opcode$=14, result = fprm (opcode$)

if prmcode$ = 10000, stoper = ucase(sparameter$)

if stoper=snull, stoper = snullop

if prmcode$ = 10010, stock = rpar(sparameter$,1) # Stock to leave in Z

if prmcode$ = 10068, stock1 = rpar(sparameter$,1) # Stock to leave in XY

if prmcode$ = 12068, stock2 = rpar(sparameter$,1) # Stock to leave in Z facing

if prmcode$ = 10020, clearinc = rpar(sparameter$,1) #param 10020 is clearance now and 10021 indicates abs or inc

if prmcode$ = 15100, clearflg = rpar(sparameter$,1)

if prmcode$ = 15145, metvals = rpar(sparameter$,1)

if prmcode$ = 15339, clearstrt = rpar(sparameter$,1)

if prmcode$ = 15346, comp_type = rpar(sparameter$,1)

if prmcode$ = 15182, miscvalon = rpar(sparameter$,1)

if prmcode$ = 20010, sconstplname = ucase(sparameter$)

if prmcode$ = 20011, sconstplcomm = ucase(sparameter$)

if prmcode$ = 20012, stoolplname = ucase(sparameter$)

if prmcode$ = 20013, stoolplcomm = ucase(sparameter$)

if prmcode$ = 20014, swcsplname = ucase(sparameter$)

if prmcode$ = 20015, swcsplcomm = ucase(sparameter$)

if prmcode$ = 20016, smatlname1 = ucase(sparameter$)

if prmcode$ = 20017, smatlname2 = ucase(sparameter$)

if prmcode$ = 20018, stpgrpname = ucase(sparameter$)

if prmcode$ = 12025, rotary_axis2 = rpar(sparameter$,1) #Capture the axis of rotation in Multiaxis Drill and Curve 5 Axis

if prmcode$ = 15371, axissubdir = rpar(sparameter$,1)

if prmcode$ = 10029, operation_depth = rpar(sparameter$, 1) #Capture the full depth of OP

 

if prmcode$ = 10027, OpTopOfStock = rpar(sparameter$, 1) # Operation Top of Stock

if prmcode$ = 10020, OpClrPlane = rpar(sparameter$, 1) # Operation Clearance plane

if prmcode$ = 15374, OpRtrPlane = rpar(sparameter$, 1) # Operation Retract plane

if prmcode$ = 10024, OpFeedPlane = rpar(sparameter$, 1) # Operation Clearance plane

if prmcode$ = 15100, OpClrPlane_ON = rpar(sparameter$, 1) # Operation Clearance plane set or not

if prmcode$ = 15101, OpRtrPlane_ON = rpar(sparameter$, 1) # Operation Retract plane set or not

if prmcode$ = 12628,

[

hst_flg = 1

hststyle = rpar(sparameter$,1)

]

 

if prmcode$ = 15084, NumEntities = rpar(sparameter$, 1)

if prmcode$ = 15211, DepthCuts = rpar(sparameter$, 1)

 

if prmcode$ = 15240, sOpSeqNo = sparameter$ #This is the operation manager operation number

if prmcode$ = 20001,

[

s20001 = sparameter$

s20002 = sparameter$

]

 

pwrttparam$ #Information from parameters

if prmcode$ = 10010, stock = rpar(sparameter$,1) # Stock to leave in Z

if prmcode$ = 10068, stock1 = rpar(sparameter$,1) # Stock to leave in XY

if prmcode$ = 12068, stock2 = rpar(sparameter$,1) # Stock to leave in Z facing

if prmcode$ = 15145, metvals = rpar(sparameter$,1)

if prmcode$ = 15346, comp_type = rpar(sparameter$,1)

if prmcode$ = 20004, slot = rpar(sparameter$,16)

if prmcode$ = 20006, cut_ability = rpar(sparameter$,8)

if prmcode$ = 20007, pilot_dia = rpar(sparameter$,11)

if prmcode$ = 12628,

[

hst_flg = 1

hststyle = rpar(sparameter$,1)

]

 

poperation

if sof & scomm_sav <> snull,

spaces$ = 0

*sav_n3, spaces$ = 0, scomm_str, *scomm_sav, scomm_end, e$

spaces$ = sav_spc

 

# Following postblock based on a ".data" ASCII text file, in the same name and directory of MCX file

# Data file read into Buffer - 8

pReadRevNumber # Read and set revision number of NC code

sbufname8$ = smcpath$ + smcname$ + sRevExtension

if fexist(sbufname8$), # Check if .data file exist

[

size8 = rbuf(8, 0)

rc8 = 1

# Read first line from buffer, revision number

s_b8_strings = rbuf(8, rc8) # Read first line from data file

b8_RevNumber = plcval(s_b8_strings, 3) * 100 # 1st digit in string

b8_RevNumber = b8_RevNumber + (plcval(s_b8_strings, 2) * 10) # 2nd digit in string

b8_RevNumber = b8_RevNumber + plcval(s_b8_strings, 1) # 3rd digit in string

if CheckRevNum, q20 # Ask question of revise RevNumber

if RevNoReset, b8_RevNumber = RevNoReset # Set RevNumber by question if not zero answer

s_b8_strings = no2str(b8_RevNumber + 1) # Increment RevNumber

if b8_RevNumber + 1 < 10, s_b8_strings = "0" + s_b8_strings # Set trailing zero of string based on RevNumber length

if b8_RevNumber + 1 < 100, s_b8_strings = "0" + s_b8_strings # Set trailing zero of string based on RevNumber length

s_b8_strings = wbuf(8, wc8) # Write back the first line to data buffer file

# Read additional lines if already exist in .data file, Customer, Programmer, Drawing No, etc...

while rc8 <= size8,

[

s_b8_strings = rbuf(8, rc8)

s_b8_strings, e$

]

]

else, # Create a simple .data file if not exist and set RevNumber value

[

spathext$ = smcpath$ # Set path based on MCX path

snameext$ = smcname$ # Set filename based on MCX name

sextext$ = sRevExtension # Set .data extension

subout$ = 3 # Create & output into external .data file

extprg$ = 1 # Open our data file to write

"002", e$ # Write RevNumber for next run in new data file

subout$ = 0 # Set output back to main NC file

b8_RevNumber = 1 # Set actual RevNumber @ fist run

]

 

 

 

 

 

pheader$ #Call before start of file

hour = int(time$)

min = int((time$ - hour)* 100)

if hour > 12, hour = hour - 12

if hour = 0, hour = 12

year$ = year$ + 2000

 

"%", e$

spaces$=0

*progno$, " ", scomm_str, snamenc$, sextnc$, scomm_end, e$

#scomm_str, spathnc$, scomm_end, e$

comment$, e$

[spaces$ = 0, scomm_str, "SOURCE= ", smcname$, smcext$, scomm_end, spaces$=sav_spc], e$

########## Posted Date & Time ##########

[spaces$ = 0, "(POSTED ON ", *smonth, ".", *day$, ".", *year$ # MON-DD-YYYY

" AT ", time$,")", spaces$=sav_spc], e$ # 24 hour

#scomm_str, smcpath$, scomm_end, e$

[spaces$ = 0, if spostname_sav = snull, spostname_sav = spostname, spaces$=sav_spc]

scomm_str, snamepst$, scomm_end, e$

 

#q3

#"(OPERATION # ", sindividualoperation,"",

 

q4

if stotaloperation, "(", stotaloperation, ")", *e$, else, "", e$,

 

#"(CUSTOMER NAME= "

#q5

#"", scustomername,")", e$

 

#q6

#"(PART NAME= ", spartname,")", e$

 

#q7

#"(PART#= ", spartnumber,"",

 

#q8

#" REV.", spartrevision,")", e$

 

#q9

#"(PROGRAMMER= ", sprogrammer,")", e$

 

#q10

#"(SETUP BY= ", ssetupby,")", e$

 

 

#scomm_str, sprogname$, scomm_end, e$

spathnc$ = ucase(spathnc$)

smcname$ = ucase(smcname$)

spaces$=0

#scomm_str, "PROGRAM NAME - ", sprogname, scomm_end, e

#scomm_str, "DATE=DD-MM-YY - ", date, " TIME=HH:MM - ", time, scomm_end, e

#scomm_str, "MASTERCAM - V", *vers_no$, scomm_end, e$

# scomm_str, "MASTERCAM - X", scomm_end, e$

#scomm_str, "MCX FILE - ", smcpath$, smcname$, smcext$, scomm_end, e$

if spostname_sav = snull, spostname_sav = spostname

# scomm_str, "POST - ", snamepst$, scomm_end, e$

#scomm_str, "MP - V", *dll_vers$, scomm_end, e$

stck_matl$ = ucase(stck_matl$)

#scomm_str, stpgrpname, scomm_end, e$

 

#scomm_str, "MATERIAL STK SIZE= ", *stck_ht$, " ", *stck_wdth$, " ", *stck_thck$, "", smatlname2, scomm_end, e$

#scomm_str, "MATERIAL TYPE= ", stck_matl$, scomm_end, e$

spaces$=sav_spc

 

#scomm_str, "PROGRAM - ", sprogname$, sextnc$, scomm_end, e$

 

#*e$

 

#"(***** Posted Date And Time *****)", e$

 

#scomm_str, *smonth, ".", *day$, ".", *year$ # MON-DD-YYYY

 

#scomm_str, "DATE - ", *year$, "/", *month$, "/", *day$, scomm_end, e$ # YYYY/MN/DD

#scomm_str, "DATE - ", *day$, "/", *month$, "/", *year$, scomm_end, e$ # DD/MN/YYYY

#scomm_str, "DATE - ", date$, scomm_end, e$ # DD-MM-YR

#" @ ", *hour, ":", *min, [if time$ < 12, "AM"], [if time$ >= 12, "PM"], scomm_end, e$ # 12 hour

#scomm_str, "Post Rev. - ", *slicense, scomm_end, e$

 

#scomm_str, "Source - ", smcpath$, smcname$, smcext$, scomm_end, e$

 

#scomm_str, "NC - ", spathnc$, sprogname$, sextnc$, scomm_end, e$

pReadRevNumber

"( Revision Number: ", *b8_RevNumber, ")", e$

Link to comment
Share on other sites

In your post buffer 8 is already defined.

So in my example change the buffer definition to "9"

This line:

fbuf 9 1 255 1 1

 

Then change every "8" realted variables to 9. Like rc8 to rc9, size8 to size9. Everything.

 

Changes in filestuff:

 sbufname9$ = smcpath$ + smcname$ + sRevExtension
 if fexist(sbufname9$),		    # Check if .data file exist

 

 

And need to change read write routines to "9" also:

  size9 = rbuf(9, 0)
  rc9 = 1
  # Read first line from buffer, revision number
  s_b9_strings = rbuf(9, rc9)		  # Read first line from data file

 

 

And:

  s_b9_strings = wbuf(9, wc9)		  # Write back the first line to data buffer file
  # Read additional lines if already exist in .data file, Customer, Programmer, Drawing No, etc...
  while rc9 <= size9,
  [
   s_b9_strings = rbuf(9, rc9)
   s_b9_strings, e$
  ]

 

 

Everything have to be 9.

;)

Link to comment
Share on other sites

This is what I got and the MasterCam did not input the revision, I think I did something wrong...

 

# --------------------------------------------------------------------------

# Revision number and header Buffer - 9

rc9 : 1

wc9 : 1

size9 : 0

fbuf 9 1 255 1 1

 

s_b9_strings : "" # String definiton for Buffer - 8

b9_RevNumber : 0 # Revision number

RevNoReset : 0 # RevNo reset number after question

CheckRevNum : yes$ # Ask RevNumber to change during posting?

sRevExtension : ".data" # File extension of revision/header file

 

fmt 4 b9_RevNumber # Format RevNumber

 

fq 20 RevNoReset "Revision number will be //b9_RevNumber// is it OK?" # Question to ensure of RevNumber

 

 

 

 

# Following postblock based on a ".data" ASCII text file, in the same name and directory of MCX file

# Data file read into Buffer - 9

pReadRevNumber # Read and set revision number of NC code

sbufname9$ = smcpath$ + smcname$ + sRevExtension

if fexist(sbufname9$), # Check if .data file exist

if fexist(sbufname9$), # Check if .data file exist

[

size9 = rbuf(9, 0)

rc9 = 1

# Read first line from buffer, revision number

s_b9_strings = rbuf(9, rc9) # Read first line from data file

b9_RevNumber = plcval(s_b9_strings, 3) * 100 # 1st digit in string

b9_RevNumber = b9_RevNumber + (plcval(s_b9_strings, 2) * 10) # 2nd digit in string

b9_RevNumber = b9_RevNumber + plcval(s_b9_strings, 1) # 3rd digit in string

if CheckRevNum, q20 # Ask question of revise RevNumber

if RevNoReset, b9_RevNumber = RevNoReset # Set RevNumber by question if not zero answer

s_b9_strings = no2str(b9_RevNumber + 1) # Increment RevNumber

if b9_RevNumber + 1 < 10, s_b9_strings = "0" + s_b9_strings # Set trailing zero of string based on RevNumber length

if b9_RevNumber + 1 < 100, s_b9_strings = "0" + s_b9_strings # Set trailing zero of string based on RevNumber length

s_b9_strings = wbuf(9, wc9) # Write back the first line to data buffer file

# Read additional lines if already exist in .data file, Customer, Programmer, Drawing No, etc...

while rc9 <= size9,

[

s_b9_strings = rbuf(9, rc9)

s_b9_strings, e$

]

]

else, # Create a simple .data file if not exist and set RevNumber value

[

spathext$ = smcpath$ # Set path based on MCX path

snameext$ = smcname$ # Set filename based on MCX name

sextext$ = sRevExtension # Set .data extension

subout$ = 3 # Create & output into external .data file

extprg$ = 1 # Open our data file to write

"002", e$ # Write RevNumber for next run in new data file

subout$ = 0 # Set output back to main NC file

b9_RevNumber = 1 # Set actual RevNumber @ fist run

]

 

 

 

pheader$ #Call before start of file

hour = int(time$)

min = int((time$ - hour)* 100)

if hour > 12, hour = hour - 12

if hour = 0, hour = 12

year$ = year$ + 2000

 

"%", e$

spaces$=0

*progno$, " ", scomm_str, snamenc$, sextnc$, scomm_end, e$

#scomm_str, spathnc$, scomm_end, e$

comment$, e$

[spaces$ = 0, scomm_str, "SOURCE= ", smcname$, smcext$, scomm_end, spaces$=sav_spc], e$

########## Posted Date & Time ##########

[spaces$ = 0, "(POSTED ON ", *smonth, ".", *day$, ".", *year$ # MON-DD-YYYY

" AT ", time$,")", spaces$=sav_spc], e$ # 24 hour

#scomm_str, smcpath$, scomm_end, e$

[spaces$ = 0, if spostname_sav = snull, spostname_sav = spostname, spaces$=sav_spc]

scomm_str, snamepst$, scomm_end, e$

 

#q3

#"(OPERATION # ", sindividualoperation,"",

 

q4

if stotaloperation, "(", stotaloperation, ")", *e$, else, "", e$,

 

#"(CUSTOMER NAME= "

#q5

#"", scustomername,")", e$

 

#q6

#"(PART NAME= ", spartname,")", e$

 

#q7

#"(PART#= ", spartnumber,"",

 

#q8

#" REV.", spartrevision,")", e$

 

#q9

#"(PROGRAMMER= ", sprogrammer,")", e$

 

#q10

#"(SETUP BY= ", ssetupby,")", e$

 

pReadRevNumber

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

Link to comment
Share on other sites

Do you know why sometimes if gives me like

 

15-427723-00-REV 1-FIX.NC REV.890 instead of 15-427723-00-REV 1-FIX.NC REV.1

 

I think I have to RESET the revision number at the QUESTION WINDOW if I opened A.MCX-7 file then switch to B.MCX-7 the revision occurrence is sometimes not counting sequential.

Link to comment
Share on other sites

Original 1st or previous 2nd? In this case (current 3).

 

Like we make this part 1 year ago for OP1 then we modified it like the way we love it to be as "NOW". I think it should notify us like

 

CNC Rev.2 (Originally Rev.1 was posted on Sep.1st.2000)

 

OK, so you ALWAYS want to see the FIRST revision date? Even if current rev is 1232444?

Link to comment
Share on other sites

Have you thought about the G10? Suppose I have this

 

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

 

I think we should utilize the WCS COMMENT to output the VALUE as programmer input their G10 XYZ location value..... for B0, B90. B270.

 

do you think it is possible to do it? Because we save G10 lines into the source file and will post at demands since the job fixture already stayed on the PALLET....

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