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:

Recommended Posts

To all,

I have visited this form many times learning a lot about editing my post and a few dif things However I am stumped now.

I Have programmed with mastercam for over 20 yrs and our latest version of MC is X3 because my boss wont let me upgrade to the newest ver but we really dont need it cause what we have works and have not bought a new machine in yrs until a few months ago. We bought a new Haas VF3 and I know there is a lot of ppl out there that dont like them but I love it for now. Anyway to my point, I have a good working post and have been moding it to fit my needs. I added a custom drill cycle to peck tap and Have got that to work how I like but I also want to add a Programmable stop so I dont have to manually edit the Program every time. Right now I just do a normal drill cycle in the location I want my stop to get this code:

 

G0 G17 G40 G49 G80 G90

( 3/8 DOWELL | )

T19 M6

G0 G90 G54 X-1.3939 Y.1561 S0 M5

G43 H19 Z2.

G98 G81 Z-.5 R0. F110.

G80

M5

G91 G28 Z0.

 

Then I edit it to look like this:

 

 

G0 G17 G40 G49 G80 G90

( 3/8 DOWELL | )

T19 M6

G0 G90 G54 X-1.3939 Y.1561

G43 H19 Z2.

G1 Z-.5 F110.

M00

G91 G28 Z0.

 

How can I add a custom drill cycle to post out what I edit?

Like I said before I did add a peck tap cycle to the post like this:

 

 

pdrlcst$ #Custom drill cycles 8 - 19 (user option)

if drillcyc$ = 9,

[

numpeck = peck2$,

[

peck_cnt = numpeck

initial_calc = (depth$ - tosz$) / peck_cnt

strt_depth = (tosz$ + initial_calc)

calc_depth = (depth$ - tosz$)

calc_peck = calc_depth / numpeck

#"(PECK tapping CYCLE)", e$

pcan1, pbld, n$, *sgdrlref, *sg84, pdrlxy, *strt_depth, pcout, prdrlout, *feed, strcantext, e$

count = peck_cnt

]

pass = 1

WHILE count > 1,

[

sub_depth = strt_depth + (calc_peck * pass)

pbld, n$, *sg84, *sub_depth, *refht_a, e$

pass = pass + 1

count = count - 1

]

#pbld, n$, sg84, pfzout, *refht_a, e$

pcom_movea

]

and it works like I want thanks to the sample of John Paris post I just had to change a little to get to work for me.

My question is what would I use to output the code I need as shown above in my edited code, also where and how would I add it to the PST file to still use my peck tap

and also a stop under the custom drill cycle section? Any Ideas?

 

 

Thanks,

Brian Pugh

Mastercam x3

Link to comment
Share on other sites

Yes I want it to post M00 every time but I want it for a part stop not for my tapping cycle, I just put that in my last form post showing what I have now as my first custom drill cycle and how do I add a 2nd custom drill cycle to that and still have both to work, I need something to post out a code that looks like this:

G0 G17 G40 G49 G80 G90

( 3/8 DOWELL | )

T19 M6

G0 G90 G54 X-1.3939 Y.1561

G43 H19 Z2.

G1 Z-.5 F110.

M00

G91 G28 Z0.

 

I use a 3/8 Dowel pin to come down ( not turning) and stop at my zero location, I put the part against the dowel, tighten vise and press cycle start that the z rapids up to start the next tool.

 

Thanks,

Brian

mastercam x3 (yes its old)

Haas VF3 2013

Link to comment
Share on other sites

I have modified my post to 'read' the tool description. If I identify a tool as a dowel, the post will not output a speed or M3 command, and will output a M0 when depth is reached.

 

This is more work on the post side, but after the logic is in place, it makes the desired output very easy.

Link to comment
Share on other sites

I have modified my post to 'read' the tool description. If I identify a tool as a dowel, the post will not output a speed or M3 command, and will output a M0 when depth is reached.

 

This is more work on the post side, but after the logic is in place, it makes the desired output very easy.

That is something like I am looking to do. I could do what FNMI said but then I would have to use one of my canned cycles and mod one of those but I was really hoping to use a custom cycle. Could you show me some examples of your post that looks for a dowel?

Link to comment
Share on other sites

sdr08 : "1/4 dowel stop" # " "

 

[drill cycle 10]

1. "Dowel Pin Stop"

2. ""

3. ""

4. ""

5. ""

