Machsupport Forum

G-Code, CAD, and CAM => G-Code, CAD, and CAM discussions => Topic started by: lew on November 06, 2010, 09:00:37 AM

Title: Peck drilling in the X axis
Post by: lew on November 06, 2010, 09:00:37 AM
I've got a right angle head on my mill and I'm trying to drill a very long hole in the x axis. Is there a way to program this move with X going in the positive direction? I've used G17 to select the yz plane and programmed G83 to drill but the table moves in the negative direction. I'm trying to move the table in the positive direction while peck drilling.
Thanks in advance.
Title: Re: Peck drilling in the X axis
Post by: lew on November 06, 2010, 09:22:00 AM
OOPS, I meant G19 to select the yz plane
Here's the code that doesn't work - get an error that says R value less than X.
g90
g19
g83 x10.5 r0.05 p0.0 q0.50 f5.0
g80
g0 x0.0
m30

If I put a negative sign in front of the 10.5 then it works but goes the wrong way.
Title: Re: Peck drilling in the X axis
Post by: BR549 on November 06, 2010, 10:53:47 AM
I think you will find that all the canned cycles "assume" you are drilling in the neg direction.  So it will not except the R.05. and would not drill in the positve direction.

So in your case you cannot use the g83 to drill in the positive direction.



(;-) TP
Title: Re: Peck drilling in the X axis
Post by: lew on November 06, 2010, 11:05:12 AM
Thanks for the reply. I believe you to be correct. Of course, I can set the job up so that the drill points in the negative direction. But, I was wondering if you have any simple code that would let the x axis act in the manner that I want. I tried working up a math expression with the "if" statement but it will take some additional learning on my part to get the syntax right.
Thanks again.
Title: Re: Peck drilling in the X axis
Post by: BR549 on November 06, 2010, 11:21:53 AM
You can create the same motion using an Mcode(macro) or a subroutine. I'll look in the bag of tricks and see if I can dig up what you need.

(;-) TP
Title: Re: Peck drilling in the X axis
Post by: lew on November 06, 2010, 11:32:53 AM
Here's what I started doing and then got busy with something else.

#n=0.3
#p=0.3
#1=3.0


10 g90
g0 x0.49
g1 x[.49+#n] f#1
g0 x0.49
#p=[#p+#n]
if#p<13.0 then 10
g0 x0.0
m30
Title: Re: Peck drilling in the X axis
Post by: lew on November 06, 2010, 12:09:11 PM
Just played around with some other code and this is what I've got:
This code shows an error in the "if" line. this where my syntax must be wrong.


#1=3.0
#2=0.3
#3=0.3

n100
g90
g0 x0.49
g1 x[.49+#3] f#1
g0 x0.49
m98 p1

o1:
#3=[#3+#2]
if #3<13.0 then n100
m99
g0 x0.0
m30
Title: Re: Peck drilling in the X axis
Post by: BR549 on November 06, 2010, 01:14:05 PM
First, Mach does NOT do conditional gcode so the IF is not an option(;-(

I whipped up a quicky Subroutine for you. It is programable. First copy the SUB to the Mach subroutine directory

The variables are:

#100= Total depth
#101= Peck depth
#105= Pullback value
#106= Feedrate

To Use First position your tool where it needs to be to start and then Call it with        M98 (Xpeck.txt) L1 #100=1.000 #101=.040 #105=0.050 #6=10

The Sub will then load and apply the variables and begin the cycle .It will dril the peck depth and then retract the pullback value then return then drill the peck depth ,etc,etc At the end it will retract to the start point.

I am sure you will be able to modify it as you need(;-)

(;-) TP



Title: Re: Peck drilling in the X axis
Post by: BR549 on November 06, 2010, 01:34:32 PM
FOr those that want to see the code.

M98P1 L1
o1
(#100 = Drill Depth)
(#101 = Peck depth)
#102 = Fup[#100/#101]
#103 = [#100/#102]
#104= #103
(#105 = Pullback Value)
(#106 = Feedrate)
G91
M98 P2 L#102
G0 X[-1*#100]
G90
M30
o02
G1 X#104 F#106
G0 X[-1*#105]
G1 X#105
M99
%




Title: Re: Peck drilling in the X axis
Post by: BR549 on November 06, 2010, 01:50:10 PM
Here is a slightly better version that improves the pull back cycle.

M98P1 L1
o1
(#100 = Drill Depth)
(#101 = Peck depth)
#102 = Fup[#100/#101]
#103 = [#100/#102]
#104= #103
(#105 = Pullback Value)
(#106 = Feedrate)
G91
M98 P2 L#102
G0 X[-1*#100]
G90
M30
o02
G1 X#104 F#106
G0X[-1*#105]
X[#105-.010]
G1X.010

M99
%

Title: Re: Peck drilling in the X axis
Post by: lew on November 06, 2010, 07:36:40 PM
Hi BR549:
Thanks for taking the time to write the code. I just tried it on the computer and it looks like it works just fine. Didn't have much time to play with it, just threw in some variables and ran it. Very nice. If I wanted to retract back to x0.0 each time what would need to be done?
Cool stuff.
Thanks again BR
Title: Re: Peck drilling in the X axis
Post by: BR549 on November 06, 2010, 07:59:09 PM
I t will retract back to the initial starting point as is. If you start at zero it will end at zero.

Do you need something differrent??

(;-) TP
Title: Re: Peck drilling in the X axis
Post by: lew on November 07, 2010, 11:48:24 AM
Hi BR:
First of all thanks for your help.
Here's what I did. I changed what you programmed so it works in G90. I wanted to drill the first 3" without pecking. Then I wanted it to start pecking but retract to X0.0. Needed to clear the drill from the piece. Also, I added a couple lines that will make sure the drill gets to the final depth.
The code below is what I'm using now and it works pretty good.
Thanks again for all your help. I know what kind of time is involved with doing the programming.

M4
M98P1 L1
o1
#100 = 14.18    ;Drill Depth)
#101 = 0.375    ;Peck depth)
#102 = Fup[[#100-#105]/#101]
#103 = [#100/#102]
#104= #103
#105 = 3.0       ;INITIAL DRILL DEPTH
#106 = 1.0       ;Feedrate)
G90
M98 P2 L#102
G0 X[#105-.02]
G1 X#100 F#106
M5
G0 X-0.2
G90
M30
o02
G1 X#105 F#106
G0X0.0
X[#105-.020]
G1X[#105+.020]
#105=[#105+#101]

M99
%
Title: Re: Peck drilling in the X axis
Post by: BR549 on November 07, 2010, 12:59:58 PM
GoodJob,  just watch your chip load on the initial drill depth. That is a LONG way to drill without clearing chips(;-) normal is 4x the drill diameter.

(;-) TP