Month: July 2022

Using U To Program Taper CNC Lathe

Category : Fanuc Turn Haas Turn

I recently wrote an article on the use of incremental U and W on a CNC Lathe for incremental programming.

I must be honest I didn’t have that many creative uses for it.

Anyway when I posted it on Linkedin I did get some interesting replies and comments. I was surprised to see how many people do use incremental U and W.

incremental U

 

About a year ago I was working at Gardner Aerospace and we were struggling to get rid of a taper on a shaft we were machining.

Not a particularly difficult job other than this pesky taper we kept getting.

It was something like 30mm diameter by about 140mm long. We were making it on a new Haas ST lathe we struggled to hold the size which was about plus or minus .02mm and were getting a taper too.

I noticed that when we programmed a taper it was easy to make a mistake.

incremental U

The above program would take the size .015 less.

incremental U

When it came to changing the taper again the calculation had to be made. I suddenly had a brainwave and realised we could program it in incremental by using a U figure.

incremental U

The great thing about doing this is that you can see exactly what taper you have and it’s really easy to modify. 

The other thing is that the figure is always going to be small so it’s easy to spot mistakes.

I got so excited I even made a video.

Thanks for watching and reading

If you have been affected by any of the issues in this post or need CNC Counselling then contact me.

Or call us

If you want to learn to program CNC Milling Machines

Look no further Contact CNC Training Centre

 

 


G74 Drilling Cycle With G96

Tags :

Category : Fanuc Turn Mazak Turn

G74 Drilling Cycle With G96

G74 Drilling Cycle with G96.

On a CNC lathe G96 is used for most machining. It was amazing in the old days when we suddenly discovered G96.

Because you are using a constant surface speed the metal cutting is consistent so you get a great finish.

The Black Art Of CNC Programming

CNC Programming was a bit of a black art back in the old days and generally speaking we used G96 for everything except for screw cutting and drilling holes on centreline (G74 Drilling Cycle).

When CNC Programming a drilled hole you would always use G97, (this means the speed is in RPM).

If you were to program for example G96 S50 M3 and then rapid to X0 and Z3. ready to drill a hole the machine would just go to its maximum RPM. This would be the speed you set in your G50. (The G code used to restrict the speed.)

Oh by the way that 50 meters per minute is for a B & Q drill.

Don’t get me wrong I love B & Q products but HSS drills are not for grown up engineers they are great for metal work classes at school and making a coffee table for the misses but it’s time to join the big boys and spend some money.

I Digress

Anyway the machine would calculate the speed at its current diameter. So at zero the spindle would always be flat out.

So you could say G96 is pretty useless for a drill.

But you would be wrong!!!!!!

Take a look at this bit of code.

G74 Drilling Cycle

The idea is to send the machine to the drill diameter. Because the machine is in G96 it calculates the correct speed. When you then issue G97 it fixes the speed. Now when you move to X0 it has the correct speed.

Let The Machine Do What It’s Good At

Mmmmmmm… So all you need to do is send the drill to its diameter and the machine does the arithmetic.

Let the machine do what it’s good at and you do what you’re good at.

What are you good at by the way?

Threading is the same if you were machining an M20 thread at 100m/min calculate the surface speed.

(This is the quickest way I have seen)

20/314.2 =.06365

100/.06365 = 1571 RPM

You could do the same thing let the machine do it’s shit.

Rapid to the diameter of the thread then program G96

G0 X20. Z5.;
G96 S100 M3 (Start Spindle at 100 metres per min);
;
G97 (This will swap to RPM and clamp the speed at the correct RPM);
X21.;
;
G76 P010060 Q20 R.02;
G76 X16.93 Z-25. P1534 Q485 F2.5;
;

ETC

So with this bit of code you can get the machine to calculate your speed.

Thanks for watching and reading

If you have been affected by any of the issues in this post or need CNC Counselling then contact me.

Or call us

If you want to learn to program CNC Milling Machines

Look no further Contact CNC Training Centre

 

 


D01 END1 Macro How does it work?

Category : Macro

D01 END1 How does it work?

Someone said to me the other day to “why don’t you just do one”. In fact people often say this to me, even complete strangers. I was forced in the end to google it.

Anyway having researched it at length I can safely say it’s not a term of endearment. It actually means “fuck off”.

Now in macro programming it all takes on a different meaning. If you ever programmed computers back in the 1980’s then you’ll remember BASIC

(Beginner’s All-Purpose Symbolic Instruction Code)

This was a computer language very similar to Macro programming. Mmmmm not come far have we?

Anyway that’s where this language originates. Often known a Spaghetti programming. A pejorative phase to describe this type of programming used mainly because you can be hop skipping and jumping all over the program with GOTO statements and all sorts of confusing shit.

You have to be very disciplined with this type of programming and add loads of explanations. You must space the code out in neat chunks.