6. ""

7. ""

8. ""

9. ""

10. ""

11. ""

 

pdrlcst$ #Custom drill cycles 8 - 19 (user option)

#Use this postblock to customize drilling cycles 8 - 19

pdrlcommonb

if drillcyc$ = 8,

[

sub_prg_call = peck1$

pcan1, pbld, n$, *sg00, *sgabsinc, pfxout, pfyout, pfcout, pindexdrl, strcantext, e$

pbld, n$, "M98", *sub_prg_call, e$

]

else,

[

##"CUSTOMIZABLE DRILL CYCLE ", pfxout, pfyout, pfzout, pfcout, pindexdrl, e$

pcan1, pbld, n$, *sg01, pdrlxy, pfzout, pcout, pindexdrl, *feed, strcantext, e$

pbld, n$, "M00", scomm_str, "MOVE PART TO STOP", scomm_end, e$

]

pcom_movea

 

this will set up a drill cycle to use for dowel stop, which results in the code snipet below:

 

%

O0000 (OP-1)

(TIME - 07:05)

(T1 - 1/4 DOWELL PIN )

(WCS NAME - TOP)

G00 G17 G40 G80 G90

T1 M06 ( 1/4 DOWELL PIN )

(MAX - Z1.)

(MIN - Z-.5)

G00 G17 G90 G54 X0. Y0.

G43 H1 Z1.

G94

G01 Z-.5 F14.67

M00 ( MOVE PART TO STOP )

G91 G28 Z0.

G0 G90 G154 P20 X0 Y0

M30

%

Link to comment
Share on other sites

First, you need to define a variable to hold an integer, like this:

fmt	 4 dowelchk	 #Check for "DOWEL" in comment

 

Next, define the string that you want to look for:

sdowelchk : "DOWEL"

 

Add this to pcomment$:

pcomment$	 #Comment from manual entry
 scomm$ = ucase (scomm$)
 dowelchk = strstr (sdowelchk, scomm$)

 

Now, in pdrill$:

pdrill$		 #Canned Drill Cycle
 if dowelchk <> 0,
 [
	 # Insert Code For Dowel Pin
	 dowelchk = 0
 ]
 else,
 [
	 # Normal Drill Code Here
 ]

 

This will give you the output that you want.

Link to comment
Share on other sites

Ex-programmer I see the concept and how your code should work and I like how it can be use for so many dif things but for some reason I cant get it to work for me I have put DOWEL in every comment place there is with nothing, now I'm not 100% what the code should be to have the dowel come down and stop but I used a combo of a few suggestions above and no joy, it just posts out a normal G81 drill cycle.

Link to comment
Share on other sites

When I am troubleshooting a new section of my post, I force the status of the non-working variables to be output at each stage of calculation. For example, if I did not get the expected results from the variable dowelchk, I would temporarily insert this line to see the real status of the variable at that point of the post:

 "(postblock pdrill$, dowelchk =", *dowelchk, ")", e$

 

If the variable is not the expected value, then insert this code at every location that the variable is manipulated, and you will find the error somewhere.

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

OK I know this is a bit old but I am revisiting this because last time I could never get this to work. I got busy and kind of forgot about it but now I could really use it again so maybe I can understand how to edit my post to get it to work if someone would be so kind to explain it or show an example that I can just cut and paste. What I want to do is have a programmable stop where  I can get this code to  post out

G0 G17 G40 G49 G80 G90
( 3/8 DOWELL | )
T19 M6
G0 G90 G54 X-1.3939 Y.1561 
G43 H19 Z2.
G1 Z-.5 F110.
M00


G91 G28 Z0.

 Here is the drill part of my post now ( the part about dowel I added but could not get to work):

# --------------------------------------------------------------------------
# Drilling
# --------------------------------------------------------------------------
pdrill0$         #Pre-process before drill call
      sav_dgcode = gcode$ #Capture gcode for 5 axis drill
 
