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:

Moving Manual Entries using String Buffers


Recommended Posts

Ok, so I wanted to modify how some of the manual entry stuff worked in the MPMaster based post that I have.. I am no expert at post mods but I beat on it until its doing what I wanted.. so I figured I would post what I did on the off chance maybe it might help someone else and also so I could maybe get some pointers on if there might have been a better way to accomplish my objectives...

 

This is my first time doing a mod of a post that was this complicated on my own.. so although it seems to work ok.. im still curious to know if there might have been a better way and or if people think this is cool or what.. I was pretty thrilled to get this working..

 

Anyhow.. first .. to explain what was going on and what i wanted to happen..

 

So I basically have the MCX7 file setup so that I have a manual entry as comment

This contains setup information.. etc .. ie location of zeros / comments about setup

 

Then I have a manual entry as code .. this contains a probing cycle for this op.. this is fairly common for us since we do a lot of parts where we probe for location

 

So with that as my setup in my MCX file I was getting the following.. which was all out of order..

 

O208010 (12345F10_ORIG)
(X0 - LEFT EDGE OF BLANK)
(Y0 - REAR EDGE OF BLANK)
(Z0 - TOP OF BLANK MINUS .005)
(NOTE- PART MUST BE DOVETAILED TO FIT JAWS)
M01
(PROBE XYZ)
T23
M6
G0G90G54X.25Y-.25
G0G43H23Z3.
G65P9810Z.25F60.
G65P9811Z.01S1
G65P9810X-.3Y-.25F60.
G65P9810Z-.25
G65P9811X0.0S1
G65P9810Z.25
G65P9810X.25Y.25
G65P9810Z-.25
G65P9811Y0.0S1
G0G91G28Z0
G0G91G28Y0
M01
(MILL)
(MACHINE GROUP-1)
(MCX FILE - M:\12345F10.MCX-7)
(PROGRAM - 12345F10.NC)
(DATE	 - MAY-13-2013)
(TIME	 - 1:10 PM)
(T2 - 2 INCH FACEMILL W/.031 RAD - H2 - D2 - D2.0000" - R0.0310")
(T13 - 1/2 3FLT ALU-POWER 2. LOC - H13 - D13 - D0.5000")
(T11 - 1/2 2FLT BALL	 - H11 - D11 - D0.5000" - R0.2500")
(T9 - 1/4 4FLT W/.06 RAD - MILL CABINET E-24 - H9 - D9 - D0.2500" - R0.0600")
(T4 - 1/8 4FLT BALL - MILLCRIB BIN42 - .8 EXT MIN - H4 - D4 - D0.1250" - R0.0625")
(T8 - 3/8 4FLT W/.125 RAD - MILL CABINET D-22 - H8 - D8 - D0.3750" - R0.1250")
(T6 - 3/8 X 90 4FLT CHAMFER MILL - H6 - D6 - D0.3750")
(T30 - 120 DEG SPOT FOR TIMING MARK - H30 - D30 - D0.2000")
G0G17G20G40G80G90
G91G28Z0.
G28Y0.
(FACE TOP OF PART .005 OVER)
(COMPENSATION TYPE - COMPUTER)
(2 INCH FACEMILL W/.031 RAD)
T2
M6

 

What I ended up with once I completed my mods was the following .. which to me at least seems a lot more useful..

 

O208010 (12345F10)
(SAVE 12345F10.NC)
(DATE	 - MAY-13-2013)
(TIME	 - 11:32 AM)
(MCX FILE - M:\12345F10.MCX-7)
(T2 - 2 INCH FACEMILL W/.031 RAD - R0.0310")
(T13 - 1/2 3FLT ALU-POWER 2. LOC)
(T11 - 1/2 2FLT BALL	 - R0.2500")
(T9 - 1/4 4FLT W/.06 RAD - MILL CABINET E-24 - R0.0600")
(T4 - 1/8 4FLT BALL - MILLCRIB BIN42 - .8 EXT MIN - R0.0625")
(T8 - 3/8 4FLT W/.125 RAD - MILL CABINET D-22 - R0.1250")
(T6 - 3/8 X 90 4FLT CHAMFER MILL)
(T30 - 120 DEG SPOT FOR TIMING MARK)
(X0 - LEFT EDGE OF BLANK)
(Y0 - REAR EDGE OF BLANK)
(Z0 - TOP OF BLANK MINUS .005)
(NOTE- PART MUST BE DOVETAILED TO FIT JAWS)
G0G17G20G40G80G90
G91G28Z0.
G28Y0.
M01
(PROBE XYZ)
T23
M6
G0G90G54X.25Y-.25
G0G43H23Z3.
G65P9810Z.25F60.
G65P9811Z.01S1
G65P9810X-.3Y-.25F60.
G65P9810Z-.25
G65P9811X0.0S1
G65P9810Z.25
G65P9810X.25Y.25
G65P9810Z-.25
G65P9811Y0.0S1
G0G91G28Z0
G0G91G28Y0
M01
(FACE TOP OF PART .005 OVER)
(COMPENSATION TYPE - COMPUTER)
(2 INCH FACEMILL W/.031 RAD)
T2
M6

 

 

Anyhow .. first I added the following in the variables section...

 

## variables to trap comments
insanity : 50
sop_comc : ""
sop_comt : ""


## string buffer to handle manual entry
str_man_ent : ""
rc1 : 1
wc1 : 1
size1 : 0
fbuf 1 0 80 0 1
## string buffer to handle manual entry
str_man_ent2 : ""
rc2 : 1
wc2 : 1
size2 : 0
fbuf 2 0 80 0 1

 

 

Then I modified pheader2 to look like

 


 ## if not in start of file... post man ent as comment as usual..
 if sof = zero & gcode$ = 1005, n$, pspc, scomm_str, scomm$, scomm_end, e$

 ## if in start of file.. buffer man ent as comment to be output where we want..
 if sof & gcode$ = 1005,
[

 sop_comt = scomm$
 str_man_ent2 = sop_comt
 str_man_ent2 = wbuf(2, wc2)
]

 ## if after start of file post man entry as code as usual
 if sof = zero & gcode$ = 1006, n$, pspc, scomm$, e$
 ## if before start of file buffer man entry as code to be output where we want..
 if sof & gcode$= 1006,
 [
 ## save scomm to sop_comc
 sop_comc = scomm$
 str_man_ent = sop_comc
 str_man_ent = wbuf(1, wc1)

 ]

 

 

I also modified this line..

 

if gcode$ = 1008 & header = zero, n$, pspc, scomm_str, scomm$, scomm_end, e$

 

to look like this to supress output of the operation comment till after header and sof

 

## op comment only after start of file
 if gcode$ = 1008 & header = zero & sof = zero, n$, pspc, scomm_str, scomm$, scomm_end, e$

 

 

Finally I modified psof to look as follows..

 

psof$		 #Start of file for non-zero tool number
 ## init our man entry buffer
 pinitbuf1
 ptravel
 pwritbuf5
 pcuttype
 toolchng = one
 if ntools$ = one,
 [
 #skip single tool outputs, stagetool must be on
 #stagetool = m_one
 !next_tool$
 ]
 tooltotal = rbuf(4,0) #Reads total tool and null tool changes
 if toolcountn <= tooltotal, nexttool = rbuf(4,toolcountn)
 else, nexttool = first_tool$
 if tool_table = 2, ppredstck
 if tool_table = 3, pmetastck
 spaces$=0
 if output_z = yes$ & tcnt > 1,
 [
 scomm_str, "OVERALL MAX - ", *z_tmax, scomm_end, e$
 scomm_str, "OVERALL MIN - ", *z_tmin, scomm_end, e$
 ]
 spaces$=sav_spc

 ## dump comments to pcomment / pcomment2
 comment$ ## moved this here from pheader

 ## added this section to read from buffer 2 and post to NC file
 ## if theres comments as text post them before the
 ## cancel codes
 if sop_comt <> sblank,
 [
 insanity = 0
	 while insanity < wc2 - 1,
		 [

		 sop_comt = rbuf(2,rc2)
		 n$, pspc, scomm_str, sop_comt, scomm_end, e$
		 insanity = insanity + 1
		 ]
 ]

 if plane$ < 0 | opcode$ = 3 | opcode$ = 16, plane$ = 0
 pbld, n$, *sgcode, *sgplane, *smetric, "G40", "G80", *sgabsinc, e$
 sav_absinc = absinc$
 absinc$ = one
 if wcstype <= one, #Work coordinate system
 [
 pfbld, n$, sgabsinc, *sg28, "Z0.", e$
 pfbld, n$, *sg28, "X0.", "Y0.", e$
 pfbld, n$, "G92", *xh$, *yh$, *zh$, e$
 ]
 else,
 [
 pbld, n$, sgabsinc, *sg28, "Z0.", e$
 pbld, n$, sgabsinc, *sg28, "Y0.", e$
 ]
 absinc$ = sav_absinc
 sav_mi9 = mi9$
 sav_workofs = workofs$
 if sav_workofs < 0, sav_workofs = 0

 ## Added this section to read from buffer 1 and post to NC file
 ## output string saved operation comment as code
 ## sop_comc here since cancel codes have been written
 ## if sop_comc <> sblank, n$, pspc, sop_comc, e$
 if sop_comc <> sblank,
 [

 insanity = 0
	 while insanity < wc1 - 1,
		 [

		 sop_comc = rbuf(1,rc1)
		 n$, pspc, sop_comc, e$
		 insanity = insanity + 1
		 ]


 ]

 ptlchg_com
 sof = 0

 

 

And the last thing I did was remove $comment from pheader when I moved it to the psof block as shown above.. I also made a few other minor alterations to accomplish some other more mundane things like altering how toolchanges were formatted and swapping the MCX line location and changing the program name line to say (save filename.nc) rather than program name - .. but these were pretty simple tweaks in comparison to moving the manual entries around..

Link to comment
Share on other sites

Yeah this is working.. the second peice of example NC code is what it outputs..

 

If you post a manual entry as a comment it will put it right after the tooltable

 

manual entries as code will appear after the intitial cancel codes and lines to go home..

 

This way I can put in information for zeroes and stuff / setup information in a manual entry as comment.. then probing stuff in as manual entry as code and have it post out the way it shows above .. just got tired of manually moving things around every time I reposted

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