Although crude, macro programming has some great uses.

Oh and it adds real functionality to CNC programming.

D01 END1 What is it then?

This is a kind of loop and is best explained in an example. My example is a macro that will drill a grid of holes. The user states the spacing in X and the spacing in Y. Also the number of holes in each direction.

Now I know the smart arses are saying “fuck me, doesn’t he know there are cycles that already do this, yawn yawn”

Well actually I do.

I also know that the wheel was invented 3500 B.C. but the wheel can be used for demonstration which is what I’m about to do.

Demonstrate grids that is not wheels.

First of all this is just drilling one line of holes I’ll then go on to complicate the shit out of it by doing a grid.

First of all I drill one hole at X0 Y0, or whatever I want as my first  position. The G202 has two parameters W and X.

W is the number of holes along the X axis.

X is the width between holes.

So this will give me 6 holes 10mm apart along the X axis.

I have aliased G202 to program O09011 which is my macro. Here’s how you do it in case you forgot.

This is program O9011

D01 END1

The line WHILE [#23 GT 1] DO1

Tells the control that as long as #23 is greater than 1 to go around the loop.

It’s now looking for END1 which corresponds to D01 and it whizzes around the loop.

You can have loads of these.

The END must match the D0.

It could be D02 & End2 the choice is yours. The D02 is just the name it’s nothing to do with how many times you go around the loop.

Just make sure you don’t get mixed up else you will have a nightmare trying to sort them out.

Each time it goes around the loop it checks the condition in the statement.

The line #23 = #23 -1 will reduce #23 by one each time it goes around the loop. (Eventually #23 will not be greater than 1 and the control will escape the loop and carry on)

The next line moves X incrementally (G91) by the amount stored in #24 (this was the X value you put in the G202). It drills a hole because the G81, stated in the main program, is still active.

The control is then put back into G90 (Absolute) as a safety measure.

Read this article for more on G and M code aliasing.

Now Lets Complicate Things

OK so you understood that?

Good now lets completely fuck it up.

D01 END1, This is the complete program.

First of all I drill one hole at X0 Y0, my first position same as above.

The G202 now has four parameters D,W and X, Y

D is the number of rows in Y.

W is the number of holes in X.

X is the width between holes along the X axis.

Y is the depth between holes along the Y axis.

So this should give me 6 holes 10mm apart in the X axis and 6 rows of holes 10mm apart in Y.

(A grid of holes)

 

More D0’s and Ends

Now we have D01 END1 inside D02 END2.

D01 END1

So……… the D01 END1 is the rows of holes across (X Axis).

The D02 END2 s the number of rows (Y Axis).

Now lets break it all down.

O09012 (Drill Grid of Holes)
G103 P1 (NO BLOCK LOOK AHEAD)

#100= #23 (Store W Value)

The line above puts #23 which was the W value into #100. This is because we are going to need it again when we go round the D01 END1 again. This loop reduces it down each time it goes around, so it needs to be restored.

WHILE [ #7 GT 0 ] DO2 (DO LOOP)

The line above is the condition that allows it to keep going around the loop as long as #7 is greater than zero.

WHILE [ #23 GT 1 ] DO1 (DO LOOP)
#23= #23 – 1 (COUNTER DECREASES BY ONE)
G91 X#24 (Drill a Hole)
END1

The D01 END 1 above is one row of holes once the condition is satisfied it escapes the loop.

#23= #100 (Restore W Value)

Remember we saved #24 in #100. you need to set this back to it’s original value because the loop above reduced it down to zero.

#24= – #24 (Reverse X)

This is to make the X move in the opposite way to make the path zig-zag. This will make it toggle between plus and minus.

#7= #7 – 1 (COUNTER DECREASES BY ONE)

The above is the counter for the rows. Number of rows was in D (#7) so wee need to reduce this number as we go.

IF [ #7 EQ 0 ] GOTO1
G91 Y#25
N1

This little bit of code above is for when we get to the last row of holes we don’t want the Y move as we have completed the grid.

END2

G103 P0 (RESTORE BLOCK LOOK AHEAD)
M99

It looks like this.

So there you have it. I hope you now have an understanding of how these loops work.

This kind of programming is notoriously difficult to get your head around. Once the penny drops it gets easier.

The problem is our brains are not too good at thinking about two things at the same time.

It’s called spaghetti programming for a reason.

My advice with all programming is to break the program down into small manageable chunks. Make simple little programs of each part and prove them till they work. You can the piece your program back together.

I hope you have enjoyed reading this article.

Thanks for watching and reading

If you have been affected by any of the issues in this post or need CNC Counselling then contact me.

Siemens 828 840 Sinumerik Training

Or call us 

If you want to learn to program CNC Milling Machines

Look no further Contact CNC Training Centre

 

 


Careers in CNC

View all current vacancies in CNC

Click here

Call David: 07834 858 407