pdrlcommonb     #Canned Drill Cycle common call, before
      if initht$ <> refht$, drillref = zero
      else, drillref = one
      if sav_dgcode = 81,
        [
        result = newfs(two, zinc)
        if drillcyc$ = three | drillcyc$ = 7, drlgsel = fsg1(-ss$) + drillcyc$ * two
        else, drlgsel = fsg2(dwell$) + drillcyc$ * two
        prv_refht_a = c9k
        prv_refht_i = c9k
        prv_dwell$ = zero
        prv_shftdrl$ = zero
        ]
      if cuttype = three, sav_dgcode = gcode$
      else, z$ = depth$
      if cuttype = one, prv_zia = initht$ + (rotdia$/two)
      else, prv_zia = initht$
      pcom_moveb
      feed = fr_pos$
      comment$
      pcan
      #5 axis must map the true Z, correct Z calculation here
      if cuttype = three,
        [
        prv_zia = zabs + (-depth$) + initht$
        zia = fmtrnd(zabs)
        zinc = zia - prv_zia
        ]
 
prdrlout        #R drill position
      if cuttype = one, refht_a = refht$ + (rotdia$ / two)
      else, refht_a = refht$
      refht_i = refht$ - initht$
      if cuttype = three, refht_a = w$
      if absinc$ = zero, refht_a, !refht_i
      else, refht_i, !refht_a
 
pdrill$          #Canned Drill Cycle
      pdrlcommonb
    if dowelchk <> 0,
         [
"(postblock pdrill$, dowelchk =", *dowelchk, ")", e$
               pcan1, pbld, n$, "M00",  e$,  # Insert Code For Dowel Pin
                 dowelchk = 0
         ]
         else,
         [
            pcan1, pbld, n$, *sgdrlref, *sgdrill, pxout, pyout, pfzout, pcout,
        prdrlout, dwell$, *feed, strcantext, e$
      pcom_movea
         ]
      
 
ppeck$           #Canned Peck Drill Cycle
      pdrlcommonb
      pcan1, pbld, n$, *sgdrlref, *sgdrill, pxout, pyout, pfzout, pcout,
        prdrlout, *peck1$, *feed, strcantext, e$
      pcom_movea
 
pchpbrk$         #Canned Chip Break Cycle
      pdrlcommonb
      pcan1, pbld, n$, *sgdrlref, *sgdrill, pxout, pyout, pfzout, pcout,
        prdrlout, *peck1$, *feed, strcantext, e$
      pcom_movea
 
ptap$            #Canned Tap Cycle
      pdrlcommonb
      pcan1, pbld, n$, *sgdrlref, *sgdrill, pxout, pyout, pfzout, pcout,
        prdrlout, *feed, strcantext, e$
      pcom_movea
 
pbore1$          #Canned Bore #1 Cycle
      pdrlcommonb
      pcan1, pbld, n$, *sgdrlref, *sgdrill, pxout, pyout, pfzout, pcout,
        prdrlout, dwell$, *feed, strcantext, e$
      pcom_movea
 
pbore2$          #Canned Bore #2 Cycle
      pdrlcommonb
      pcan1, pbld, n$, *sgdrlref, *sgdrill, pxout, pyout, pfzout, pcout,
        prdrlout, *feed, strcantext, e$
      pcom_movea
 
pmisc1$          #Canned Fine Bore (shift) Cycle
      pdrlcommonb
      pcan1, pbld, n$, *sgdrlref, *sgdrill, pxout, pyout, pfzout, pcout,
        prdrlout, shftdrl$, dwell$, *feed, strcantext, e$
      pcom_movea
 
pmisc2$          #Canned Rigid Tapping Cycle
      pdrlcommonb
      #RH/LH based on spindle direction
      result = newfs(12, feed)
      pcan1, pbld, n$, *sgdrlref, *sgdrill, pxout, pyout, pfzout, pcout,
        prdrlout, *feed, strcantext, e$
      pcom_movea
#*********************************************************************************************************************************************************************************************
pdrlcst$         #Custom drill cycles 8 - 19 (user option)
 
 
 
      if drillcyc$ = 9,
 
      [
 
      numpeck = peck2$,
      
      [
 
      peck_cnt = numpeck
 
      initial_calc = (depth$ - tosz$) / peck_cnt
 
      strt_depth = (tosz$ + initial_calc)
 
      calc_depth = (depth$ - tosz$)
 
      calc_peck = calc_depth / numpeck
 
      "(PECK tapping CYCLE)", e$
 
      pcan1, pbld, n$, *sgdrlref, *sg84, pdrlxy, *strt_depth, pcout, prdrlout,*refht_a, *feed, strcantext, e$
 
      count = peck_cnt 
 
       ]
 
      pass = 1
 
      WHILE count > 1,
 
       [
 
       sub_depth = strt_depth + (calc_peck * pass)
 
       pbld, n$, *sg84, *sub_depth, *refht_a, e$
 
       pass = pass + 1
 
       count = count - 1
 
      ]
 
       #pbld, n$, sg84, pfzout, *refht_a, e$
 
       pcom_movea
 
      ]
 
