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:

Custom drill cycle for a pin stop?


Recommended Posts

I am wanting to be able to use a custom drilled cycle in mastercam.  But have the post out put for a pin stop.  I am using mastercam 2017.  

This is how I would like it to put out.  When I can just set my drill depth as the pins depth on the g1 line.

N24 T24 M6
G0 G90 G54 X.6795 Y2.1575 S0 M5
G43 H24 Z.1 T3
G01 Z-.2 F30.
M0
Z.1 M9
G91 G28 Z0.
M01

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

I use the point toolpath for pin stops all the time.  Posted code is identical to what the OP is looking for.

What would I modify in the post to omit the "S0 M5"?  The control doesn't like it, and I always seem to forget to remove it from the program before I release it to the floor.  Seems to me a simple If/Then type logic would work, but I haven't messed with post modification since X5.

Link to comment
Share on other sites

Yes, I also like using the Point Toolpath for Pin Stop Operations.

To suppress the Spindle output, it depends on which Post Processor you started with as your "Base Post". Was it "MPMaster" or a "Generic Fanuc" Post from CNC Software?

Here is how to do it in MPMaster:

  1. Typically, the Pin Stop will be the "First Operation" output. So the first Tool Change goes through 'psof$', which in turn calls 'ptlchg_com'.
  2. We need to "suppress" the Spindle Speed (S0) and the Spindle Off M-code (M05). These are both output through 'pfspindleout', since this is the 1st Tool Change call, the spindle output is always forced.

Make the following modifications to 'pfspindleout':

pfspindleout     #Spindle speed and M code output forced    
      if not((opcode$ = 3 | opcode$ = 16) & nextdc$ = 3 & rigid_tap) & tool_op$ <> 19, *speed, *spindle

The secret is using the 'tool_op$' variable to discern that the operation is a Pin Stop.

 If we make that modification alone, here is what I get from MPMaster for code:

