# Cnc Course in hobby machinist



## Syaminab

I wonder if we could use this thread to teach and learn cnc programming, I have given courses and would like to do so here, also would like to learn.


----------



## Analias

*picks an open seat from the desks up front and looks excited *


Sent from my Nexus S using Tapatalk 2


----------



## Syaminab

Analias said:


> *picks an open seat from the desks up front and looks excited *
> 
> 
> Sent from my Nexus S using Tapatalk 2


Lets find 5 students, and we will start.


----------



## ecdez

I'm in!


----------



## Ray C

Count me in (as a student only).


----------



## MikeWi

I'd be interested!


----------



## angelfj1

Syaminab said:


> I wonder if we could use this thread to teach and learn cnc programming, I have given courses and would like to do so here, also would like to learn.



I am very interested!


----------



## arvidj

+1 student


----------



## jumps4

i'm interested
steve


----------



## naijin

I'am all for it!!!


----------



## Hawkeye

Good idea. This could accelerate the learning curve. Will it be generic G-code, or have some specifics for commonly used programs such as D2NC?


----------



## davidh

me, me, me !     perfect timing. . . where do i send the check and how big should it be ?


----------



## Kuyote

I would be interested in a cnc course.

thanks!


----------



## n3480h

Great idea!  I'm in (as a student only).

Tom


----------



## HSS

Dang, He said 5 and I came in at 13. Just my luck.

Pat


----------



## Hawkeye

That's the nice thing about the internet. Class size is less of an issue.


----------



## jfcayron

I volunteer!


----------



## Charley Davidson

So when is this getting started?  I got my #2 fat pencil, crayons, smock & nap pad.


----------



## toag

add me to the list please!


----------



## Bugsyweasel

I'm in.  Sounds like a more then enough interest


----------



## Syaminab

Hawkeye said:


> Good idea. This could accelerate the learning curve. Will it be generic G-code, or have some specifics for commonly used programs such as D2NC?


We will start easy going with G code, describing first each of the common G's and M's, and an example of how a written program uses that code.
I propose learning 5 codes a day. Then, once the class is mature enough we can complement it with a video of the use.
I HIGHLY RECOMMEND EACH BUYS A TINY SMALL HARD COVER NOTEBOOK. To keep each example of a program for reference. 
Lets see how it works during a week, then we can propose improvement upon classroom necessity.

regards


----------



## Syaminab

*Chapter One, a brief description...*

A Code is only a way to tell the machine what you need to do, it can be as simple as actuating a solenoid that will turn on a light, pump or mechanism as complex as calling a subprogram that will execute a cycle or subroutine. Lets see the first five:
G00: tells the machine to move in rapids to a position described by X, Y, Z. If you put the three coordinates on the same line, the machine will interpolate to the position, in other words calculate the shortest trayectory to the coordinate given. If you put only one per line, the machine will position one at a time.
G01: will do exacly as the G00, but at the cutting speed or FEED rate.

G02: will order to move on a curve to the right or clockwise.
G03: will order to move on a curve to the left or counterclockwise.
G04: will order the machine to remain on a break for seconds, milliseconds or in other words DWELL. IT is used to finish the bottom of holes, or perform simultaneous tasks that take different time and you want one to wait for the other to finish.
tomorrow we will use all of them on a small program. Meanwhile Memorize them please.

Program example:
(There should be preparatory codes at the heading of the program, now skipped because we have not seen them yet)

G00 X5.263 Y3.236; (I advise all G00 moves are done fist X and Y, at the highest Z value, to prevent wrecks)
G00 Z0.25; (positions the spindle 0.25 above the setpoint or reference point on the part)
G01 Z-0.100 F4; (penetrates the part 100 thousands at a feedrate of 4 inches per minute)
G01 X10.0 F40; (cuts in the X direction at 40 Inches per minute)
G03 X12.0 Y-5.0 R2; (cuts from where it is to point X12 Y-5 doing a Clockwise turn of radius 2, if not calculated correctly with other parameters that must also meet, Error alarm will set off, this line can be programmed using I J and K, where you set the arc center, the radius and end point, we will also see polar coordinates later)
G04 X600.0 (The machines remains in the current position for 600 seconds or 10 minutes)


----------



## Hawkeye

Good start. I've learned something new already - same line vs separate lines.

I started a Word document, which I've tagged to the desktop for quick access. I can cut and paste from the lessons and add notes as I learn things.

Thanks for doing this.


----------



## Syaminab

Hawkeye said:


> Good start. I've learned something new already - same line vs separate lines.
> 
> I started a Word document, which I've tagged to the desktop for quick access. I can cut and paste from the lessons and add notes as I learn things.
> 
> Thanks for doing this.


Very welcome, other than the word doc. Get you a small notebook, so later, if you are in front of a cnc, and cant recall exact how to make a tap program, you just copy it, same with how to make a subroutine, call a subprogram, etc.


----------



## dennis98277

I take it that you need a CNC machine to take this class correct?


----------



## fretsman

*Re: Chapter One, a brief description...*



Syaminab said:


> G02: will order to move on a curve to the right or clockwise.
> G03: will order to move on a curve to the left or counterclockwise.



Hopefully I'm not too late to join in? 

I already have a question if I may? What determines the curve (radius?) that it is directed to go to? 

Thanks,
Dave


----------



## Syaminab

*Re: Chapter One, a brief description...*



fretsman said:


> Hopefully I'm not too late to join in?
> 
> I already have a question if I may? What determines the curve (radius?) that it is directed to go to?
> 
> Thanks,
> Dave


We will see that in the examples. At the end of each 5 codes we will take all questions .


----------



## Syaminab

dennis98277 said:


> I take it that you need a CNC machine to take this class correct?


No, you will learn how to program Gcode, this has the intention of explaining how its done on CNC So everyone looses up the fear and myths. 
Later, if in your job you find a machine you will know what to do. If the scare look of a type board and a screen instead of levers  is keeping you from having a cnc, this course will improve those fears.

  Once the class is mature enough, I will film some programs on my cnc to complete the teachings. Also Im looking for a software that will emulate a cnc so you all can program in your computers and test run...


----------



## Syaminab

*Chapter two, next five codes*

Dear Fellow machinning enthusiasts:
  There will be times where I can`t show up here, because of work, travel, etc. So I`m heading on right now to get more advanced...:nuts:

2nd set of five codes:
(Remember, I`m only covering the common in use, I`m not cheating by skipping)
G15 (Cancells the Polar Coordinate Comand, That is if the machine was set in Polar instead of Cartesian)
G16 (Sets the machine in Polar mode, where you put a center, a radius and an angle instead of X,Y...Z remains the same)
G17 (Sets the machine in the X-Y Plane)
G18 (Sets the machine in the Z-X Plane)
G19 (Sets the machine in the Y-Z Plane)...This last three, will be used only when expertise is developed.
G20 (Sets the machine in Inches)
G21 (Sets the machine in mm)
G28 (Orders the machine to return to it`s machine reference point) 
G40 (Cancells Cutter compensation in  right and left side) and I`m going to run wide open here.:holdphone:..this code is important along with G41 42 for several reasons.
  CNC machines have a disability, they are Blind, so you must show them where the part is, and how the tool is. The last codes will assist you on that.
let`s say, you have different drill bits, of course in different lenghts and diameters, well G43 tells the machine this difference in lenght. Now, let`s say you have different diameter endmills, well, if you are running to the left G41 will let you change the cutter diameter and remain on track, or also compensate for minimal differences in between diameters of equal endmills...measure them and they are hardly ever equal plus wear... Remember 3 thousands are enough for part interference and will not assemble right. So if you are one or two thousands off track this codes will help you a lot to run a second pass without rewriting the whole trayectory.

G41 (Cutter path compensation on the Left)
G42 (Cutter path compensation to the Right)
G43 (Cutter compensation in + Lenght)
G44 (Cutter Compensation in - lenght) I never use this one, I avoid it by understanding that my set up probe is 0 in lenght and what ever sign the tool gives I write it on the screen.
G49 (Cutter compensation in lenght Cancellation)

Let`s cut it out for today, I will write the format in which each one is written and explain.


----------



## davidh

i must have missed something. . . i have g01  thru g04   then g15 to g49/  where are g05  thru g14 ?


----------



## Syaminab

davidh said:


> i must have missed something. . . i have g01  thru g04   then g15 to g49/  where are g05  thru g14 ?


Those codes will hardly ever be applied and are specific of peripheal equipment that hardly anyone will use, if you still want them I will send them to you offside.


----------



## Ray C

*Re: Chapter One, a brief description...*

Question about the 1st lesson...  You mention in the 1st line below that Z should be moved high to prevent wrecks.  Sounds like good advice.  Would it be wise to do this? :

G00 Z(some big number);  (lift the head up out of the way)
G00 X5.263 Y3.236;
G00 Z0.25;
.
.

Ray

PS:  This is great.  Really appreciate the effort you're putting into this.





Syaminab said:


> Program example:
> (There should be preparatory codes at the heading of the program, now skipped because we have not seen them yet)
> 
> G00 X5.263 Y3.236; (I advise all G00 moves are done fist X and Y, at the highest Z value, to prevent wrecks)
> G00 Z0.25; (positions the spindle 0.25 above the setpoint or reference point on the part)
> G01 Z-0.100 F4; (penetrates the part 100 thousands at a feedrate of 4 inches per minute)
> G01 X10.0 F40; (cuts in the X direction at 40 Inches per minute)
> G03 X12.0 Y-5.0 R2; (cuts from where it is to point X12 Y-5 doing a Clockwise turn of radius 2, if not calculated correctly with other parameters that must also meet, Error alarm will set off, this line can be programmed using I J and K, where you set the arc center, the radius and end point, we will also see polar coordinates later)
> G04 X600.0 (The machines remains in the current position for 600 seconds or 10 minutes)


----------



## Syaminab

*Re: Chapter One, a brief description...*



Ray C said:


> Question about the 1st lesson...  You mention in the 1st line below that Z should be moved high to prevent wrecks.  Sounds like good advice.  Would it be wise to do this? :
> 
> G00 Z(some big number);  (lift the head up out of the way)
> G00 X5.263 Y3.236;
> G00 Z0.25;
> .
> .
> 
> Ray
> 
> PS:  This is great.  Really appreciate the effort you're putting into this.


that is great, but how would you like:
G28 Z0 before anithing, or considering that before moving you changed the tool or loaded one in the spindle....so our effort to move the Z up, was already expected. This is precisely the thinking that make good machinists, they pepare the heading of all their programs with codes that prevent damages to machine. Congratulations Ray, just keep this message, on rapids never put X, Y and Z on the same line.


----------



## Syaminab

Gentleman: We will need a NC plotter very soon, to simulate what you have learned, There are several which I like, but they cost. I recommend Cimco Edit, This software also writes simple codes for you. Also NCPlot is good enough. Im Starting to evaluate Freemill.
  If anyone knows of a freeware for students that will suggest code, let you genertate NC code for text engraving and also verify Please start recommending here, as we will need it very soon.:thinking:
Let`s choose one for all.
Regards.
  I just finished evaluating FreeMill, is good, but it only lets you postprocess from the wizard, which limits the Machinning operation to Raster Finish. Which is yet too complicated. We need one that will let you do drills, slots, circular milling, Embosses or islands, Tapping  so you can really get a feel or writing a program, and it must show you the NC code generated.


----------



## DMS

The demo versions of Dolphin and AlibreCAD/CAM will let you generate code. For simulating, there is GWizard G-Code editor http://www.cnccookbook.com/CCGWizardE.html which has a free trial, but the full version is $99 per year. LinuxCNC is free, and there is a simulation profile. I'm guessing Mach3 has something similar. With linux CNC you download the image and burn it to a CD, then boot off the CD. You don't have to install anything.


----------



## MikeWi

DMS said:


> The demo versions of Dolphin and AlibreCAD/CAM will let you generate code.


I'm demoing the home version of AlibreCAD and it won't do that. Or am I missing something? :think1:


----------



## DMS

You need to get the demo version of AlibreCAM too. Things changed since I did my demo, you used to get both through Alibre, now AlibreCAM is handle through MEC Soft. Now that I'm thinking on it.. I'm not sure if the AlibreCAM demo would actually post, which makes it less than useful for these purposes if I am remembering correctly. 

FreeMill is another option, which is also made by MECSoft. As Syaminab said though, it's a one trick pony, it only does one flavor of 3d profiling. The generated code is going to be... difficult to follow.

I just recalled another called cambam. I downloaded the demo, but never spent much time with it. It's free as far as I can tell.

http://www.cambam.info/downloads/


----------



## Syaminab

*Please quote Cimco Edit and NCplot*

Fellow Machinists: Please contact your local dealers of Cimco Edit and NC Plot. Check their prices and if you all agree we will go with them. Let`s find out if they have a Student version that will not DNC, but will allow you to actually see the G code.

They have a download version that will last 30 Days, But at least I need 60 for this Course. :whiteflag:


----------



## Syaminab

*Explanation Codes G15-G49*

From G15 to G21, you just write them as that, you do not have to enter anything else.

G28 (Usually accompanied by G91, which sets the machine in relative coordinates) Must be written like this:
G91 G28 Z0.0 ( what it will do, is to send the Z axes, as high as possible, regardless of where it is, to the Z0.0 of the machine,
Once we sent the spindle up as high as possible, whe can then move the part near us or all the machine to its reference points by writing:
G28 Y0.0 (sends the part near the door)
G28 X0.0 Y0.0 (Sends the whole machine table to reference points, Usually to the left corner of the machine, close to the front)
G40 H0 (Means that the machine will cancel the tool compensation in radius and take that of the H0 which is the center of the tool, if thid tool is both compensated in lenght and radius, G40 must be cancelled with D0)
G41 D7 (The tool no. 7 will be charged to the left of the given path by the amount written on the Tool 7 Byte in the control)
G42 D7 (The tool no. 7 Will be charged to the right of the given path by the amount written on the Tool 7 Byte in the control)
G43 H7 (Will compensate the lenght difference of the tool no. 7 and the Probe lenght or Main tool) It obeys sign.
G44 Forget it and stay with G43 but be careful to consider the sign, Positive is tool larger than probe, negative if shorter than probe.
G49 H0 (Cancells the compensation for lenght) It must be used everytime we finish using a tool, note that if I was using Tool 7, with G49 I use H0.

If you have doubts, here is the time.
We will continue tomorrow.:bitingnails:


----------



## Charley Davidson

I have ncplot it was given to me by the local mac


----------



## Syaminab

Syaminab said:


> Fellow Machinists: Please contact your local dealers of Cimco Edit and NC Plot. Check their prices and if you all agree we will go with them. Let`s find out if they have a Student version that will not DNC, but will allow you to actually see the G code.
> 
> They have a download version that will last 30 Days, But at least I need 60 for this Course. :whiteflag:





Charley Davidson said:


> I have ncplot it was given to me by the local mac





obabacan said:


> Hi all
> I have just noticed the thread and would like to join, if you accept.


 welcome


----------



## MikeWi

All I can find for Cimco Edit is links to their product description and trial download, but no prices, even at the re seller web sites, so I must be missing something.  NCPlot is $300 and is way outside my budget right now.  Not complaining, just providing feedback.  If I have to follow along with the software, that's what I'll do! )


----------



## Syaminab

MikeWi said:


> All I can find for Cimco Edit is links to their product description and trial download, but no prices, even at the re seller web sites, so I must be missing something.  NCPlot is $300 and is way outside my budget right now.  Not complaining, just providing feedback.  If I have to follow along with the software, that's what I'll do! )


Ok, to me $300 seems to high for student also. Let`s find out if Cimco Edit is under US$150.00 I would recommend it if it was. The thing here is that I will start posting programs in the near future, probably a week or less from now and this software have the feature of giving examples, and posting the code and line in red if something is wrong or missing. They help you a lot to learn and work faster. Without a simulating software, The student abandones because he can`t see what the programs do, and having a CNC is way more expensive than a software. Also this software is an investment, because it will let you program in the near future a lot faster and without mistakes, also will help you to quote, estimate materials, hours of work and the list of tooling needed. 

  I highly recommend their use. I do not recommend scaling to Softwares like MasterCam, SurfCam and so on, because they will not be helpful for learning and understanding the Code. Something I see here, among hobbiest, is that they like to control the machine and make the parts, Not program a software to do the parts for them. It is the closest to have the real satisfaction feeling of doing the parts on conventional for yourself, with a CNC.


----------



## Syaminab

*Chapter Three, GCodes G50-G59, Cycles will be skipped for the moment to grant a program G90-G99*