pdrlcst8         #Canned Descending Peck Drill Cycle
      pdrlcommonb
      result = nwadrs(stri, peck1$)
      pcan1, pbld, n$, *sgdrlref, *sgdrill, pxout, pyout, pfzout, pcout,
        prdrlout, *peck1$, *peck2$, *peckclr$, *feed, strcantext, e$
      pcom_movea
 
# ADDITIONAL HOLES
 
pdrill_2$        #Canned Drill Cycle, additional points
      pdrlcommonb
      pcan1, pbld, n$, pxout, pyout, pzout, pcout, prdrlout, feed, strcantext, e$
      pcom_movea
 
ppeck_2$         #Canned Peck Drill Cycle
      pdrill_2$
 
pchpbrk_2$       #Canned Chip Break Cycle
      pdrill_2$
 
ptap_2$          #Canned Tap Cycle
      pdrill_2$
 
pbore1_2$        #Canned Bore #1 Cycle
      pdrill_2$
 
pbore2_2$        #Canned Bore #2 Cycle
      pdrill_2$
 
pmisc1_2$        #Canned Fine Bore (shift) Cycle
      pdrill_2$
 
pmisc2_2$        #Canned Rigid Tapping Cycle
      pdrlcommonb
      pcan1, pbld, n$, pxout, pyout, pzout, pcout, prdrlout, strcantext, e$
      pcom_movea
#*************************************************************************************************************************************************************************************************
pdrlcst_2$       #Custom drill cycles 8 - 19, additional points (user option)
      if drillcyc$ = 9,
 
      [
 
      numpeck = peck2$,
 
      
      if stepeck = 0,
 
      [
 
      peck_cnt = numpeck
 
      initial_calc = (depth$ - tosz$) / peck_cnt
 
      strt_depth = (tosz$ + initial_calc)
 
      calc_depth = (depth$ - tosz$)
 
      calc_peck = calc_depth / numpeck
 
      "(PECK tapping CYCLE)", e$
      pdrlcommonb
      *SG00 pcan1, pbld, n$, pfxout, pfyout, e$
  *sg84, pcout, *strt_depth, prdrlout, *refht_a, *feed, strcantext, e$
 
      count = peck_cnt 
 
       ]
 
        pass = 1
 
      WHILE count > 1,
 
       [
 
       sub_depth = strt_depth + (calc_peck * pass)
 
       pbld, n$, *sg84, *sub_depth, *refht_a, e$
 
       pass = pass + 1
 
       count = count - 1
 
      ]
 
      #pbld, n$, sg84, pfzout, *refht_a, e$
 
       pcom_movea
 
      ]
      
 
pcanceldc$       #Cancel canned drill cycle
      result = newfs(9, feed)
      result = newfs(three, zinc)
      result = nwadrs(strq, peck1$)
      z$ = initht$
      if cuttype = one, prv_zia = initht$ + (rotdia$/two)
      else, prv_zia = initht$
      pxyzcout
      !zabs, !zinc
      prv_gcode$ = zero
      pcan
      pcan1, pbld, n$, sg80, strcantext, e$
      pcan2
 

 

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

Update..... I have been able to get the post to almost work. I just need to know how to keep from posting out S0M5 because HAAS control don't like that and reason I need to do all this so if others post out programs if Im not here they work because no one here really knows how to edit or hand write programs but me but they can pull up programs and post that I have written.

Link to comment
Share on other sites

Update..... I have been able to get the post to almost work. I just need to know how to keep from posting out S0M5 because HAAS control don't like that and reason I need to do all this so if others post out programs if Im not here they work because no one here really knows how to edit or hand write programs but me but they can pull up programs and post that I have written.

 

That is controlled in the toolchange section of the post where the spindle speed is called. You will need to put some logic in there to look at the drillcyc being used and if it is called to then output something different.

Link to comment
Share on other sites

Ok, to get this to work, you need to take advantage of the "next" variables. This is because the post is setup to process data as it is presented in the NCI File. What this means is that the Tool Change codes in the NCI are output before the Drill Cycle info.

 