%
O0000 (Pin_Stop)
(MCX FILE  - D:\EMASTERCAM\PIN_STOP.MCAM)
(PROGRAM   - Pin_Stop.NC)
(DATE      - MAR-18-2018)
(TIME      - 11:15 PM)
(T40  - 3/8 .DOWEL PIN       - H40  - D40  - D0.3750")
(T1   - 1/4 FLAT ENDMILL     - H1   - D1   - D0.2500")
(OVERALL MAX - Z10.)
(OVERALL MIN - Z0.)
N5 G00 G17 G20 G40 G80 G90
N10 G91 G28 Z0.
N15 (PIN STOP)
N20 (COMPENSATION TYPE - COMPUTER)
N25 T40 M06 (3/8 .DOWEL PIN)
N30 (MAX - Z10.)
N35 (MIN - Z3.)
N40 G00 G17 G90 G54 X0. Y0.
N45 G43 H40 Z10.
N50 G94 G01 Z3. F20.
N55 M05
N60 G91 G28 Z0.
N65 M01
N70 (COMPENSATION TYPE - COMPUTER)
N75 T1 M06 (1/4 FLAT ENDMILL)

This is close, we got what we were after, but we are still getting an errant "M05" at the end of the Operation.

Why is that?

If we use the Debugger, we can see that in 'pretract' the "M05" is forced:

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

It is the line with the "*sm05" that is causing our line with just "M05" to be output. Let's modify the 'pretract' Post Block, to account for this.

First, we need to be able to tell what the "last" value of 'tool_op$' was.

Find the 'last' variable section, (search for "Last variables" ). Add the 'last_tool_op' variable initialization:


#Last variables (see plast)
last_op_id       : 0
last_cuttype     : 0
last_rot_axis    : 0
last_rotary_type : 0
last_tlplnno     : 0
last_mr1         : 0
last_mr2         : 0
last_tool_op     : 0    #Add this var to the list

Then, find the 'plast' Post Block, and add this line of code:

plast
      last_op_id = op_id$
      last_cuttype = cuttype
      last_rotary_type = rotary_type$
      last_tlplnno = tlplnno$
      last_mr1 = mr1$
      last_mr2 = mr2$
      last_tool_op = tool_op$

This will allow you now to make the following changes to 'pretract':

pretract        #End of tool path, toolchange
      phsm_off
      sav_absinc = absinc$
      absinc$ = one
      sav_coolant = coolant$
      coolant$ = zero

#      if nextop$ = 1003, #Uncomment this line to leave coolant on until eof unless
#        [                 #  explicitely turned off through a canned text edit
        if all_cool_off,
          [
          #all coolant off with a single off code here
          if coolant_on, pbld, n$, *sall_cool_off, e$
          coolant_on = zero
          ]
        else,
          [
          local_int = zero
          coolantx = zero
          while local_int < 20,
            [
            coolantx = and(2^local_int, coolant_on)
            local_int = local_int + one
            if coolantx > zero,
              [
              coolantx = local_int
              pbld, n$, scoolantx, e$
              ]
            coolantx = zero
            ]
          coolant_on = zero
          ]
#        ]

      #cc_pos is reset in the toolchange here
      cc_pos$ = zero
      if convert_rpd$ = one,
        [
        gcode$ = one
        feed = maxfeedpm
        ipr_type = zero
        ]
      else, gcode$ = zero
      if last_tool_op = 19,
        [
        pbld, n$, "M00", "(PIN-STOP, BUMP STOCK AGAINST PIN)", e$
        pbld, n$, *sgcode, "G90", "G53", "G49", "Z0.", e$ #Safe Retract Line, after Pin Stop
        ]
      else,
        [
        pbld, n$, sccomp, *sm05, psub_end_mny, e$ #Output Comp Off and Spindle Off at end of Operation
        pbld, n$, sgabsinc, sgcode, [if gcode$ = 1, sgfeed], *sg28, "Z0.", [if gcode$ = 1, feed], scoolant, e$
        ]
#      if lock_codes = one & rot_on_x, pbld, n$, *sunlock, sunlockcomm, e$
#      pbld, n$, *sg28, "X0.", "Y0.", protretinc, e$
#      if lock_codes = one & rot_on_x & cuttype = 0, pbld, n$, *slock, slockcomm, e$
      if abs(fmtrnd(cabs)) > 360 & nextop$ <> 1003 & not(index),
        [
        if lock_codes = one, pbld, n$, *sunlock, sunlockcomm, e$
        rotretflg = 1
        pbld, n$, `sg28, protretinc, e$
        rotretflg = 0
        if lock_codes = one & cuttype = 0, pbld, n$, *slock, slockcomm, e$
        ]
      absinc$ = sav_absinc
      coolant$ = sav_coolant
      uninhibit_probe$

 

Which gives us the following output:

%
O0000 (Pin_Stop)
(MCX FILE  - D:\EMASTERCAM\PIN_STOP.MCAM)
(PROGRAM   - Pin_Stop.NC)
(DATE      - MAR-18-2018)
(TIME      - 11:15 PM)
(T40  - 3/8 .DOWEL PIN       - H40  - D40  - D0.3750")
(T1   - 1/4 FLAT ENDMILL     - H1   - D1   - D0.2500")
(OVERALL MAX - Z10.)
(OVERALL MIN - Z0.)
N5 G00 G17 G20 G40 G80 G90
N10 G91 G28 Z0.
N15 (PIN STOP)
N20 (COMPENSATION TYPE - COMPUTER)
N25 T40 M06 (3/8 .DOWEL PIN)
N30 (MAX - Z10.)
N35 (MIN - Z3.)
N40 G00 G17 G90 G54 X0. Y0.
N45 G43 H40 Z10.
N50 G94 G01 Z3. F20.
N55 M00 (PIN-STOP, BUMP STOCK AGAINST PIN)
N60 G00 G90 G53 G49 Z0.
N65 M01
N70 (COMPENSATION TYPE - COMPUTER)
N75 T1 M06 (1/4 FLAT ENDMILL)
N80 (MAX - Z.25)
N85 (MIN - Z0.)
N90 G00 G17 G90 G54 X-2.397 Y-.5233 S2139 M03
N95 G43 H1 Z.25
N100 Z.2
N105 G94 G01 Z0. F6.42
N110 X-2.147

 

 

  • Thanks 1
  • Like 2
Link to comment
Share on other sites

For anyone playing along at home with this, here is how I created the Pin Stop Operation.

I created a Point Toolpath. The Point Toolpath Selection dialog opens, and is set to Rapid Mode by default. I hit "Spacebar" on the keyboard, to enter the "Quick Point" Entry method, and banged out "0, 0, 10", which gives me a Point at X0., Y0., Z10. for my first location.

I then switch to "Feed Mode (G1)" in the dialog, hit Spacebar again, and enter my "Pin Stop" location of 0, 0, 3.

Then, I hit "Ok" to finish entering my 2 points (initial location, and Pin Stop location). I select my "Tool" in the dialog (a Flat endmill with the correct diameter), and enter "0" in the Speed, and "20" in the Feed. (Or whatever Feed value you want).

(It could be any location, relative to "zero" where you want to put the pin. Maybe you want your "stock" positioned "-.100" from "X0". So you would move "-.1", plus the radius of the pin you are using. For a 1/2" dowel pin, add .25. So your "Point" might be -.35, -2, 1, to put the pin you are using at the correct X location for you to bump the stock up against.)

I used T40, and I get a Tool Change to T40, with an initial position at G54 X0 Y0, and a TLO Comp Line of G43 H40 Z10. Then, the tool "feeds" to my "Pin Stop" location.

We leveraged the "pretract" mechanism, which controls "Retracts" at the end of a Tool Change event, to output our "Pin Stop" code, based on the value of the variable 'tool_op$', which we added to our "last" variables list. This allows us to check at the 'retract' event to see what kind of Operation we had just finished completing.

For anyone using an Okuma Mill, there is a special trick required to get this to work on your machine, since it won't allow the machine to "move" while the spindle isn't cutting.

You'll need a "M130" to enable "cutting with the spindle off".

So we can modify as follows:

pfspindleout     #Spindle speed and M code output forced    
      if not((opcode$ = 3 | opcode$ = 16) & nextdc$ = 3 & rigid_tap) & tool_op$ <> 19, *speed, *spindle
      if tool_op$ = 19, "M130" #Allow feed without spindle motion

 

I would then modify my entry in "pretract" to output a "M131" after the "M00" was complete.

      if last_tool_op = 19,
        [
        pbld, n$, "M00", "(PIN-STOP, BUMP STOCK AGAINST PIN)", e$
        pbld, n$, *sgcode, "G90", "G53", "G49", "Z0.", e$ #Safe Retract Line, after Pin Stop
        pbld, n$, "M131", "(SPINDLE WITH FEED REQUIRED)", e$
        ]

 

  • Like 2
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...