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:

Drilling Subroutine issues


Recommended Posts

Bear with me X9 guys. We do not use canned drilling cycles on our routers. Mostly because the cycles run faster in long hand, but it gives me more control on what the tool is doing on the back end. Deep holes in particular. That's just how it is going to stay on the router. The operators prefer it, and so do I. It is not an issue on the mills and lathes because they can flood with coolant when needed.

 

Having said that, Mastercam does not convert the custom drill cycles to long hand. That's fine because I wrote my own code for them anyway. The way the built-in subroutine function functions does not work so well for the long hand drill cycles just plain doesn't work me, as it generates a crapload of code that negates using it in the first place. We try and keep the file sizes as small as possible. We've had to use the transform function to generate the pointes and a single subroutine with only the plunge depths.

 

I was able to create a custom drilling subroutine function that allows me to select all the points on a single operation and outputs the code as stated above. The problem is that it work flawlessly with the custom cycles, but refuses to perform on the long hand conversions of standard drillcyc$ 1-7. Mastercam tells me that I cannot merge a subroutine with itself when posting. Apparently,  Mastercam flags the longhand code as a subroutine. I've tried turning on the the canned cycles and writing the code by hand and anything else I could think of to no avail. I cannot find anywhere in the mpmaster docs how the conversion to long hand is handled.

 

Does anyone have any idea how to trick the software into letting me use the custom code on the canned cycles?

Link to comment
Share on other sites

Output like a standard call for subroutine:

 

N81M01( -.4724 DIA- 12MM LOW HELIX DRILL )
(MAIN CHANNEL PREP)
G0G17G40G49G64G69G80G90G53Z0M5
T2008M06( -.4724 DIA- 12MM LOW HELIX DRILL )
T102
G0G90G17G54X5.968Y6.4596S2500M3
G43Z1.H8M8
G8P1
M98P2290
X11.2936Y6.7661
M98P2290
X16.9564Y6.7661
M98P2290
X22.2779Y6.4173
M98P2290
...etc......
M30
O2290( DRILL SUB, ONS_ROW4_ACB REV1 -OP2)
(N81 T8 -.4724 DIA- 12MM LOW HELIX DRILL)
G90
Z.5
G1Z-.5F75.
G0Z.5
Z-.47
G1Z-1.
G0Z.5
Z-.97
G1Z-1.5
G0Z.5
G0Z1.
M99

 

This cannot be done using G83 long hand function. 

Link to comment
Share on other sites

The problem is how MP generates that output. Look at the NC File. There are still only 3 Drill Points - 1 of them is a G81, and you get 2 G100 cycles.

 

You are also overthinking this I think. There is a mechanism for outputting a Canned Cycle. Use that to your advantage.

 

Turn on support for the Drilling Canned Cycles in the Control Definition. This will force the output through two post blocks:

 

'pdrill$ / pdrill_2$'

'ppeck$ / ppeck_2$'

 

So you get two sections that you'll need to modify to output code.

 

Take the 'ppeck$' for example, and suppress the normal canned cycle output. Then output your "sub call", and then add your own code to the rest of the post block to calculate and output the Subroutine G0/G1 moves. Don't rely on the "long-hand" mechanism in Mastercam; create your own.

 

Here is some sample output I generated, really quickly:

%
O0000 (T)
(MCX FILE  - T)
(PROGRAM   - T.nc)
(DATE      - SEP-22-2016)
(TIME      - 8:09 PM)
(T107 -  17/64 DRILL         - H0   - D0   - D0.2656")
N100 G00 G17 G20 G40 G80 G90
N110 G91 G28 Z0.
N120 T107 M06 ( 17/64 DRILL)
N130 (MAX - Z.1)
N140 (MIN - Z-2.)
N150 G00 G17 G90 G54 X-2.1848 Y-.5951 S1006 M03
N160 G43 H0 Z.1
N170 G94
N180 M98 P2349
N230 X-1.0885 Y-.6343
N240 M98 P2349
N250 X.8066 Y-.7831
N260 M98 P2349
N270 G80
N280 M05
N290 G91 G28 Z0.
N300 G28 Y0.
N310 G90
N320 M30

N190 O2349
N200 This is a test of Sub File
N210 This is only a test
N220 M99

%

And here are the only mods:

 

'ppeck$':

ppeck$           #Canned Peck Drill Cycle
      pdrlcommonb
      
	  
	  #pcan1, pbld, n$, *sgdrlref, *sgdrill, pdrlxy, pfzout, pcout, pindexdrl,
      #  prdrlout, *peck1$, [if haas, *peck2$, *peckclr$], *feed, strcantext, e$
		n$, "M98 P2349", e$
		
      subout$ = 1
	  *e$
	  n$, "O2349", e$
	  n$, "This is a test of Sub File",e$
	  n$, "This is only a test", e$
	  n$, "M99", e$
	  *e$
	  subout$ = 0

and, 'ppeck_2$':

ppeck_2$         #Canned Peck Drill Cycle
      pdrlcommonb
      
	  pcan1, pbld, n$, pdrlxy, e$
      n$, "M98 P2349", e$
	  pcom_movea

Now, admittedly, I hand-coded the Subroutine program number. I would recommend not doing that. You could use the "Additional Drill Parameters" for each cycle if you want to pass distinct values.

 

All I did was set 'subout$ = 1' and then 'subout$ = 0' to "jump to the Subroutine File, and then return to normal processing.

 

Note that you only want to output the Sub "once", so only output to the Sub File from the '1st drill point' block. (pdrill$, ppeck$, ptap$, ect.)

 

Then, only output the new XY positions, and the "sub call" from the "additional drill points" blocks (_2 <<< They all end with "_2")

Link to comment
Share on other sites

It seems you're right again Colin. I was overthinking the issue. In my last attempt, I was still relying on the log hand to get my subroutine and then forcing the canned cycle on to get get the additional points.  When I suppressed the merge and clear, I realised that I was getting two separate subs with the same# in the ext file. That's why I was getting the error that I was. You're the man sir!

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