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:

Editing MPMaster for Mazak HMC.


Joe788
 Share

Recommended Posts

Throughout the years, my brief bursts of "post editing motivation" have brought my MPMaster post very close to where I'd like it to be. The code is 95% perfect, but there are a few small items I still need to perfect...(and have no idea how to do so). I'm feeling a surge of motivation coming on, but before I waste it all with hours of post "tinkering", I figured I'd just ask the question here and avoid the frustration banghead.gif . I spent several hours looking through the archives, but couldn't seem to find anything regarding my three specific items. I imagine these are pretty simple for some of the post gurus here:

 

#1- I need the B axis moves to post with no decimal place, and three trailing zeros. Instead of "B90.", I need B90000. Instead of "B270.", I need "B270000" etc. Any ideas?

 

#2- I need to output an M19 on the same line as the "G91G28Z0." at the end of a tool. I figured out that I can do this just by adding the M19 into the Z retract before toolchange.....but then I still have a spindle stop command beforethe retract! So, that wasn't the best idea.

 

#3-I'd like to move the next tool call to the line immediately after the tool change. Right now, It spits T105M06, then it calls the next tool on the same line with the G43. I'd like it to spit it out like this:

T105M06

T59

 

 

I'm using X3, with the same mpmaster that I ported in from V9 years ago. The machine is a Mazak HCN5000 with a Matrix control an .001º indexing table.

 

All help is greatly appreciated!

Link to comment
Share on other sites

#1 - The mechanism in the post that controls the formatting of variables is called a Format Assignment.

 

What it gives you is the ability to use a Format Statement (instructions that tell the MP DLL how to format a variable) to control numeric decimal formatting.

 

"cabs" is the rotary output variable. The Format Assignment line is used to format the numeric variable and assign a pre-fix or a Suffix to the number.

 

In the case of "cabs" your line probably looks like this:

 

code:

fmt  B  11  cabs        #C axis position

fmt B 14 cinc #C axis position

fmt B 14 cout_i #C axis position

fmt B 4 indx_out #Index position

So for the "cabs" line, the pre-fix character is your rotary address (B), and it is using format statement #11.

 

What you need to do is create a new format statement line that will output a format you want.

 

Here is what I would do:

 