There is not a real way to look "forward" in the NCI during NC output. So CNC Software invented a mechanism that helps take care of this for you.

 

You should have the variable 'getnextop$' initialized to '1' at the start of your post. This tells MP to build the "next variable" table. It does this during the 'NCI Pre-Read' cycle. The get next op routine can scan the NCI, and get info about what is coming "next" in the NCI.

 

Once the routine is enabled, MP will fill pre-defined variables that allow you to "look ahead", but only for certain situations.

 

For Drilling, the secret is to check the variable 'nextdc$'. This variable will hold the value of the next NCI 81 'drillcyc$' value.

 

So at the tool change or SOF, you can add something like this:

 

if nextdc$ = 8, pcan1, n$, sgcode, sgabsinc, pwcs, pfxout, pfyout, strcantext, e$

else, pcan1, n$, sgcode, sgabsinc, pwcs, pfxout, pfyout, *spindle, *speed, strcantext, e$

 

I'm writing the start codes from memory, so yours probably looks a little different. The important thing is to add the if/else statement that checks the value of 'nextdc$' and outputs spindle speed only when the drill cycle value does not match your dowel check.

 

Keep in mind that the 8 canned drill cycles are numbered 0-7. So '8' is the first custom drill cycle number...

 

Hope that helps,

 

Colin

  • Like 2
Link to comment
Share on other sites

ok thanks for the info Colin I will give it a shot and see if I can get it to work. I tried one of the "if" statements as shown in an example above from someone else  ( along with a few other things) but I couldn't get it to work and not saying it won't but just wasn't given enuff info to figure it out.

Link to comment
Share on other sites

Ok, to get this to work, you need to take advantage of the "next" variables. This is because the post is setup to process data as it is presented in the NCI File. What this means is that the Tool Change codes in the NCI are output before the Drill Cycle info.

 

There is not a real way to look "forward" in the NCI during NC output. So CNC Software invented a mechanism that helps take care of this for you.

 

You should have the variable 'getnextop$' initialized to '1' at the start of your post. This tells MP to build the "next variable" table. It does this during the 'NCI Pre-Read' cycle. The get next op routine can scan the NCI, and get info about what is coming "next" in the NCI.

 

Once the routine is enabled, MP will fill pre-defined variables that allow you to "look ahead", but only for certain situations.

 

For Drilling, the secret is to check the variable 'nextdc$'. This variable will hold the value of the next NCI 81 'drillcyc$' value.

 

So at the tool change or SOF, you can add something like this:

 

if nextdc$ = 8, pcan1, n$, sgcode, sgabsinc, pwcs, pfxout, pfyout, strcantext, e$

else, pcan1, n$, sgcode, sgabsinc, pwcs, pfxout, pfyout, *spindle, *speed, strcantext, e$

 

I'm writing the start codes from memory, so yours probably looks a little different. The important thing is to add the if/else statement that checks the value of 'nextdc$' and outputs spindle speed only when the drill cycle value does not match your dowel check.

 

Keep in mind that the 8 canned drill cycles are numbered 0-7. So '8' is the first custom drill cycle number...

 

Hope that helps,

 

Colin

OK Ran in to my first issue I dont have a "nextdc$" of any sort I do have "drillcyc$" and the "getnextop$" that you stated. I'm guessing I need to use "drillcyc$" so im going to try it until I hope to hear back from someone but thanks for everyones help I have been working on this a while as you can see and no our dealer wont help because they want us to buy the newest ver and the owner wont do it due to $$ and what we have works for what we do in his eyes. He hates software as much as insurance companys.

Link to comment
Share on other sites

OK Ran in to my first issue I dont have a "nextdc$" of any sort I do have "drillcyc$" and the "getnextop$" that you stated.

I could be wrong but I believe nextdc$ is a system variable and even if you don't currently have it in your post you can use it.

  • Like 1
Link to comment
Share on other sites

Well thanks to everyone's help and I thought I had it before but just needed to get rid of the s0m5 but I was wrong. Im about to just give up cause I have tried every example here and other places. I tried combining diff things  and even tried editing the mpmaster post where again, I could get all my other edits to work but just cant get this dowel pin stop to work to save my life. I understand the logic and how it should work but it just don't for me and I'm sure its prob something dirt simple I'm over looking somewhere. I'm sure I will revisit it again but just wanted to thank those who tried to help. :ouch:

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