Secret Art of MACRO PROGRAMMING on a CNC Machine | G-Code Genius

preview_player
Показать описание
You all have asked for it, and here it is! Donnie's first video simplifying Macros on a CNC machine. Specifically Tornos' SWISS GT 32. To start out this Macro Series the first macro we will cover is a Tool Counting Macro. Programming Macros made simple. Macros make the difference between a GOOD Machinist and a MASTER Programmer.

0:00 Tornos SWISS GT 32
0:06 What is a Macro?
1:30 Macro Programming on CNC Machine
2:56 Tool Counting Macro
4:10 Comparison Operators
8:17 Macro Program Overview
9:42 Swapping Kennametal CNMG Inserts
11:20 Torno's Switzerland Machine Shop Facility

Help us fund FREE Education by purchasing tools seen in our videos here:

Create your free CNCEXPERT profile here:

FREE CNC Machining Academy:

FREE Aerospace Academy:

FREE Grinding Academy:

___
___

Follow us on Instagram:

Like us on Facebook:

Join the conversation on our Facebook Group:

Connect with us on LinkedIn:

___
___

THANK YOU to our Partners who make this content possible:

#CNC #Machining #Machinist
Рекомендации по теме
Комментарии
Автор

Here is the Macro used in the video for any of you that are interested.

%
O1090(<MACRO VIDEO+A>)

#601 = 10 (T112 MAX TOOL LIFE)