Find the section of your post that has the fs2 lines (format statement #2).

 

code:

fs2 24 0 3t 0 3t

Then change your "cabs" format assignment line to

 

code:

fmt  B  24  cabs        #C axis position

fmt B 14 cinc #C axis position

fmt B 14 cout_i #C axis position

fmt B 4 indx_out #Index position

You might need to change the "cinc" and "cout_i" statements too, but probably not...

Link to comment
Share on other sites

Fantastic! I set up the fs2 24, and then I had to change the

 

"fmt A 4 indx_out"

 

to

 

"fmt B 24 indx_out"

 

Worked awesome! I never would have figured that out on my own in a million years. My post editing ambitions have been re-invigorated.

 

Any ideas on how to handle my second and third tweaks?

Link to comment
Share on other sites

#2 Find this line in the pretract section of the post

 

code:

pbld, n$, sgabsinc, sgcode, [if gcode$ = 1, sgfeed], *sg28, "Z0.", [if gcode$ = 1, feed], scoolant, e$

add the code

 

code:

pbld, n$, sgabsinc, sgcode, [if gcode$ = 1, sgfeed], *sg28, "Z0.", "M19", [if gcode$ = 1, feed], scoolant, e$

#3 Find the ptlchg_com section, then find, then find this

 

code:

if stagetool >= zero,

[

if omitseq$ = 1 & tseqno > 0,

[

if tseqno = 2, n$ = t$

pbld, *n$, *t$, "M06", ptoolcomm, e$

]

else, pbld, n$, *t$, "M06", ptoolcomm, e$

]

at the bottom of it list the variable

 

code:

if stagetool >= zero,

[

if omitseq$ = 1 & tseqno > 0,

[

if tseqno = 2, n$ = t$

pbld, *n$, *t$, "M06", ptoolcomm, e$

]

else, pbld, n$, *t$, "M06", ptoolcomm, e$

]

next_tool$

gthen look a little further down, find the line with "G43" on it remove the next_tool$ call on that line

Link to comment
Share on other sites

Thanks John, that's actually one part of it I was able to find on my own.....but it's still stopping the spindle before the retract. So now I get the M05, then the retract with the M19. Any easy way to remove the spindle stop that still remains before the retract?

Link to comment
Share on other sites

smile.gif Joe...This is right out of a Mpmaster V9 post that I upgraded to X2 last year.

 

code:

pretract        #End of tool path, toolchange              

sav_absinc = absinc$

absinc$ = one

sav_coolant = coolant$

coolant$ = zero

#cc_pos is reset in the toolchange here

cc_pos$ = zero

gcode$ = zero

#pbld, n, sccomp, *sm05, psub_end_mny, e

pbld, n$, sccomp, psub_end_mny, e$

ptool_sub_e #<----------------------- tool sub end

pbld, n$, "M9", e$

pbld, n$, sgabsinc, sgcode, "G28", "Z0.","M19", e$ #<-----------------------HERE

#if lock_codes = 1 & rot_on_x, pbld, n, *sunlock, "(UNLOCK)", e

#pbld, n, "G28", "X0.", "Y0.", protretinc, e

#if lock_codes = 1 & rot_on_x & cuttype = 0, pbld, n, *slock, "(LOCK)", e

if abs(fmtrnd(cabs)) > 360 & nextop$ <> 1003,

[

if lock_codes = 1, pbld, n$, *sunlock, "(UNLOCK)", e$

rotretflg = 1

pbld, n$, 'G28', protretinc, e$

rotretflg = 0

if lock_codes = 1 & cuttype = 0, pbld, n$, *slock, "(LOCK)", e$

]

absinc$ = sav_absinc

coolant$ = sav_coolant

Just add the string literal "M19", after the "G28 Z0.".

 

Note that you may have more than one instance of "G91 G28 Z0.". Such as in the pstop postblock.

 

 

next_tool$ is outputting your staged tool here:

code:

ptlchg_com      #Tool change common blocks

pcom_moveb

c_mmlt$ #Multiple tool subprogram call

#ptoolcomment

comment$

pmisccheck

pcan

if plane$ < 0, plane$ = 0

if stagetool >= zero, pbld, n$, *t$, "M6", ptoolcomm, e$

spaces$=0

if output_z = yes$,

[

preadbuf5

if (opcode$ > 0 & opcode$ < 16) | opcode$ = 19,

[

#n, pspc, "(", "MAX - ", *max_depth, ")", e

n$, pspc, "(", "MIN - ", *min_depth, ")", e$

]

]

spaces$=sav_spc

pstock

pindex

sav_absinc = absinc$

if wcstype > one, absinc$ = zero

if lock_codes = 1 & not(index) & rot_on_x, pbld, n$, *sunlock, "(UNLOCK)", e$

pcan1, pbld, n$, *sgcode, *sgabsinc, [if not(index), pwcs], pfxout, pfyout,

pfcout, *speed, *scoolant, pgear, strcantext, e$

if lock_codes = 1 & not(index) & rot_on_x & cuttype = 0, pbld, n$, *slock, "(LOCK)", e$

pbld, n$, "G91", "G43", *tlngno$, "Z0.", *spindle, next_tool$, e$ #<----------------HERE

"G92 Z.05","M8", e$

"G90", e$

sav_coolant = coolant$

if coolant$ = 1, sm09 = sm09_0

if coolant$ = 2, sm09 = sm09_1

if coolant$ = 3, sm09 = sm09_2

absinc$ = sav_absinc

pcom_movea

toolchng = zero

c_msng$ #Single tool subprogram call

last_op_id = op_id$

last_cuttype = cuttype

ptool_sub_s # <------------------------------------------------tool sub start

Just move it to here:

 

code:

ptlchg_com      #Tool change common blocks

pcom_moveb

c_mmlt$ #Multiple tool subprogram call

#ptoolcomment

comment$

pmisccheck

pcan

if plane$ < 0, plane$ = 0

if stagetool >= zero,

[

pbld, n$, *t$, "M6", ptoolcomm, e$

pbld, n$,next_tool$, e$ #<----------------HERE

]

spaces$=0

if output_z = yes$,

[

preadbuf5

if (opcode$ > 0 & opcode$ < 16) | opcode$ = 19,

[

#n, pspc, "(", "MAX - ", *max_depth, ")", e

n$, pspc, "(", "MIN - ", *min_depth, ")", e$

]

]

spaces$=sav_spc

pstock

pindex

sav_absinc = absinc$

if wcstype > one, absinc$ = zero

if lock_codes = 1 & not(index) & rot_on_x, pbld, n$, *sunlock, "(UNLOCK)", e$

pcan1, pbld, n$, *sgcode, *sgabsinc, [if not(index), pwcs], pfxout, pfyout,

pfcout, *speed, *scoolant, pgear, strcantext, e$

if lock_codes = 1 & not(index) & rot_on_x & cuttype = 0, pbld, n$, *slock, "(LOCK)", e$

pbld, n$, "G91", "G43", *tlngno$, "Z0.", *spindle, e$

"G92 Z.05","M8", e$

"G90", e$

sav_coolant = coolant$

if coolant$ = 1, sm09 = sm09_0

if coolant$ = 2, sm09 = sm09_1

if coolant$ = 3, sm09 = sm09_2

absinc$ = sav_absinc

pcom_movea

toolchng = zero

c_msng$ #Single tool subprogram call

last_op_id = op_id$

last_cuttype = cuttype

ptool_sub_s # <------------------------------------------------tool sub start

Note the brackets. They include the staged tool in the if statement. This way you won't get output if the tool number repeats. ie. same tool multiple operations.

 

HTH smile.gif

Link to comment
Share on other sites

It should not need to be no.

 

It is output outside of the logic normally on the G43 line

 

As far as repeats that is all parsed out the system knows which tool when and the null tool change section handles tool number repeats.

 

The relocation of the variable should be fine

Link to comment
Share on other sites

AWESOME!

 

I got the next tool call directly after the tool change, got the M19 on the retract, got rid of the M05 before the retract, and got the B axis calling out 3 trailing zeros!

 

Since that was all so easy, let me throw two more at you guys.....

 

#4- When retracting between B axis moves, the spindle stops. I like having it re-call the work offsets, spindle speed, spindle start, and H offset after each B axis move, but I'd like to keep the spindle turning, unless it's going to tool change.

 

#5- On the line immediately after the G91G28Z0.M19, I'd like to have a G90. This isn't terribly important, but it would be nice.

Link to comment
Share on other sites

Joe,

 

Can you copy your entire "ptlchg0$" post block and paste it into a response for us?

 

If you use the "Full Reply" form there is a "Code" button that you can use to keep the post formatting...

 

It puts in a [ CODE ] and a [ /CODE ] (without the spaces between the "CODE" and the brackets).

 

Or you can look through this post block for a "sm05" output parameter...

Link to comment
Share on other sites

Hey Colin, I managed to get the G90 to come up after the retract with your instructions, and here's the requested post block:

 

(I actually pasted a lot more than just that single block, in case you needed anything else. Hopefully it's not too cluttered.)

 

code:

 ptlchg0$         #Call from NCI null tool change (tool number repeats)

pcuttype

pcom_moveb

toolcount = toolcount + 1

prvtp = rbuf(3,toolcountp)

if toolcountn <= tooltotal, nexttool = rbuf(4,toolcountn)

else, nexttool = first_tool$

if (mi10$=one & (op_id$ <> last_op_id | (op_id$ = last_op_id & xform_op_id$ <> op_id$))) | (tlplnno$ <> prvtp & ret_on_indx), pstop

c_mmlt$ #Multiple tool subprogram call

comment$

pmisccheck

pcan

if plane$ < 0, plane$ = 0

pbld, n$, sgplane, e$

pspindchng

if coolant$ <> 0 & coolant$ <> sav_coolant & sav_coolant, pbld, n$, sm09, e$

pbld, n$, scoolant, e$

sav_coolant = coolant$

if coolant$ = 1, sm09 = sm09_0

if coolant$ = 2, sm09 = sm09_1

if coolant$ = 3, sm09 = sm09_2

if op_id$<>last_op_id, pstock

if sav_mi9 = 1, workofs$ = sav_workofs

if (wcstype > one & workofs$ <> prv_workofs$) | (tlplnno$ <> prvtp),

[

pindex

sav_absinc = absinc$

absinc$ = zero

if fmtrnd(prv_cabs) <> fmtrnd(cabs),

[

if lock_codes = 1 & not(index) & rot_on_x, pbld, n$, *sunlock, "(UNLOCK)", e$

pbld, n$, sgabsinc, [if not(index), pwcs], pfxout, pfyout, pfzout, pfcout, e$

if lock_codes = 1 & not(index) & rot_on_x & cuttype = 0, pbld, n$, *slock, "(LOCK)", e$

]

else,

[

pbld, n$, sgabsinc, [if not(index), pwcs], pfxout, pfyout, pfzout, pcout, e$

]

pe_inc_calc

ps_inc_calc

absinc$ = sav_absinc

]

if lock_codes = 1 & cuttype <> last_cuttype & cuttype > 0, pbld, n$, *sunlock, "(UNLOCK)", e$

if cuttype = zero, ppos_cax_lin

if lock_codes = 1 & cuttype <> last_cuttype & cuttype = 0 & fmtrnd(prv_cabs) = fmtrnd(cabs), pbld, n$, *slock, "(LOCK)", e$

if gcode$ = one, plinout

else, prapidout

pcom_movea

c_msng$ #Single tool subprogram call

last_op_id = op_id$

last_cuttype = cuttype

 

ptlchg$ #Tool change

pcuttype

toolchng = one

toolcount = toolcount + 1

if toolcountn <= tooltotal, nexttool = rbuf(4,toolcountn)

else, nexttool = first_tool$

if wcstype = one, #Work coordinate system

[

pfbld, n$, "G28", "X0.", "Y0.", e$

pfbld, n$, "G92", *xh$, *yh$, *zh$, e$

]

pbld, n$, *sm01, e$

if mi10$=one, n$, *sm00, e$

ptlchg_com

 

pretract #End of tool path, toolchange

sav_absinc = absinc$

absinc$ = one

sav_coolant = coolant$

coolant$ = zero

#cc_pos is reset in the toolchange here

cc_pos$ = zero

gcode$ = zero

pbld, n$, sccomp, psub_end_mny, e$

pbld, n$, sgabsinc, sgcode, "G28", "Z0.", "M19", scoolant, e$

pbld, n$, "G90", e$

#if lock_codes = 1 & rot_on_x, pbld, n, *sunlock, "(UNLOCK)", e

#pbld, n, "G28", "X0.", "Y0.", protretinc, e

#if lock_codes = 1 & rot_on_x & cuttype = 0, pbld, n, *slock, "(LOCK)", e

if abs(fmtrnd(cabs)) > 360 & nextop$ <> 1003,

[

if lock_codes = 1, pbld, n$, *sunlock, "(UNLOCK)", e$

rotretflg = 1

pbld, n$, 'G28', protretinc, e$

rotretflg = 0

if lock_codes = 1 & cuttype = 0, pbld, n$, *slock, "(LOCK)", e$

]

absinc$ = sav_absinc

coolant$ = sav_coolant

 

protretinc #Reset the C axis revolution counter

if frc_cinit & rot_on_x,

[

rev = zero

sav_rev = zero

cabs = zero

csav = zero

indx_out = zero

if index, e$, pindxcalc, pindex

else, *cabs

prvcabs = zero

!csav, !cabs

]

Thanks again for the help!

Link to comment
Share on other sites

Hi Joe,

 

I think this line is where the "M05" is probably coming from...

 

code:

 if (mi10$=one & (op_id$ <> last_op_id | (op_id$ = last_op_id & xform_op_id$ <> op_id$))) | (tlplnno$ <> prvtp & ret_on_indx), pstop 

The post is checking the condition of a bunch of variables and if one of the conditions is true, then it calls the "pstop" post block...

 

The easiest way to disable this is to put a pound sign in front of the line (#)...

 

This will mark the entire line as a "comment" and the post will ignore it.

 

This will not effect the spindle being stopped at an actual toolchange, because the post calls the 'ptlchg$' post block, not 'ptlchg0$' block.

 

Hope that helps,

Link to comment
Share on other sites

Joe/Jim,

 

I'm guessing that the 'pstop' post block contains the retract and spindle stop commands.

 

Don't put the pound sign on that line at all.

 

Joe, can you find the 'pstop' post block and copy all the lines into a reply like you did with the ptlchg0$ post block?

 

Then we can help you find the lines that output the spindle stop...

 

Thanks,

Link to comment
Share on other sites

Jimmy: I tried putting the # sign directly in front of the "pstop" only, but it still skipped the entire retract.

 

Colin: I've pasted the pstop block below for your viewing pleasure. See anything interesting?

 

code:

 

pstop # Stop routine

pretract

toolchng = one

pcom_moveb

if mi10$=one, n$, *sm00, e$

sav_absinc = absinc$

if wcstype > one, absinc$ = zero

comment$

pindex

if lock_codes = 1 & not(index) & rot_on_x, pbld, n$, *sunlock, "(UNLOCK)", e$

pcan1, pbld, n$, *sgcode, *sgabsinc, [if not(index), pwcs], pfxout, pfyout,

pfcout, *speed, *spindle, pgear, strcantext, e$

if lock_codes = 1 & not(index) & rot_on_x & cuttype = 0, pbld, n$, *slock, "(LOCK)", e$

pbld, n$, "G43", *tlngno$, pfzout, scoolant, e$

sav_coolant = coolant$

if coolant$ = 1, sm09 = sm09_0

if coolant$ = 2, sm09 = sm09_1

if coolant$ = 3, sm09 = sm09_2

absinc$ = sav_absinc

toolchng = zero

Thanks!

Link to comment
Share on other sites

Colin,

Wasn't thinking in post mode, big oops

pstop calls pretract, it's in there he needs to delete it from

V9 MP 9.19 code

 

yeah I was brain fartin on that Joe sorry about that

 

code:

 pstop      # Stop routine

pretract

pcom_moveb

if mi10=one, n, *sm00, e

sav_absinc = absinc

if wcstype > one, absinc = zero

comment

if lock_codes = 1 & not(index) & rot_on_x, pbld, n, *sunlock, "(UNLOCK)", e

pcan1, pbld, n, *sgcode, *sgabsinc, pwcs, pfxout, pfyout,

pfcout, *speed, *spindle, pgear, strcantext, e

if lock_codes = 1 & not(index) & rot_on_x & cuttype = 0, pbld, n, *slock, "(LOCK)", e

pbld, n, "G43", *tlngno, pfzout, scoolant, next_tool, e

sav_coolant = coolant

if coolant = 1, sm09 = sm09_0

if coolant = 2, sm09 = sm09_1

if coolant = 3, sm09 = sm09_2

absinc = sav_absinc


code:

 pretract        #End of tool path, toolchange              

sav_absinc = absinc

absinc = one

sav_coolant = coolant

coolant = zero

#cc_pos is reset in the toolchange here

cc_pos = zero

gcode = zero

pbld, n, sccomp, *sm05, psub_end_mny, e <<<< delete *sm05 here

pbld, n, sgabsinc, sgcode, "G28", "Z0.", scoolant, e

#if lock_codes = 1 & rot_on_x, pbld, n, *sunlock, "(UNLOCK)", e

#pbld, n, "G28", "X0.", "Y0.", protretinc, e

#if lock_codes = 1 & rot_on_x & cuttype = 0, pbld, n, *slock, "(LOCK)", e

if abs(cabs) > 360 & nextop <> 1003,

[

if lock_codes = 1, pbld, n, *sunlock, "(UNLOCK)", e

rotretflg = 1

pbld, n, 'G28', protretinc, e

rotretflg = 0

if lock_codes = 1 & cuttype = 0, pbld, n, *slock, "(LOCK)", e

]

absinc = sav_absinc

coolant = sav_coolant


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