G50 (Scaling Cancellation)
G51 (Scaling, Requires a Center in I, J, K and P as the Scaling Factor) It should be written like this
G51 I0.0 J0.0 K0.5 P1.05 (In here we are leaving 0.050" oversize for a final pass for finish, It can also be negative, for fitting and assembly purposes)
G54 through G59 (Workpiece Set point or 0 point, also called UCS, If you are working on several pieces on the table of the machine, you may use several ucs)

G90 (Absolute mode command, This orders the machine to move considering the complete UCS, counting as 0 the G54-G59 Chosen)
G91 (Relative or increment mode command, This orders the machine to count starting where it is standing, let`s say you have a UCS at the top of the lower corner of a part, then you find the center of that plate and want to move from there only one inch, if you turn to G91 then, instead of adding the distance from the corner to the center plus the inch, you just write the inch)

G94 (Feed per minute)
G95 (Feed per rotation, I advise to use this one a lot, specially on drilling because they last longer as they are always biting the same amount of metal, problem is that once starting to run they will be tied to the spindle rotation as if you where tapping, so the feed rate can not be slowed, only the RPMs.

G98 (Return to initial point in a canned Cycle)
G99 (Return to R given point in Canned Cycle, Will explain these on drilling cycles)


  Well, Now we are set with G`s, let me teach some M so we can start writing our first program for understanding.


----------



## Syaminab

*Chapter Four, The M codes*

M00 (Program Stop, used at the middle of programs to test a Thread or add a component that must be machined)
M01 (When the Optional Switch on the machine is on, The program stops as M00. Used on the cycles where an optional stop is needed, to check for wear of a tool or measure the part only every so many parts in production runs)
M02 (End of program)
M03(Spindle rotation Clock Wise seen from behind the spindle)
M04(Spindle rotation CCW) Both are used as: M04 S1300, that is spindle CCW at 1300rpms.
M05 (Spindle rotation stop)
M06 (Tool Call, written as M06 T7, To load Tool 7 on the spindle)
M08 (Coolant on)
M09 (Coolant off)
M19 (Spindle orientation, it orients the spindle in preparation to a tool change, or if you are using a probe, to always use the same side)
M30 (Program end, Rewind or go to the beginning of the program again, and open the door, is used always at the end of programs for production)
M54 (I should say part count, but indeed is cycles run counter)
M98 (Subprogram Call)
M99 (Subprogram End, this last two are used often on programs that may use different subprograms to do family parts)

  I know they are more than Five, but we are now ready to Start a program....)


----------



## Syaminab

*Our First Program, Explaining a Heading with preparatory commands, Body and end of program.*

Well, Finally, let`s see our first easy program, Just making a Slot. First we are to write a heading that will assure several things, that the machine is safe to use, that we are planning different planes and commands on machine, That automatic cycles that could have been left running are cancelled, That we are in Cartesian Coordinates, etc. let`s write the first part of the heading.

O2455 (The O, not a cero, but an o followed by the four digits denotes program number for controll in the memory of the control)
% (Tells the control a program fallows)
G15 G17 G40 G49 G80; ( We cancell polar coordinates, We choose the XY Plane, We cancell any lenght and radious compensation and We cancell any Automatic Cycle left with G80, which we have not seen yet until we see cycles)
G20 G54;(We set Inches in the machine units mode and set the G54 NCS (Part Coordinate System)
G91 G28 X0.0 Y0.0 Z0.0; (Sends the machine to the initial Reference point To clear the table in preparation to load a tool)
M06 T8; (Loads the tool number 8 in the spindle)
M03 S1200; (Start the spindle spinning CW at 1200 rpms)
G90 G00 X0.0 Y0.0; ( We set absolut command mode and send the spindle in rapid mode to the NCS in X and Y only, Not in Z to avoid wrecking )
G43 Z10.0 H8 (While moving the Z axe to 10.0 we compensate the difference in lenght between our tool probe and the tool in use)
G00 Z0.5; ( We then move in rapids half an inch above the part NCS)
G42 X2.5 Y2.5 D8 F25; (We compensate the Radius of Tool 8 and move to X2.5 Y2.5)
G01 Z-0.5 F20 M08( We start our cut by penetrating the part down to Z-0.5 at a feed rate of 20 inches per minute with coolant)
G01 X5.0 Y5.0 F40;  (We start our cut going to a point X5 Y5 at a feed rate of 40 IPM)
G01 Z0.5; (After making a slot at the right of an invisible line that runs from X2.5 Y2.5 to X5.0 Y5.0, the spindle exits the part at a  feed rate of 40IPM)
G04 X10.; (Washes the part during 10 seconds to eliminate swarf)
G00 Z10. G40 G49 M09; (We send the spindle to Z10 in rapid mode while cancelling the compensation for lenght and radius of tool, and shuts off the coolant after having washed a little the part )
G28 Z0.0 M05; (Sends the spindle as high as possible and stops the spindle)
G28 Y0.0; (Moves the part close to us and the door for inspection)
M01; (If optional stop Switch on, waits for us to inspect the part, when we finish the inspection we must press start again in the panel board)
M30; (End of program, Rewind and open the door)
%

 This is more less a program first debug. If you find problems, let us know.


----------



## Syaminab

*Find the Errors in the first program*

Hint, if someone had left T8 in the spindle and already compensated in lenght....What would happen?


----------



## MikeWi

*Re: Find the Errors in the first program*



Syaminab said:


> Hint, if someone had left T8 in the spindle and already compensated in lenght....What would happen?



Some things aren't clear to me.  is 0.0 the maximum height above the table?  Z10 appears to lower the end of the endmill to 10 inches from that point, but then we move to .5 to go above that point?  If positive descends, wouldn't another positive lower an additional .5? You then move -.5 so in any case, we're back to the starting point from that h10 move, not below the surface of the work, or, we descended .5 into the work and then returned above it before cutting the slot.

Also, how does this work?  are all movement commands relative to the last position? :think1:


----------



## Syaminab

*Re: Find the Errors in the first program*



MikeWi said:


> Some things aren't clear to me.  is 0.0 the maximum height above the table?  Z10 appears to lower the end of the endmill to 10 inches from that point, but then we move to .5 to go above that point?  If positive descends, wouldn't another positive lower an additional .5? You then move -.5 so in any case, we're back to the starting point from that h10 move, not below the surface of the work, or, we descended .5 into the work and then returned above it before cutting the slot.
> 
> Also, how does this work?  are all movement commands relative to the last position? :think1:


This is because there are two zeros, one for the machine and one for the part, G28 will be zero machine that is Z all way up and table to the left all thw way and as close to the door, this is the reference point of the machine.
the G54 through G59 are zeros of each part, or NCS. But also if you use G91 where you are standing at the time of execution becomes a zero relative to that precise standing point. If not clear let me know.


----------



## Tony Wells

Rapid Output markets an old standard package that's been around quite a while called G-Zero. Nothing fancy, at least back when I was using it. I just looked and they have a Student version with a 90 day free trial on their mill package. Probably lathe package as well.

http://www.g-zero.com/1157/index.html


Glad you guys are enjoying this. And I'm glad you've got an instructor willing to share what he knows. Just be sure and ask questions as you go along rather than wait and bombard him at the end. And he's right.....take notes.

The G-Zero is an industrial grade program, but it will generate code and plot tool paths that help prevent crash moves. Have fun with it.


----------



## MikeWi

*Re: Find the Errors in the first program*



Syaminab said:


> This is because there are two zeros, one for the machine and one for the part, G28 will be zero machine that is Z all way up and table to the left all thw way and as close to the door, this is the reference point of the machine.
> the G54 through G59 are zeros of each part, or NCS. But also if you use G91 where you are standing at the time of execution becomes a zero relative to that precise standing point. If not clear let me know.


What is NCS?  This term is used a lot, but I'm afraid I don't understand what it is.

Re: your original question about bugs:  You are loading tool number 8 into the spindle without ensuring that the spindle is empty.  I don't see any command to do this though.  

You ask about already compensating for height, but up until the tool is loaded and the G43 command is given, the tool is set all the way up, so I'm not seeing  a way to crash, but does this then affect the actual position of the G91 G28 call?  that could offset the actual location by the height of the tool, and then we do it again with the G43 command, compounding the error EXCEPT you already cleared everything with G15 G17 G40 G80;, so once again, the only trouble seems to be if the spindle is not empty.


----------



## Syaminab

*Re: Find the Errors in the first program*



MikeWi said:


> What is NCS?  This term is used a lot, but I'm afraid I don't understand what it is.
> 
> 
> 
> Re: your original question about bugs:  You are loading tool number 8 into the spindle without ensuring that the spindle is empty.  I don't see any command to do this though.
> 
> You ask about already compensating for height, but up until the tool is loaded and the G43 command is given, the tool is set all the way up, so I'm not seeing  a way to crash, but does this then affect the actual position of the G91 G28 call?  that could offset the actual location by the height of the tool, and then we do it again with the G43 command, compounding the error EXCEPT you already cleared everything with G15 G17 G40 G80;, so once again, the only trouble seems to be if the spindle is not empty.


NCS is the Zero of the parts on the table, WCS is the world cordinate system or machine coordinate system or zero of the machine.
Good try, your problem is that you give for granted we cleared everything....Review those codes, I`m missing maybe a G49? So if the tool is loaded on the spindle and compensated and you did not cancel the lenght compensation and compensate again with G43, the machine will wreck the tool against the part, ruining the part and tool.....This is serious:angry:. So be very careful with standardizing a good heading that will cover you for that. And a good end that will  cancel compensations used by you. One more error to clear....


----------



## Hawkeye

*Re: Find the Errors in the first program*



Syaminab said:


> One more error to clear....



Are you referring to the G04 line? It shows X10. Dwell time would be more like P10000, wouldn't it?


----------



## MikeWi

*Re: Our First Program, Explaining a Heading with preparatory commands, Body and end of program.*



Syaminab said:


> G15 G17 G40 G80; ( We cancell polar coordinates, We choose the XY Plane, We cancell any lenght compensation and We cancell any Automatic Cycle left with G80, which we have not seen yet until we see cycles)


What I took for granted is that your description was accurate! LOL  Looks like this should have read "radius compensation" instead of length.  Sneaky.


----------



## Syaminab

*Re: Our First Program, Explaining a Heading with preparatory commands, Body and end of program.*



MikeWi said:


> What I took for granted is that your description was accurate! LOL  Looks like this should have read "radius compensation" instead of length.  Sneaky.


Right my friend, review programs, dont rely on previous written programs no matter who wrote them...machines are not to blame because of wrong edited old programs, rivalry among operators or tools changed on the magazine and not eliminated or edited on the program left on the memory. All previous major forms of wrecks.

  Fellow Machinists, please dont take it wrong, anyone can learn the codes and programming from a book, but experience on common accidents with CNC....good value!


----------



## angelfj1

[FONT=&amp]"M30; (End of program, Rewind and open the door)[/FONT]"  per previous, isn't "M02", end of program and not "M30"?

you keep referring to "the door", as in the following:

[FONT=&amp] G28 Y0.0 (sends the part near the *door*) 

[/FONT]  [FONT=&amp]M30 (Program end, Rewind or go to the beginning of the program again, and open the *door*, is used always at the end of programs for production)[/FONT]


[FONT=&amp]G28 Y0.0; (Moves the part close to us and the *door* for inspection)[/FONT]


[FONT=&amp]M30; (End of program, Rewind and open the *door*)
[/FONT]
[FONT=&amp]Please explain.

Thank you,

Frank

[/FONT]


----------



## Syaminab

angelfj1 said:


> [FONT=&amp]"M30; (End of program, Rewind and open the door)[/FONT]"  per previous, isn't "M02", end of program and not "M30"?
> 
> you keep referring to "the door", as in the following:
> 
> [FONT=&amp] G28 Y0.0 (sends the part near the *door*)
> 
> [/FONT]  [FONT=&amp]M30 (Program end, Rewind or go to the beginning of the program again, and open the *door*, is used always at the end of programs for production)[/FONT]
> 
> 
> [FONT=&amp]G28 Y0.0; (Moves the part close to us and the *door* for inspection)[/FONT]
> 
> 
> [FONT=&amp]M30; (End of program, Rewind and open the *door*)
> [/FONT]
> [FONT=&amp]Please explain.
> 
> Thank you,
> 
> Frank
> 
> [/FONT]


Dear Frank, M30 does three things at the same time, it ends the program by stoping the spindle, it sends the cursor to the beginning of the program to start again,  and opens the door lock for you. CNC machines have an enclosure and a door with a lock. To open this lock certain conditions or permisive must all occur, the door will not open if the spindle is running, the machine wont start if the door is open, etc.


----------



## Syaminab

*Review, How a heading and End of program should be...Recipee.*

From the past Chapters, here is a recipee on how the heading and end of a program should be, Please write the next in your hardcover notebook:
Warning: This heading and end considers you set the NCS at the highest point of the block, in forthcomming programs we will learn that if the NCS will disappear when machinning it is better to set the NCS at the bottom, then the Z0.5  to begin machinning and end should be according to the size of block.
Program Heading
O####
% 
G15 G17 G40 G49 G80; 
G20 G54;
G91 G28 X0.0 Y0.0 Z0.0; 
M06 T#; 
M03 S####; 
G90 G00 X0.0 Y0.0; 
G43 Z10.0 H#; (Calculate that the difference between the tool lenght and the tool probe is less than 10 inches)
G00 Z0.5 M08; 

Body of program goes here, in other words, the actual cutting of the part or Trajectories.

Program End
G01 Z0.5;
G04 X10.; 
G00 Z10. G40 G49 M09;
G91 G28 Z0.0 M05;
G28 Y0.0; 
M01;
M30; 
%
:whistle:


----------



## Syaminab

*Fellow Friends, shall we stop to resolve doubts here, or can I continue with Cycles.*

This is the time for questions, If you do not have any I would like to continue with Drilling Cycles, Tapping etc.:whiteflag:
sorry to speed up, but if works comes to the shop, I will be tied...


----------



## Syaminab

*Drilling Cycles*

As told before, A Simple Gcode can have a lot behind...Let`s learn How to automate drilling on the CNC.
G80, used briefly on our last program, before seeing its meaning, It is used to Cancel any left cycles on the heading, Here we use it to cancel the cycles we will be running.

The First Drilling is a Simple Drilling with a G81 Code, the program line should be written like this:

G98 G81 X#.# Y#.# R# Z-#.# F#

G98 ( The retraction point will be the last Z the spindle was before initiating the Cycle, If I Had the Z10.0 we have been using, it will go up there after drilling. Instead if I write G99, the retraction will be to point R described below.

X, Y (are the coordinates of where you need the hole).
R ( Written as R0.3, is the height above the block at which we can move Safe but close to drill several holes, ahead it will be useful to determine when Pecking the height we need to widraw the drill bit to clean).
Z-1.345 (The total depht of the hole, take into account the 118º angle of the point of the drill, if you want to go through, and where you are supporting the part...Dont drill the bedways of your press)
Feed at which you need to drill, too much brakes the drill, to few burns or dulls the bit edges...How to know:

In Inches:

   Rpms of the Drill = (Cs * 4)/D; With a CS for Steel = 60 Ft per minute, Cs for Aluminium = 60, Cs for Castings =40
  Feed in Inches per minute: RPMs * Number of flutes * Feed per flute;
  Feed per flute as follows:
  Small Drill bits: .001 to .004 per flute
  from 1/4 to 1/2: .004 to .007
  From 1/2 to 1": .007 to .015"

  If the Swarf is Black, you are spinning too fast, If is Golden, you are just right. If it curls instead of breaking, more feed, so go from low to high.
  Example:

  Want to drill a 3/16 hole, on Carbon 1020 steel to 1/2" depth with a HSS drill bit at three different places.
 Rpms are : (60* 4)/0.1875=1,280 rpms    Feed: 1280*2*0.003=7.6" per minute. 

  So we write the program:
M06 T12;
M03 S1280;
G00 X 4.5 Y6.7;
G43 Z10.0 H12 M08;
G99 G81 X4.5 Y6.7 R0.5 Z-0.5 F7.6;
Y8.2;
Y9.5;
G00 Z10.;
M09;
M05;
G80;
M30;


 G81 Takes care of everything almost... Great help no?:thinking:


----------



## Syaminab

*Other Drilling Cycles*

When we drill continous, the drill bit is retrieved suddenly, leaving a step at the bottom. If we need a soft even finish, we must stop the feed and cut at least one turn on the same Z depth. Here Dwell is useful, and Cycle G82 is specifically designed for that. Let`s see.

G99 G82 X5.66 Y9.178 R0.3 Z-0.75 P100 F7.6;

  On this program line, we will start drilling an X and Y from a height of 0.3 above, and will return to that position because of the G99 after we complete the drill. The depth of the hole is 0.75 and the Drill will remain spinning at the bottom for 100 milliseconds because of the P, if it where an X as in a previous example in which we left the coolant over the part for 10 seconds we would have left the drill spinning at the bottom for 10 seconds. P  is for miliseconds, X is for seconds, we do not use X or seconds when drilling or we would burn  or dull the drill. We must calculate one or two turns at the most to leave a good finish without dulling our drill bit on each hole. Here is how we calculate the precise time according to the rpms at which we are spinning.

Minimum dwell = 120/RPMs

  So for our previous example, at which we where spinning a 3/16 drill bit at 1280rpms, a proper dwell time is 120/1280 =0.094 seconds, that is fairly 0.1 or a tenth of a second...P100



  There is a rule for Drilling most materials, that is, A drill bit can go in a single strike 3.5 its diameter before getting clogged, after that the risk of breaking the Bit and loosing precious time removing the broken bit is big. We must then retrieve the Drill bit to evacuate the Swarf and chips or well inject high pressure coolant through the spindle and Drill bit that would push up the swarf...How many have a high pressure coolant unit in his shop?. Then we must retrieve the bit every 3 diameters. For very deep holes as we approach the bottom we might need to do it more often. Well, The CNC can do that for you when drilling among other nice features. Let`s see some more cycles.

G83 Is a cycle that includes all previous functions and features but adds the feature of retrieving the drill bit every distance we program. It is called Peck Drilling. This is how is written

G99 G83 X5.66 Y9.178 R0.3 Z-0.75 Q0.56 F7.6;

  We removed the Dwell and added a Q function that is simply calculated by multiplying the Drill bit diameter by 3. The CNC will then drill for 0.56 straight, then return to R or 0.3 above the part, to clean the swarf, then return IN RAPID to the depht left less a clearance usually programmed by default at the parameters list. Then start drilling again at the feed ordered until he reaches the next Q depth or finished to the depth requested.

  This is tremendously useful when drilling deep holes or on sticky materials.  Be generous in short strokes and avoid:nono: going deep in a single stroke. Get the feel by watching how much of the flutes get filled, never let it stick to the drill. Plenty of oil or coolant.

  Once you get the feeling and start using short strokes, you will start to feel discomfort that the Drill retracts to R every time and wish it could only retract enough to move the swarf up enough to clear for the next swarf to fit and then continue the Drill...Well, is your lucky day as Code G73 gives you that wished feature. It is called high speed drill because it retracts only Q and not all the way to R. Let`s see how is written

  G99 G73 X5.66 Y9.178 R0.3 Z-0.75 Q0.56 F7.6;

  As told, Drill retracts only to the last Q and only in the last peck, to R. So it sorts of Pumps up the swarf in Q increments, Drilling faster. A precious tool when making thousands of holes on Grills or Filter screens.hew:


----------



## MikeWi

Nice!  I was wondering how far you could drill in one pass.  Is there a similar guideline for feed/speed for endmills?


----------



## Syaminab

MikeWi said:


> Nice!  I was wondering how far you could drill in one pass.  Is there a similar guideline for feed/speed for endmills?


Yes, there is, although it varies a lot from tool to tool, brand, machine, material. I will give all formulas ahead...but for now...Lets Tap and thread.


----------



## Syaminab

*How to Tap on the CNC*

Tapping is, a difficult task to attain on the CNC if we do not understand exactly what needs to be done. And a common result is a Broken Tap inside of a part That was almost finished and you have a hard time rescuing the part.
  I strongly suggest the use of a floating head commonly sold for Tapping. This head limits the turning degree of freedom, but the Z axes floats about 1", that is the tap travels freely on Z, so if by some means we miss the step when tapping, we do not break the Tap. Machine manufacturers talk glorius about Rigid Tapping and such... So far with a rigid mounted tap I have not been throughly successful. Also, sinking the tap in vegetable Lard does magic.

  I will show how tapping in all it`s manners is done, but a floating head will save a lot of time removing broken taps.:angry:
G84 (Right thread tapping) is written as this:

G99 G84 X3.45 Y7.89 R1.0 Z-0.5 F (here is the magic) The feed needs to match the Thread. If you miss a perfect match, prepare to extract a broken tap sooner or later. Also, the rpms and feed rate can not be regulated, once the cycle starts, It can`t be stopped, so is very much like a Nuke button, there is no way back. Tapping needs so much improvement, that many shops buy a manual power assisted Tapping machine and do the tapping by hand. 

 Let`s say that we need a 1/4-20 UNC thread, after drilling with a No. 7 Drill, as recommended by many tables and machinerys handbooks We need to calculate a feed that will turn 20 times and travel 0ne Inch. So we need to set the RPMs for that TAP, and calculate the Feed rate for such rpms.

  Somehow, I might be wrong, I always use half the RPMS suggested for a Drill bit for tapping, So from our last chapter: RPMs= (60 * 4)/0.25=960/2=480 rpms. With that set, I know I need to travel one inch while I turn 20 times so: F = Rpms * Pitch= 480 * 1/20 = 24.

  Pitch = One inch of travel divided by the number of threads per inch. 

  Resuming:

  M03 S480;
  G99 G84 X3.45 Y7.89 R1.0 Z-0.5 F24;

   Ok?

 Other Cycles for Tapping are G74 is for a left Thread and Some Controls require for Rigid tapping to call G84.2 for rigid right thread and G84.3 for Left rigid tapping. They are written the same. 

  Pecking also applies to tapping, and is strongly suggested , all you have to do is place Q in the program line, with 4 to five threads in distance mode, so you just multiply the pitch by 4 or 5 and that is the Q. Oh, I almost forgot, noticed the R a lot higher, well the spindle needs to pick up speed to enter at correct feed, so always leave over an inch above the part for the spindle to accelerate.

Well, here I only wish good luck.

   I will cover Interpolation threading in a separate chapter, that is done with special tools, and is commonly used to create big threads, I mean big as I have done 36" in diameter threads...In a 40 inches of travel machine.

  have a nice Sunday.:drink2:


----------



## jumps4

thank you
there has been a lot of clear useful information so far
steve


----------



## Syaminab

*Polar coordinates*

So far, we have learned how to make a heading, an end of program, how to drill holes and how to tap them, all in Cartesian Coordinates. Well, when we want to drill holes in Circular patterns, it becomes a headache to calculate the X, Y coordinates of each hole. For that, is easier to use Polar coordinates. Let`s learn how it`s done in CNC.

   For Polar movements, we need a Center, a Radius and an angle, let`s see how is written:
G90 G54 G00 X10.0 Y10.0 S1280 M03  (Note the center of our polar pattern at X10. Y10. in cartesian coordinates)
G16 M08;  (Polar coordinates on, coolant on)
G99 G81 X3.5 Y30.0 R0.3 Z-0.5 F7.6
Y60.0;
Y90.0;
Y120.0;
Y150.0;
Y180.0;
Y210.0;
X4.5 Y 240.0;
X5.5 Y 270.0;
G15; (Polar Coordinates Off)
G80 M09; (Drilling Cycle Cancel and Coolant off)
G91 G28 Z0.0 M5;
G28 Y0.0;
M30;

  This program is for making a 7 hole polar pattern, with a radius of 3.5 at Angles 30 through 210 degrees every 30 degrees. Then a hole at 240º but with a radius of 4.5, then a hole at 270º but with a radius of 5.5. It then cancells the polar command, cancels the drilling command, shut`s off coolant, sends the spindle as high as possible, shut`s off the spindle, sends the table to the front for inspection, ends up the programs, rewinds and opens the door lock.

  Well, It`s a great tool to avoid calculating centers of holes in circular arrays and still do them easy, even with different radius. Great tool ah?.


----------



## Syaminab

*Hole Machinning by helical cutting*

So far, We have Done all kind of holes by most methods, but all of them involving a Drill bit. That limits the size of the hole to the spindle nose and power capacity. Let`s remember that common CNC are not Power Drills, so my advise is  limit the Drill bit size to 3/4 or 1/2, and never go beyond that. After that sizing, is better to use machinning methods to cut holes. If your control has a Load meter, like Fanuc Controls, never exceed 40% for continuos work.

  Well, then let`s understand how to Cut metal by moving the cutter in a Ramp in circles:


  After our heading the body of the program should read:

G41 X0.5 D17 F15;
G91 G03 I-0.5 Z-0.25;
I-0.5 Z-0.25;
I-0.5 Z-0.25;
I-0.5 Z-0.25;
I-0.5;
G90 G01 G40 X0.;
G00 Z0.5 

 Then use our End of program

  What this program does is From the center of the hole it approaches a 1" Diameter while compensating. Then starts to ramp a CCW full circle of 0.5 radius while going to Z-0.25, this is repeated for one inch in depht doing helical movement, then it only spins once flat without moving in Z to clean the bottom of the hole. Then Returns to the center of the hole while canceling the compensation and then goes to Z 0.5 above the part.

  Whit this program, You can machine very large holes, finish holes or Bore with an Endmill, The limit of this program is the lenght of your endmill cutter. Now remember not :nono:to be lazy and choke your Endmill, Take at least two steps in Radius to give space to your cutter when slotting in circle on large plates.

  I hope this serves you well, It is worth of keeping it in the Hard Cover Notebook.


----------



## Syaminab

*Hello?questions?*

Fellow machinists, got any questions?
  I got the feeling this forum is not being followed. Am I teaching obvious or not needed material? Is this not what you expected?


----------



## DMS

I have been following pretty closely. I have some knowledge of G-Code already, but have still found this useful (I haven't read through the post on polar commands, though I will do that in the near future).


----------



## jumps4

i have been following right along and have read it several times
i will probably cut and paste into a text document when completed
steve


----------



## Tony Wells

Don't think for a second that nobody is following this. You can't see it, but the logs show 134 different members have viewed the thread. I'm also watching. I have no NC/CNC in my shop, nor any real plans for it, but I have spent many years around them. So I have a passing interest in your information, and I appreciate your taking the time to share it in a simple, straightforward way.


----------



## Hawkeye

I'm starting to understand the conventions in G-code (I think). I take it that, once you've gone to polar and set the centre, X becomes radius and Y becomes angle. Radius stays constant until it gets re-defined.

One question, though. What defines the 0.0 angle? Is it at 3 o'clock? 9 o'clock? 12 o'clock?

Thanks for all the good information.


----------



## MikeWi

Keep going!  This is very useful stuff.   Thanks for taking the time to do this!


----------



## Syaminab

Hawkeye said:


> I'm starting to understand the conventions in G-code (I think). I take it that, once you've gone to polar and set the centre, X becomes radius and Y becomes angle. Radius stays constant until it gets re-defined.
> 
> One question, though. What defines the 0.0 angle? Is it at 3 o'clock? 9 o'clock? 12 o'clock?
> 
> Thanks for all the good information.


Just like that, Y0.0, in the example we din not drill at 0 degrees. If your question is where does it starts, by convention, 0 deg is 3 oclock. Plus 90 deg is 12 oclock.


----------



## DMS

Something I noticed about the topic before last (polar co-ords). I didn't recognize G15/G16, which is because my controller (LinuxCNC) doesn't support them (they use a different notation for doing polar co-ords). Just thought I would mention that so it doesn't catch anyone using LinuxCNC off guard.


----------



## Syaminab

Well, now that my work seems to be helping a few, I will keep going. Next theme is calling subprograms, then you can have a list of programs with standardized forms, and call each one when needed, making programming fast and easy.


----------



## Syaminab

DMS said:


> Something I noticed about the topic before last (polar co-ords). I didn't recognize G15/G16, which is because my controller (LinuxCNC) doesn't support them (they use a different notation for doing polar co-ords). Just thought I would mention that so it doesn't catch anyone using LinuxCNC off guard.


Sorry, I have no knowledge of LinuxCNC. But I will try to find out about it. International EIA-ISO standard G code is most common for CNC, and I only know heidenhain and fanuc controls.


----------



## DMS

If you are not using it, it's probably not worth learning (LinuxCNC that is). I mention it because I know others use it (it is the software the Sherline CNC machines ship with). I think it has supported all the other codes you have used to this point.


----------



## Syaminab

DMS said:


> If you are not using it, it's probably not worth learning (LinuxCNC that is). I mention it because I know others use it (it is the software the Sherline CNC machines ship with). I think it has supported all the other codes you have used to this point.


Here is how to write polar coordinates to move on linuxcnc
100 G1 @.5 ^90
G91 ^90
^90
^90
^90
G90 G0 X0 Y0 M2


----------



## Syaminab

*Calling Subprograms*

Being able to call subprograms is a useful tool, because it helps speedup the writing of programs, Sort of drag and drop feature, let`s you assemble programs with existing programs and standardize. How it can help us? Well, imagine you need a program to make a part that has a profile and  holes that will be tapped. From our previous examples, you recorded the following programs: Heading, drilling and tapping. So you just open the heading program, save it with different number (the part number is wise) and call subprogram drilling, then call subprogram tapping. Then you go to the subprograms and only edit the X and Y, the depth and cutting parameters, same for tapping. This assures fewer mistakes, forgotten codes and let`s you call different programs as needed.

  Let`s see how ist`s done.

We call our heading program, I will use real numbers instead of the #.

O2959
% 
G15 G17 G40 G49 G80; 
G20 G54;
G91 G28 X0.0 Y0.0 Z0.0; 
M06 T1; 
M03 S1500; 
G90 G00 X0.0 Y0.0; 
G43 Z10.0 H1; 
G00 Z0.5 M08; 

G99 G82 R0.3 Z-0.5 P200 F3.6 L0; (Here we call a drilling cycle with dwell, the L is used to specify how many times we need to repeat the cycle)
M98 P3545; (Here we call program O3545, in our case let`s think it`s the cartesian array of holes we did, I will write it at the bottom only for reference, you do not need to write it, it should be in the memory of the CNC)

G01 Z0.5;
G04 X10.; 
G00 Z10. G40 G49 M09;
G91 G28 Z0.0 M05;
G28 Y0.0; 
M01;
M30; 
%


Subprogram O3545
%
O3545
X5.8 Y2.3;
X8.0;
Y8.0;
X3.4;
X1.2 Y6.0;
G80 M09; (Drilling Cycle Cancel)
M99; (Subprogram Cancel )
%


With this tool, You can just edit where the holes are, and forget about all other things.:whistle:


----------



## angelfj1

*Re: Calling Subprograms*



Syaminab said:


> Being able to call subprograms is a useful tool, because it helps speedup the writing of programs, Sort of drag and drop feature, let`s you assemble programs with existing programs and standardize. How it can help us? Well, imagine you need a program to make a part that has a profile and  holes that will be tapped. From our previous examples, you recorded the following programs: Heading, drilling and tapping. So you just open the heading program, save it with different number (the part number is wise) and call subprogram drilling, then call subprogram tapping. Then you go to the subprograms and only edit the X and Y, the depth and cutting parameters, same for tapping. This assures fewer mistakes, forgotten codes and let`s you call different programs as needed.
> 
> Let`s see how ist`s done.
> 
> We call our heading program, I will use real numbers instead of the #.
> 
> O2959
> %
> G15 G17 G40 G49 G80;
> G20 G54;
> G91 G28 X0.0 Y0.0 Z0.0;
> M06 T1;
> M03 S1500;
> G90 G00 X0.0 Y0.0;
> G43 Z10.0 H1;
> G00 Z0.5 M08;
> 
> G99 G82 R0.3 Z-0.5 P200 F3.6 L0; (Here we call a drilling cycle with dwell, the L is used to specify how many times we need to repeat the cycle)
> M98 P3545; (Here we call program O3545, in our case let`s think it`s the cartesian array of holes we did, I will write it at the bottom only for reference, you do not need to write it, it should be in the memory of the CNC)
> 
> G01 Z0.5;
> G04 X10.;
> G00 Z10. G40 G49 M09;
> G91 G28 Z0.0 M05;
> G28 Y0.0;
> M01;
> M30;
> %
> 
> 
> Subprogram O3545
> %
> O3545
> X5.8 Y2.3;
> X8.0;
> Y8.0;
> X3.4;
> X1.2 Y6.0;
> G80 M09; (Drilling Cycle Cancel)
> M99; (Subprogram Cancel )
> %
> 
> 
> With this tool, You can just edit where the holes are, and forget about all other things.:whistle:




This reminds me of "sub-routines" that we used in programming "Basic".  Of course that was donkey's years ago!

Question:  I have seen the use of "wizards" for performing different functions on a mill.  Would that be a form of sub programming?

BTY, this is great stuff. I don't actually own a mill.  I intended to convert an SX2 later this year.  Seeing what can be accomplished by participating here may cause me to accelerate my schedule!:goodjob:


----------



## Syaminab

*Re: Calling Subprograms*



angelfj1 said:


> This reminds me of "sub-routines" that we used in programming "Basic".  Of course that was donkey's years ago!
> 
> Question:  I have seen the use of "wizards" for performing different functions on a mill.  Would that be a form of sub programming?
> 
> BTY, this is great stuff. I don't actually own a mill.  I intended to convert an SX2 later this year.  Seeing what can be accomplished by participating here may cause me to accelerate my schedule!:goodjob:


 Wizards became conversational controls later...on windows. So yes, Wizards are just windows that collect the data for the Variables (Talking of Basic, Fortran 76, C++ and all those we learnt when this galaxy was created):nuts:


----------



## Syaminab

*Real Example calling Subprograms, a Hardinge Bit Holder at 45º.*

Fellow Machinists, As some of you know, I have an old Hardinge HC, that is a turret Hardinge. Here in Mexico takes forever for tools to arrive, seldom we end up making our own. I had to make a 45º Toolbit Holder for the Turret of the Hardinge, I believe this is a perfect example of what we can do by calling subprograms. 

  The Program Below, O2540, after the known heading to assure proper function, will call tool 16 and compensate left, then Go to a position near the steel to cut and call subprogram O2532 and the interesting part is that it will iterate or redo this subprogram 10 times or in other words, the program will describe a profile given per levels and make a part per level cutting. 
  This is a powerful program, because all you need to do virtually any 2.5D part, is draw the profile with X Y and save it as the subprogram. The machine will do the rest in Levels that you program with L and Z.

Let`s see the Main program:
O2540 (CALLS PROFILE SUBPROGRAM AND ITERATES L TIMES IN LEVELS TO CUT PROFILE GIVEN IN MM)
G15 G40 G49 G80;
G17 G21 G54 G90 G94;
M6 T16;
G0 X150. Y90. ;
G43 Z80. H16;
G90 G00 G41 X-20. Y-20. Z20. D16 M3 S1500;
G01 X0. Y10. F500;
G01 Z0. F320;
M98 P2532 L10;
G90 G0 Z100.;
G40 G49;
M30;
%

O2532 (SUBPROGRAM TO CUT PROFILE FOR HARDINGE TURRET 45DEG TOOLBIT HOLDER)
G91 G01 Z-1.01 F280;
G1 Y10. F500;
X52.06;
Y-10.;
X-52.06;
M99;
%

  draw with a pencil what this program does, it sinks from where it is -1.01 in Z, then advances 10 mm in Y, describing a square. This is done 10 times, in other words, cutting a part 10.1 mm thick in 10 levels of 1.01mm.

So from now on, program 02540 does the trick of all parts you want to cut in 2.5D, all you do is change the L according to the thickness of part. draw a desired profile in the subprogram, according to the cutting conditions permisible, choose a Z for depth and mach with Levels in L.

  I hope you are enjoying. 
  Next program is one I made in polar coordinates to cut Wheel adapters for my Durango, As many of you I liked some rims but had a different bolting pattern that the copius Durango. With this program, you can do your own wheel adapters for your preferred bolt pattern.

Regards.


----------



## Syaminab

*EndMill feeds and speeds*

Before rediscovering black thread again, let me ask if there is a resource in hobby machinist for feeds and speeds for carbide, cobalt and HSS tools?


----------



## Rick Leslie

Thank you for taking the time to explain and give examples. I have a code book and manual for Mach 3 but it's overwhelming to take it all in at once. This approach gets me there easier. 
Will you be covering "M" codes as well?


----------



## Syaminab

Rick Leslie said:


> Thank you for taking the time to explain and give examples. I have a code book and manual for Mach 3 but it's overwhelming to take it all in at once. This approach gets me there easier.
> Will you be covering "M" codes as well?


Thank you, for caring to learn. M codes were given on thread 46. Not all of them, but only the ones you will really use, I avoid codes like M20, which clamps the 5 th axes....because very few will have a 5 axes machine, yet. If later someone needs help on five axes, which really complicates the tasks, I can help him individually. I left out very few important codes, like M80-M83.


----------



## DMS

*Re: EndMill feeds and speeds*



Syaminab said:


> Before rediscovering black thread again, let me ask if there is a resource in hobby machinist for feeds and speeds for carbide, cobalt and HSS tools?



What are you looking for in particular. I have a license for GWizard, and can run individual numbers. If you're looking for tables of feeds, I recommend Niagra's site

Here is their page for HSS endmills http://www.niagaracutter.com/techinfo/common_mat/index.html
Here is their page for carbide http://www.niagaracutter.com/techinfo/speedfeed_solcarb.html

For generic endmills, I use the low numbers given in these charts, and have had pretty good luck.


----------



## Syaminab

*Re: EndMill feeds and speeds*



DMS said:


> What are you looking for in particular. I have a license for GWizard, and can run individual numbers. If you're looking for tables of feeds, I recommend Niagra's site
> 
> Here is their page for HSS endmills http://www.niagaracutter.com/techinfo/common_mat/index.html
> Here is their page for carbide http://www.niagaracutter.com/techinfo/speedfeed_solcarb.html
> 
> For generic endmills, I use the low numbers given in these charts, and have had pretty good luck.


Thanks, Im looking to be congruent with the site of hobby machinists and teach using its resources. If the site does not have one, Im planning on teaching the formulas, just like I did with drills, and then put the sfm info from the cutter fab in the formulas so the student learns to really take advantage of his machine.

   What do you think? Makes sense?


----------



## jumps4

*Re: EndMill feeds and speeds*



Syaminab said:


> Before rediscovering black thread again, let me ask if there is a resource in hobby machinist for feeds and speeds for carbide, cobalt and HSS tools?



thank you for your class
this is an open source feeds and speeds wizard i have gwizard and i havent really tried this ( i found it the day i paid for gwizard duhhhh )
hope this helps you
steve
http://zero-divide.net/index.php?page=fswizard

edit: sorry i thought you were looking for a fs wizard i missed the post about you teaching one


----------



## Syaminab

*Re: EndMill feeds and speeds*



jumps4 said:


> thank you for your class
> this is an open source feeds and speeds wizard i have gwizard and i havent really tried this ( i found it the day i paid for gwizard duhhhh )
> hope this helps you
> steve
> http://zero-divide.net/index.php?page=fswizard
> 
> edit: sorry i thought you were looking for a fs wizard i missed the post about you teaching one


I just checked it. It is good, also calculates power needed. Great resource.


----------



## jumps4

there is a version you can download i have it on my shop pc but i havent used it yet
steve


----------



## Syaminab

*Re: EndMill feeds and speeds*



jumps4 said:


> thank you for your class
> this is an open source feeds and speeds wizard i have gwizard and i havent really tried this ( i found it the day i paid for gwizard duhhhh )
> hope this helps you
> steve
> http://zero-divide.net/index.php?page=fswizard
> 
> edit: sorry i thought you were looking for a fs wizard i missed the post about you teaching one


Its all right, good students will want to know where this comes from, so far a wizard is a black box that throws results.


----------



## DMS

*Re: EndMill feeds and speeds*



Syaminab said:


> Thanks, Im looking to be congruent with the site of hobby machinists and teach using its resources. If the site does not have one, Im planning on teaching the formulas, just like I did with drills, and then put the sfm info from the cutter fab in the formulas so the student learns to really take advantage of his machine.
> 
> What do you think? Makes sense?



Feed calculators are great, but I think it is also useful to understand how the calcs work if you are pulling from tables. It makes you appreciate what GWizard does for you after you run those calcs a couple dozen times


----------



## Syaminab

*How to calculate Feed and Speeds*

Many factors regulate a successful cut on most materials. But we need to be careful specifically with Heat generated as it destroys our cutter and also may damage the part. Heat is the source of tool deterioration and part distortion. Most tool manufacturers approach heat in different ways. Some build tools that can take a great amount of heat, others more smart, have found a way to keep that heat away from the tool and part, by concentrating it on the swarf, which is the way High speed cutting manages heat. This last is very good example because by looking at the swarf you know how you are performing the cut.

  I will try to simplify as much how to cut efficiently without too much bang. Let`s learn.

   The color of the swarf gives you the condition of the cut you are performing, keep this three concepts in mind always. If the swarf is black, you are cutting too fast, this will deteriorate the tool and give a part with bad finish and out of tolerance, If the swarf is same as metal color, you are cutting slow, The perfect swarf is Golden for metals, not molten on Plastics and Chunky on Brass and Aluminum. Now that you have learnt  to identify a good swarf, Let`s find out how to find the right RPMs, once you learn this, rest is easy.
HSS
   RPMs=(CS * 4)/D; Where CS for Steel is 40-70, CS for Aluminium is 500-1000 and CS for Bronz is 65-120, CS for Castings is 50-80. and D is our tool diameter.

  So for a part that is made of aluminium, and I do not know what kind of Aluminium, I start on the lower end and depending on the swarf, I see how much I can speed up:

   RPMs = 500*4/0.5= 4000, yeap, I can spin very fast with Aluminium, but I  should not exceed: 1000 *4/0.5=8000.  Knowing those parameters I might choose to spin in the middle or 6000 rpms.

For Cobalt, multiply by 1.2, Keep in mind Cobalt and Aluminium do not mix well. For Carbide Multiply these by 1.5.

  Now let`s see how fast we feed. 

The only data you will need is the Feed per tooth of tool, then:

  Feed = RPMs*Number of flutes*Feed Per tooth:  4000*3*0.0026=31.2 Inches per minute
For HSS
Feed per tooth can be found on tool data sheet, common are Steel:.0005, Aluminium: 0.0018, Bronz: 0.0011, Cast: 0.0010
For Cobalt, miltiply by 1.2, for Carbide multiply by 1.5. All given in inches per tooth.

  Now with these in your head, let`s understand several other factors that will affect your perfomance, If the tool is long, It will chatter, slow down. If you are slotting, do not go in one pass beyond one Diameter in depth for HSS, 1.2D for Cobalt and yes, only 0.5D for Carbide.
Carbide is Brittle, last longer and as is a ceramic, does not absorb heat easily and withstands more heat without melting, So if your machine does not spin fast enough the only reason to use Carbide expensive tools, is because you really want them to last longer. on a conventional mill, you will hardly ever need one if you are not cutting hard steels, or you are doing a production run and can´t waist time changing tools. Trust me, change to Cobalt and you will be happier. 

*  The Concept of High Speed Cutting

*This concept is what I use, deep cuts in lenght avoiding slotting but keep profiling with Shallow cuts in Diameter, never over 0.1 the Diameter of tool. High rpms and high feeds. Always climb milling. This way I wear and use all the flute, not only the tip, This way my swarf becomes like hair, easier to evacuate, I really remove a lot of material. My clamping of the part does not need to be that hard, because I`m mostly rubbing the part, The part distorts less from the clamp and workhardens less because of less effort. My spindle practically has no loads, less vibration, but higher frequency so it could be noisy. I must be very carful to understand that when a cutter turns 90º it touches twice the surface, I should avoid tight turns and replace with tolerant radius turns and more passes. This are called Trochoidal moves. 


  My tipical conditions to rough 7075-T651 Alunminum plate for Aerospace components  and Blow moulds would be:

  Depth of cut: 2", Radial depth of cut in a 0.5" diameter tool: 0.05", RPMs: 8000, Feedrate: 315 Inches per minute. Coolant: Cool Air at high pressure, Cornering: avoid over 65º corners or slow down to 150 Inches per minute during cornering.

  Exact same conditions for Finishing, but the Radial depth of cut is kept to 0.05 of diameter, or 0.025".

  Some Term definitions:  Climb Milling, the cutter bites from top to bottom radially instead of Shoveling from the bottom up.

  With these in mind, you will be successful on your cuts, hope it works for you, if not understood, send me a message.

Regards.


----------



## Syaminab

*Scaling*

Tomorrow morning, we will see an example of scaling. And Im running out of material, just left are examples and tricks to do common tasks, so have questions ready, cause if the student does not ask, I might end up thinking he knows it all. Happy week end, I plan riding my 4 year old on his 4wheeler on saturday and go fishing to el cuchillo lake on granpas 70 year old boat on sunday.
:biker2:

regards


----------



## Syaminab

*Scaling*

Scaling is a Useful tool, because when you rough or want to approach softly by passes to a final dimension, helps you do it with minimum programming.Let`s see how is written on an example, learn that I, J, K is the center of the scaling:

After our Heading

G51 I5. J5. K0. P1.25; (Scaling Factor)
G01 Z-0.25;
G41 X0.5 Y0.5 D15 F50;
M98 PO3454;
G20 Z0. M05;
Y0.0;
M30;
%
This program will run the contour described in P03454 but scaling it bigger. The subprogram must contain at the end a G50 and a M99 to cancel scaling and to close subprogram call.
:thinking:


----------



## Syaminab

*The change of datum planes. G15-G18*

So far we have been working on the X-Y plane moving the Z. What are the change of datum planes useful for?

  Well, lets say you want to make a variable radius at the top of a cube, changing the datum so the radiuses are done vertically, moving on the Z-X plane, then just doing small increments on Y, all this complemented by a small scaling factor every time we move in Y helps us make that variable radius easy.  So lets imagine the first radius is a .25" and the last is  1", scattered on a distance of 6". To calculate the scaling factor of each incremental, we divide de difference among the radiuses or 0.75" among the passes, a good fnish with a 1/2 ballmill can be 0.015". That is 400 passes, each adding 0.0018" to the last radius, keeping the same center.

  Who can assemble the algorithm of the program?:thinking:

regards


----------



## Rick Leslie

Thank you again for taking the time to do this thread. It puts the code writing in a better perspective. The way you explain it makes more sense to me than the manual (which I thought was good) that came with my Mach 3 program. When this is completed, I hope the Mods will make a pdf of the info. Until then, I'm building a cheat book for the shop (cut & paste).


----------



## DMS

Well, nobody else is raising their hand first, so I'll throw my hat in the ring. I cheated a bit, because my controller won't run some of the standard commands. I think your intent was for us to use scaling to change the radius of the curve, but I not quite getting how to do that in a loop. Also, calling subroutines is different ("SUBROUTINE_NUMBER CALL" is the syntax on my machine). I have a feeling this won't run on anything other than LinuxCNC.



		Code:
	

(safe block)
G90 (absolute distance mode)
G94 (Units per minute feed rate)
G97 (RPM mode)
G80 (exit canned cycles)
F0 (zero feed speed)
G49 (Cancel tool offset)
G20 (inch measurement)
G17 (XY plane)
G40 (Radius compensation off)

#<_tool_rad> = 0.2500
#<_radius>  = 0.2500
#<_y_inc>   = 0.015
#<_x_inc>   = 0.0018
#<_y_dist> = 0

O100 SUB
    G3 X[2*#<_radius>] Z0 I0.500 K0.000 F42
    (move out)
    G1 X[#<_x_inc>] Y[#<_y_inc>] F42
    #<_radius> = [#<_radius>+#<_x_inc>]
    #<_y_dist> = [#<_y_dist>+#<_y_inc>]

    G2 X[-2*#<_radius>] Z0 I0.500 K0.000 F42
    #<_radius> = [#<_radius>+#<_x_inc>]
    #<_y_dist> = [#<_y_dist>+#<_y_inc>]
    (move out)
    G1 X[-#<_x_inc>] Y[#<_y_inc>] F42
O100 ENDSUB

S8000 (spindle on, 1/2" carbide, 2flute endmill, alum)
G0 Z1.000
G0 X0.25 Y0
G1 Z0 F30
G90.1 (absolute arc center)
G91 (incremental distance mode)
G18 (select XZ plane)

(call our subroutine until we reach the 6" mark)
O999 WHILE [#<_y_dist> LT 6]
    O100 CALL
O999 ENDWHILE


----------



## Syaminab

DMS said:


> Well, nobody else is raising their hand first, so I'll throw my hat in the ring. I cheated a bit, because my controller won't run some of the standard commands. I think your intent was for us to use scaling to change the radius of the curve, but I not quite getting how to do that in a loop. Also, calling subroutines is different ("SUBROUTINE_NUMBER CALL" is the syntax on my machine). I have a feeling this won't run on anything other than LinuxCNC.
> 
> 
> 
> Code:
> 
> 
> (safe block)
> G90 (absolute distance mode)
> G94 (Units per minute feed rate)
> G97 (RPM mode)
> G80 (exit canned cycles)
> F0 (zero feed speed)
> G49 (Cancel tool offset)
> G20 (inch measurement)
> G17 (XY plane)
> G40 (Radius compensation off)
> 
> #<_tool_rad> = 0.2500
> #<_radius>  = 0.2500
> #<_y_inc>   = 0.015
> #<_x_inc>   = 0.0018
> #<_y_dist> = 0
> 
> O100 SUB
> G3 X[2*#<_radius>] Z0 I0.500 K0.000 F42
> (move out)
> G1 X[#<_x_inc>] Y[#<_y_inc>] F42
> #<_radius> = [#<_radius>+#<_x_inc>]
> #<_y_dist> = [#<_y_dist>+#<_y_inc>]
> 
> G2 X[-2*#<_radius>] Z0 I0.500 K0.000 F42
> #<_radius> = [#<_radius>+#<_x_inc>]
> #<_y_dist> = [#<_y_dist>+#<_y_inc>]
> (move out)
> G1 X[-#<_x_inc>] Y[#<_y_inc>] F42
> O100 ENDSUB
> 
> S8000 (spindle on, 1/2" carbide, 2flute endmill, alum)
> G0 Z1.000
> G0 X0.25 Y0
> G1 Z0 F30
> G90.1 (absolute arc center)
> G91 (incremental distance mode)
> G18 (select XZ plane)
> 
> (call our subroutine until we reach the 6" mark)
> O999 WHILE [#<_y_dist> LT 6]
> O100 CALL
> O999 ENDWHILE


Wonderful program, congratulations. Specially because you wrote it in Linux, making it available for all those hobbiest using it, complementing the course. Thanks. Could you make a trial of it, film it and share with us?
   For many who have forgotten that these programs are short. the variable definition makes them versatile. A better approach that CAM. DMS YOU ARE THE MAN.:man:


----------



## DMS

I will try, but it will be a few days at the least. My machine is down while I make some enhancements (replacing variable speed drive in the head and adding spindle encoder).  I had a trial run last night, but need to make some adjustments. Close now though. I ran this program in "simulation" mode.

Any hints on real the assignment? Maybe I'm missing something, but I don't understand how to create the gradually increasing arc without cheating and using controller specific features.


----------



## Syaminab

DMS said:


> I will try, but it will be a few days at the least. My machine is down while I make some enhancements (replacing variable speed drive in the head and adding spindle encoder).  I had a trial run last night, but need to make some adjustments. Close now though. I ran this program in "simulation" mode.
> 
> Any hints on real the assignment? Maybe I'm missing something, but I don't understand how to create the gradually increasing arc without cheating and using controller specific features.


Hint, take one step at a time. First make an arc, then scale. Now move in Y and iterate until Y=6". It is all right to add instead of scaling. But the scaling feature is very useful for roughing or approaching a final dimension. Lets see if anyone else contributes with G code before pasting the recipee.
Regards.:think1:


----------



## Rick Leslie

I haven't tried to write the code yet, but my thoughts were to cut the initial arc, then progress each cut by scaling down until you reached Y=6" as stated. I have a mental block when it comes to writing arc codes. It looks good on paper, but when I try the cut, I either get a shape nothing like an arc or Mach tells me I've goofed and have errors.


----------



## Hawkeye

I needed to drill 896 holes in a piece of tubing this weekend to make a muffler for my 1965 Honda Trail 90. The thought of measuring the spacing or building an indexing jig sent me to the little CNC mill. Since my X-axis is only around 9", I set up a routine to drill 22 holes at 3/8" spacing in a single line. I mounted the tubing in two V-blocks and set the rotational increments by eye (16 rows, staggered pattern). Absolute precision wasn't a factor.

It's nice to have a bit of an understanding about what parameters to adjust to get a desired result. Having the notes to refer to helped. Thanks, Syaminab.


----------



## Syaminab

Hawkeye said:


> I needed to drill 896 holes in a piece of tubing this weekend to make a muffler for my 1965 Honda Trail 90. The thought of measuring the spacing or building an indexing jig sent me to the little CNC mill. Since my X-axis is only around 9", I set up a routine to drill 22 holes at 3/8" spacing in a single line. I mounted the tubing in two V-blocks and set the rotational increments by eye (16 rows, staggered pattern). Absolute precision wasn't a factor.
> 
> It's nice to have a bit of an understanding about what parameters to adjust to get a desired result. Having the notes to refer to helped. Thanks, Syaminab.
> 
> View attachment 50601


sorry to have you all so abandoned. But Im soaked in work for now. As soon as I deliver whats needed I will return to you with programs to do this easy... Congrats for your muffler.


----------



## Syaminab

Fellow Machinists, next time you ride on a dodge, guess who built the gripper jaws to machine the yokes?....I m almost finished with them, then I m back with more cnc programming.

- - - Updated - - -

They have lots of very precise features, including angled surfaces and holes


----------



## Syaminab

Rick Leslie said:


> I haven't tried to write the code yet, but my thoughts were to cut the initial arc, then progress each cut by scaling down until you reached Y=6" as stated. I have a mental block when it comes to writing arc codes. It looks good on paper, but when I try the cut, I either get a shape nothing like an arc or Mach tells me I've goofed and have errors.



Rick, maybe is because at the top of the arc, you touch the part with the tip of the tool, but at the end of the arc or bottom, is the side of the ballmill that touches the part... This gives you a hint?

   This last is a headache in five axes machinning... The contact point of tool when the tool oscilates is resolved with triangles. Try scrolling out of the edge one radious of the tool....


----------



## Rick Leslie

My arc codes never made it that far. I recently discovered the error of my ways and have since corrected the boo boo. It all came down to actually reading and understanding the instructions. (Funny how a small word like "center" or "offset" will change everything!) So now arcs and me are old pals. Now it's on to scaling and acrs in the XZ and YZ planes. 

Again thank you for posting these lessons. They have helped tremendously. I have a file with your name on it and the contents of this thread.


----------



## chuckorlando

Awesome thread. Way more then I can absorb in a reading. But we will be starting cnc in a few weeks so just easing that curve. I'm sure I will refer back this info a few times at least.

Thanks for taking the time


----------



## redpiperbob

Absolutely brilliant just what I need to get to understand Gcode as I am just starting out.
many thanks Syaminab.
Bob


----------



## Syaminab

redpiperbob said:


> Absolutely brilliant just what I need to get to understand Gcode as I am just starting out.
> many thanks Syaminab.
> Bob


You are welcomed, I hope this helps all you who care to learn.


----------