G800 A1.125 B1 C0.5 D0.1 E.03 F0.0155
G801 A1100 B0.118 C0 D97 E2000 F.004
G802 A0.5 B0.5 C0.5 D0.5 E1 F0.5
G803 A2 B0 C1
M9000
(*** INITIALISATION ***)
M10
M82
/M8
G4 X1
G900
M9001
M9002
(*** AXIS REF ***)
G28 U0
G28 V0
(*** INITIAL CUTOFF ***)
M8
G910
M9003
(*** START LOOP ***)
N1 M120
(*** END OF BAR TEST ***)
G913
G930
M9004
(*** FEED NEW PART ***)
G912 B500
G0 W0.00787 (RETRACT THE BAR IN Z)
G0 X1.33858 T110 D0 (RETRACT THE CUT OFF TOOL X)
G1 G94 W.65 F165.
G28 U0
M9005
(*** MACHINING ***)
M9
G0 G95 G97 S1450 M103 P1 T112 D0 Y0
X1.2 Z0
G92 S5000
G96 S330 P1
G1 X-.05 F.007
G0 X.775 Z.02
G4 U1.2
G1 Z0 F.008
X.875 Z-.05
Z-1.03
X1.15
G0 G97 X1.2
#600 = #600+1
G28 U0
()
()
M9200
(*** CUT-OFF PREPARATION ***)
G97
M8
G0 X1.33858 Y0 T110 D0 M103 S5000 P1
G911
G1 G95 X.775 F.004
G0 X.9
W.045
G1 X.875
X.785 W-.045
G0 X.9
M9201
M9202
G1 G95 X-.045 F.004 (CUTOFF)
M9203
G1 X-.05 F0.00118 (END OF CUTOFF)
G97 (CONSTANT CUT-OFF CANCELLATION)
IF [ #600 GE #601 ] GOTO 1234
N5678
(*** END LOOP ***)
M121
M9204
M9
M105
M1105
M2105
M9205
M0 (STOP A END OF CYCLE)
/M8
G4 X1
M9206
M99 P1
M2
N1234
#600 = 0 (RESET TOOL COUNTER)
G28 U0
M9
M103 S100 P1
G4 U1.
M105 P1
#3006 = 1 (CHANGE T112 CNMG TURN)
M00
G0 Y0 X1.2 T110 G97 S1300 M103 P1
M112
G1 G95 X-.05 F.007
M105 P1
GOTO 5678

O1090(<MACRO VIDEO+B>)
M9000
(*** INITIALISATION ***)
M10
G900
M702 M2 M22 (Z4 TORQUE LIMITER VALUE)
M702 M3 M1181 (Z4 SERVO-LAG VALUE)
M9001
(*** AXIS REF ***)
G28 W0 (REF Z4)
G28 U0 V0 (REF X4 Y4)
M9002
G919
M9003
(*** START LOOP ***)
N1 M120
M9004
G55
M405
M9005
(*** MACHINING ***)
()
()
(*** PART EJECTION ***)
G55 (Z4 ZERO OFFSET FOR BACKWORK MACHINING)
M405
G28 W0 (REF Z4)
G0 X0 T500
M11 (OPEN THE COLLET S4)
G4 X0.5
M84
M85
G4 X0.2
G28 W0 (REF Z4)
G28 U0 (REF X4)
M9200
M9201
(*** PART PICKOFF ***)
G915 (SHIFTING FOR WORK IN OPERATION)
G97
G0 X0 Z0.07874 T400 M404 S5000 P4 (APPROACH BACK SPINDLE)
M418 (SYNCHRO PHASE)
M702 M4 M1 (TORQUE LIMIT Z4)
M702 M5 M1 (ENABLE SERVO-LAG CHECK Z4)
G924 (PART PICKOFF)
M9202
M9203
G1 G94 W0.07874 F78.74016 (CHECK BREAKAGE CUTOFF TOOL)
M702 M5 M0 (Z4 DISABLE SERVO-LAG CHECK)
M702 M4 M0 (Z4 TORQUE LIMIT CANCELLATION)
G95 (FOR LOOP START)
G28 W0 (RETRACT BACK SPINDLE)
(*** END LOOP ***)
M121
M9204
M405
M5105
M9205
M0 (STOP A END OF CYCLE)
M9206
M99 P1
M2

%

TITANSofCNC
Автор

Love the video. I once altered a cnc heater band cutting tool path so it could handle differing slot lengths and any kind of clearances. Commented the living daylights out of the top page explaining what the variable did on the program. Showed the boss a simulation and asked if we could try it. Long story short, less cutting time, everything matched up, and less cutter sharpening. This also freed up the cam programmers to concentrate on one off programming. And yes I got a nice raise too boot.

mikemcmullin
Автор

I watched the video for the first time and then I said, boy, this video needs a cup of tea, a notebook and a pen, there is really a lot of information in this video that needs to be jotted down, thank you guys for this video, especially the rap song at the end of the video, you made me laughing alot 😂

mohammedalbattal
Автор

This is what separates master machinists to machinist GODS. I've been testing macros for a year on my turret doosan, usually for knowing how long the bar stock is before changing to a new bar, or for milling polygons as Manual Guide i doesn't have a cycle for face milling polygons on my machine. You can even use macros for calculations while in a toolpath, if you want to make an elliptical shape or anything that is not a cone or a circle with some math included without a cam software. When done right, it is beautiful, efficient and, your co-workers who probably don't even know what a macro is will think you're doing some black magic and put their professional knowledge in question. On a technical note, always prefer using conditional loops such as WHILE rather than GOTO statements to avoid some nightmare situations. One interesting book about macros is CNC Programming using Fanuc Custom Macro B, by S.K Sinha. The author also replies to emails with technical questions and is much responsive on cnc forums

Orakwan
Автор

That book is the best thing ever for learning macros!!

Read it cover to cover 10 years ago and I haven't programmed the same since!!

moorepower
Автор

You can actually do the whole tool life macro (for all the tools) in a subprogram. This keeps your main program much cleaner and shorter.
There are also so many more uses for these macros, for example automatically calculating the origin point of the piece (even for both spindles if your machine has them). Also for dual spindle you can calculate where the 2nd spindle should go exactly when taking the workpiece from the 1st spindle using macro and subprogram (to keep main program clean and short).
I've done a whole system like this (more stuff than I wrote here) for myself when I was in school, even tho these things are not taught in school.

I wish I could have a job like these guys where I can try stuff and discover better systems.

DolphinWantsPeace
Автор

Busting out a nearly 20 year old book Peter Smid at the beginning; FANUC CNC custom macros, Programming resources for Fanuc Custom Macro B users

And yet because of how archaic G code is(Develop around the same time as FORTRAN), that book is still relevant. On the plus side G code is still being updated which is why Marcos and conditional loops are a thing. Now if only the manufacturers would actually standardize their G code and Macros.

Jack-ylcc
Автор

As a regular computer science student and certified programmer it's interesting to see how similar but also how extremely different gcode macro coding is to other languages like c++, Java, or python. It's all the same kind of logic at the base level. This actually reminds me of coding in assembly language now that I think of it.

ShootingUtah
Автор

I have to say I have watched a ton of your videos but this is the first one I have saved .
Great content

paulkraus
Автор

Thanks for helping make understanding macros so easy. Great video! Great job!

damionparson
Автор

Donnie my favorite guy at titans by far

cncshorts
Автор

Macros are super useful -keep teaching, it is always good to review

bikefarmtaiwan
Автор

This is control specific. Especially with fanuc controls. I highly recommend you read the machine manual AND the yellow fanuc books that come with your machine. With most fanuc controls you'll need a #3000 under your M30 or "end of record" M code.

brettmccafferty
Автор

Thank you so much for this its really helping Me fill in the gibberish after starting my job as a cnc operator.

Tablebreaker
Автор

Awesome video Donnie, I'm still recovering from my workout!

christophervillalpando
Автор

I program at a job shop with machines that are mostly 35+ years old. Macros and Subs help me keep my programs small enough to fit in the 32k-1024k of program memory I have. Also, I make macros for simple operations so the machinists can punch in a few variables and get stuff like helical plunge operations without bothering me

zakmn
Автор

Now that Iv mastered g code… I’m on to learning macros, and boy is it so much more difficult 😂I know 2 people that add their own custom macros for in process inspection and automatic tool changed after life expires and retouch off with tool break detect too, if you ever find guys that can make programs fool proof for lights out like that, pay them in gold and never let them go

adammiller
Автор

Have fun in Switzerland, I went to Tornos over 20 years ago and bought a couple Decos.

gooblio
Автор

A lot more simple than I thought it would be! Very cool!

penpal
Автор

Excellent video Donnie!

I’d get in trouble if I was caught using the macro part counter back in the day because the supervisor didn’t understand macros and was afraid the machine would crash. LOL “GOTO” on the other hand, was a lifesaver for proving out programs and picking up with where I left off in general.

I’ve also heard you can create your own alarms too! I never had the opportunity to ask the guy who figured it out; probably for the better because you know there would be some witty intent behind it 😆

Sara-TOC