Customized Apps and Coding for CNC Machines
|Typical Siemens 840D main operator control panel.|
Advanced CNC Solutions specializes in developing custom Excel applications to generate CNC code for unique controllers.
Extensive experience in Excel VBA code writing, 3D spreadsheets, chart creation and formula linking across multiple workbooks.
Can develop user defined functions, automate machining processes, including manipulating user interface features, such as menus and toolbars, and working with custom user forms and dialog boxes.
Contact Advanced CNC Solutions for experienced CNC programmers, call 1-800-930-4213 today!
At Advanced CNC Solutions, our mission is to apply our many, many years of real-world CNC programming experience to developing accurate, concise and optimized CNC programs in a timely manner for all customers, saving you both time and money.
Advanced CNC Solutions, a contract CNC programming services provider, has compiled these programming techniques and tips through decades of CNC programming and machining experience.
Below are general programming concepts, tips and suggestions that can be applied to Fanuc, Siemens, Okuma or most any other controller in the CNC machining center or CNC lathe environment. Advanced CNC Solutions implements these concepts and techniques and many others within every program we develop and distribute.
STRUCTURED CNC PROGRAMMING:
Structured programming ensures programs are more tolerant and forgiving when tools are added or deleted from the NC program. This concept may also protect CNC equipment when a machine operator runs tools or specific cuts out of normal program sequence. Placing redundant modal commands in strategic areas of the CNC program produces more reliable code and is the cornerstone of well-structured CNC code. Structured programming promotes consistency within a given program and from program to program. Structured programming also creates predictability when converting NC programs to a different type of NC controller.
Here is a list of a few suggestions to make a more structured NC program:
- If more than one fixture offset value is used, a fixture offset command (G54, G55 ...) should be invoked right after every tool change.
- If programming a 4-axis machining center, a table index command (i.e. B0, B90 ...) should be invoked right after every tool change (even if redundant table index).
- If fixture offsets are used for each table index, then invoke fixture offset word in the same block of code as the table index command. This ensures the correct fixture offset is used with the corresponding table index (even if the operator is re-starting the program somewhere in the middle of code). It is very difficult or impossible for an operator to execute only part of a program block, guaranteeing if the table index angle changes so will its corresponding fixture offset value.
- When using canned cycles, use redundant X and Y coordinates for all holes.
- This permits easier execution of code from within the middle of a canned cycle, allowing the operator to re-drill or re-tap specific holes only. Using redundant X & Y coordinates also makes it easier to modify or edit order of holes on machine control. Trying to change the order of drilled holes without redundant X and Y coordinates can be downright tedious!
- Cancel the canned cycle (G80) after the last hole in a group to prevent possible problems from occurring later in the program.
- Repeat plane selection word (G17/G18/G19) at beginning of each and every tool (at a minimum) if switching cutting plane selection in program.
- If intermixing feed per minute and feed per revolution modes within a CNC program, invoke feedrate mode (G94 or G95 for machining centers) (G98 or G99 for most lathes) at beginning of every tool or invoke feedrate mode every time a feedrate command or G01 is called out. Allows operator to re-run tools out of sequence without any feedrate surprises (like 2.0 inches per revolution -– damned fast! or 0.008 inches per minute -– program/part may finish next week).
- Perform spindle off (M05) at the end of each and every tool. A least one type of (machining center) CNC controller will automatically turn on the spindle after loading the next tool (invokes a spindle on at M06 command) using the previous tool’s spindle speed. This can be very dangerous if the previous tool’s spindle speed was rather high and the newly loaded tool is a long ejector drill.
At beginning of program:
- Invoke plane selection (G17/G18/G19).
- Invoke inch or metric mode (G20/G21 OR G70/G71).
- Invoke canned cycle cancel CODE (G80).
- Invoke absolute programming mode (G90).
- Invoke cancel cutter compensation (G40).
- (Sample: G17 G20 G40 G80 G90)
- Add NC code to force Z axis (Machining Centers) back to home position.
- Add NC code to force X & Z axis (Lathes) back to home position.
MODULAR CNC PROGRAMMING:
Provided it’s not a process flow issue, a machine should NEVER crash simply because a programmer or operator changes the order of (or deletes) tools within the program! This happens when modal G-codes and other G, M, F and S-codes were not set properly for EACH specific tool. The concept of modular programming is the mechanism to protect against this problem.
Modular programming forces programs to become far more consistent and forgiving (which protects CNC equipment from damage) when an operator runs tools or specific cuts out of the normal program sequence. Modular programming ensures the correct G-codes, fixture offset, tool length offset, and other word registers are preset if a tool (or even one group of cuts) needs to be re-executed.
A machine operator should be able to run or re-run individual tools out of the normal program sequence without any adverse program effects. Likewise, a programmer or operator should be able to change the order in which tools run (or even delete tools from program) without any adverse program effects (provided the machining process allows this). Modular programming allows this to happen by forcing each tool to have its own set of necessary modal commands and programming attributes like spindle speed, feedrate, and fixture offset. Each tool within a program should be able to fully function on its own (self-contained) without the support of any NC code from any other tool within the program. The big test: if you were to copy and paste any single tool into its own little program, it should run perfectly without any programming issues. This should also be the case even if every modal G-code (and other G, M, F and S-codes) were set in conflict prior to running the single tool program. The single tool program should set ALL NECESSARY modal & non-model codes, allowing it to function properly as a self-contained program. In some cases even individual cuts, like thread milling a single hole, should be designed to function on their own program wise. One good example of this would be an operator may need to re-cut a specific thread milled hole.
Here is a list of suggestions to make a NC program more modular and segmented. These ideas tend to make programs a bit longer (with lots of redundant code), but lack of memory is no longer an issue on most CNC controls.
- Repeat absolute (or incremental) programming mode (G90/G91) at the beginning of each tool and where necessary.
- Repeat fixture offset (G54, G55, etc.) after every tool and at beginning of each table index.
- Repeat spindle codes (M03S....) after every tool change and at beginning of each group of cuts and/or table index.
- Repeat feedrate after every tool change and at beginning of each group of cuts and/or table index.
- Repeat G43 and H word (Tool length offset) after every tool change and at the beginning of each table index.
- Repeat coolant code at beginning of each table index.
- If used, repeat cutter compensation G41 or G42 word along with D value (Tool radius compensation offset) at the beginning of each table index.
- If thread milling, invoke G41 or G42 word and D word for each hole. (Easier for operator to re-cut single threaded hole.)
- For lathes, use G50 (or G92) (Maximum Spindle Speed) with G96 (Constant Surface Speed) or G97 (Constant Spindle Speed) after every tool change.
CYCLE TIME REDUCTION TIPS:
- Use adaptive feedrate function if available. The adaptive feedrate feature will save on insert wear and cost, possibly reduce cycle time and will prevent damage to cutter bodies and tool holders.
- Utilize the “thru the tool” coolant machine option. Very high drilling feedrates can be successfully achieved with machines supporting 600-1200 PSI thru the tool. (Higher PSI usually equates to higher feedrates!)
- Use hi-performance tooling (especially high quality coolant thru carbide drills) for high volume parts. Tooling is cheaper than part cycle times.
- For high volume parts, use carbide step drills and/or multiple diameter carbide or inserted form tools if possible.
- Use wiper inserts on machining center finish face mill cutters and lathe finish turning tools. Noticeably higher feedrates can be achieved.
- For high volume parts, use CBN (or other technologically advanced) inserts for finish face mill cutters. Extremely high feedrates can be achieved with CBN inserts.
- Use round inserts whenever possible. They are more difficult to program but can utilize noticeably higher feed rates and have much higher insert strength. Round (and 15 degree lead) inserts are also great for milling and turning forged steels and flame cut steel.
GENERAL PROGRAMMING TIPS:
- If you use a CAD/CAM system, have the system automatically create the tooling list/set-up sheet. This method is less error prone and, if set up correctly, the tool sheet tool numbers will be forced to match tool numbers within program.
- Within NC program, add a comment describing each tool used and place text somewhere near the tool selection.
- Ex: (1.250 DIA CARB ENDMILL –- T21)
- If the CNC program is long or a specific tool does a lot of cutting, place comments describing type of cut about to take place. Such examples could be:
"RGH MILL FRONT PADS", "FIN MILL TOP 2 BOSSES" or "PROBE LEFT 4 CORED HOLES".
These messages aid in program prove-outs and the machine operator’s ability to understand the program.
When programming, do not guess on feedrates and speeds.
If possible, fast feed across openings or pockets when face milling.
To correct for taper when finish boring on a lathe, change NC code per example. Change from G1 Z1.275 F.012 to G1 U.0014 Z1.275 F.012 If the back of the bore was small by 0.0014” this will cut a taper increasing the back part of the bore diameter by .0014”, therefore cancelling out the taper.
In some cases during a program prove-out, it makes sense to “plus” a (possibly troublesome) tool away from the workpiece by 2” or so. Plus the Z axis above the part for machining centers and plus the X axis for lathes or remove the part from the chuck. Then run the tool checking for correct cutter paths, fixture clearances and no erroneous moves or feedrates. This allows the operator to know what to expect in terms of tool motion before the cutting tooling is engaged in the actual part. When the operator re-runs the tool, with the tool set to cut (no longer “plused-out”) , they can concentrate on just cutting conditions like depth of cut, insert or chatter problems and such.
Only use aggressive feeds and speeds AFTER program is proved out. There is no enjoyment in trying to pay attention to tool cutter path motion while tooling is being damaged due to excessive feeds and speeds.
- If declaring multiple fixture offset values (G10 commands) at beginning of a program, use a comment describing each fixture offset. This is a great aid for other programmers and machine operators.
- (STATION 1 – B90 -– LEFT SIDE)
N10 G90 G10 L20 P11 X-19.1755 Y-8.1895 Z-42.1303
- (STATION 2 - B180 -- OVAL FLANGE FACE)
N20 G90 G10 L20 P12 X-24.6932 Y-25.164 Z-34.1259
- (STATION 2 - B215 -- SQUARE FLANGE FACE)
N30 G90 G10 L20 P13 X-26.8124 Y-25.164 Z-35.7244
MORE INFORMATION TO FOLLOW:
Look for more related information to be added to this page on a regular basis.
Copyright © 2012 AdvancedCNCSolutions.com