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

Поділитися
Вставка
  • Опубліковано 4 жов 2024

КОМЕНТАРІ • 215

  • @TITANSofCNC
    @TITANSofCNC  Рік тому +38

    Here is the Macro used in the video for any of you that are interested.
    %
    O1090()
    #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()
    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
    %

    • @williamjohnson7764
      @williamjohnson7764 Рік тому +2

      #3006 is the same as M0 but with a message. Do you have to press cycle start twice? I use this all the time in programs, usually between tool changes, to have the operator clear scrap, fasten a part down, rotate a part, etc. He hits cycle start and program continues. #3006=1 (MESSAGE) is part of my default insert manual code in Mastercam. 👍

    • @lo77401
      @lo77401 Рік тому

      😉

    • @PerlStyle
      @PerlStyle Рік тому

      sooo my fanuc didnt have a internal program to do cavity type operations ... so i spent a good day at home outside of work hours..... and made this abomination. when i made it i was warking in italy so comments are in italian . not changing it for this post just google translate things :D
      %
      :0887(SVUOTAMENTO CIRCOLARE)
      (VERSIONE 2.0 PERL)

      G52X#31Y#32Z#33(POSIZIONAMENTO)

      G0G54X0Y0
      Z1
      G1Z0.1


      (---DATI FRESA---)
      (DIAM FRESA)
      #1=22.3
      (PERCENTUALE UTILIZZO FRESA - DA 1 A 100)
      #6=95

      (---DATI CAVA---)

      (DIAM CAVA)
      #2=28
      (PROFFONDITA MAX)
      #3=18
      (SOVRAMETALLO PARETE)
      #4=0
      (SOVRAMETALLO FONDO)
      #5=0
      (PARTENZA LAVORO Z - METTERE ZERO SE PARTE DA SOPRA)
      #7=0
      (NUMERO PASSATE PASSATE)
      #8=23

      (---CONTROLLO SICUREZZA---)
      IF[#2LE#1]GOTO100

      (---MATEMATICHE---)

      (DIVISIONI PER RAGGI)
      #11=[#1/2](RAGGIO FRESA)
      #12=[#2/2](RAGGIO CAVA)
      #13=[#1/100]
      #14=[#13*#6](PERCENTUALE UTILIZZO FRESA)
      #15=[#14/2](META UTILIZZO FRESA)
      #17=[#12-#4](RAGGIO PARETE CON SOVRAMETALLO)
      #18=[#3-#5](FONDO CON SOVRAMETALLO)
      #22=[#18/#8](INCREMENTO PASSATA Z CALCOLATO)
      #23=[#22/2](INCREMENTO -Z- PER FORI MINORI RAGGIO FRESA)
      #30=[#17-#11](INCREMENTO -X- PER FORI MINORI RAGGIO FRESA)


      (--- MODULI FORI MINORI RAGGIO FRESA---)
      IF[#17LT#1]GOTO1


      IF[#17GT#1]GOTO2


      N2

      #110=#22
      #111=#14
      G0X0Y0
      WHILE[#110LE#18]DO1
      #111=#14
      G1X#15Y0
      G1X-#15Z-[#110-#23]
      G1X#15Z-#110
      WHILE[#111LT#30]DO2
      G1X#111Y0
      G3I-#111
      #111=[#111+#14]
      END2
      G1X#30
      G3I-#30
      G1X[#30-1]Z-[#110-1]
      G1G40X0Y0
      Z-#110
      #110=[#110+#22]
      END1
      G0Z10
      GOTO101


      N1
      #110=#23
      G1X0X0
      G1X#30
      WHILE[#110LE#18]DO1
      G3I-#30Z-#110
      #110=[#110+#23]
      END1
      G3I-#30
      G1G40X0Y0
      G0Z10
      GOTO101


      N101
      G0Z20
      M99
      G53Y0Z0
      N100
      M30

      %

    • @PerlStyle
      @PerlStyle Рік тому

      also one for radial holes .
      %
      :0885(FORATURA SU ARCO CIRCOLARE)
      (V.1 PERL)

      G52X#31Y#32Z#33(POSIZIONAMENTO)

      G16
      (#2=DIAMETRO INTERASSE)
      (#3=PARTENZA IN GRADI)
      (#4=GRADI TOTALI)
      (#5=NR.FORI)
      (---MATEMATICHE---)
      #8=[#5-1]
      #7=[#2/2](RAGGIO)
      #6=[[#4-#3]/#8]
      #110=[#6+#3]
      X#7Y#3
      WHILE[#110LE#4]DO1
      X#7Y#110
      #110=[#110+#6]
      END1
      G15
      G17
      M99





      M30
      %

    • @PerlStyle
      @PerlStyle Рік тому

      and circular holes
      %
      :0886(FORATURA CIROLARE)

      (V.1 PERL)

      G52X#31Y#32Z#33(POSIZIONAMENTO)

      G16
      (#2=DIAMETRO INTERASSE)
      (#3=PARTENZA IN GRADI)
      (#4=GRADI TOTALI)
      (#5=NR.FORI)
      (---MATEMATICHE---)
      #7=[#2/2](RAGGIO)
      #6=[[#4-#3]/#5]
      #110=[#6+#3]
      X#7Y#3
      WHILE[#110LT#4]DO1
      X#7Y#110
      #110=[#110+#6]
      END1
      G15
      G17
      M99





      M30
      %

  • @mohammedalbattal77
    @mohammedalbattal77 Рік тому +19

    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 😂

  • @bikefarmtaiwan1800
    @bikefarmtaiwan1800 День тому

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

  • @mikemcmullin149
    @mikemcmullin149 Рік тому +2

    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.

  • @damionparson247
    @damionparson247 Рік тому +11

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

  • @Orakwan
    @Orakwan Рік тому +8

    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

  • @ShootingUtah
    @ShootingUtah Рік тому +18

    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.

    • @donniehinske
      @donniehinske Рік тому

      That’s interesting to hear!

    • @tj9382
      @tj9382 Рік тому

      Yes macro B uses the same kind of line by line logic as the older languages such as BASIC as opposed to the OOP approach of C++ and Python.
      Who knows, perhaps CNC controls will all us to write our classes one day. 😅

    • @mikemcmullin149
      @mikemcmullin149 Рік тому

      One thing I noticed is the GT LT type statements. I'm used to >, < and = (also => ,

    • @mikemcmullin149
      @mikemcmullin149 Рік тому

      @@tj9382 Fun Fact, DMG uses linux on their controllers and the GUI is python based with XFCE as the display manager.

    • @tj9382
      @tj9382 Рік тому

      @@mikemcmullin149 Oh really, that’s cool to know. 👍🏻

  • @paulkraus4799
    @paulkraus4799 Рік тому +2

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

  • @Jack-yl7cc
    @Jack-yl7cc Рік тому +9

    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.

    • @MrRtkwe
      @MrRtkwe Рік тому

      It's wild seeing this as a regular computer developer. This goes right back to the earliest ways of programming with explicit GOTOs and persistent global variables called macros for some reason...

  • @moorepower7
    @moorepower7 Рік тому +1

    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!!

  • @christophervillalpando1815
    @christophervillalpando1815 Рік тому +4

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

  • @DolphinWantsPeace
    @DolphinWantsPeace Рік тому +12

    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.

    • @cloudriz
      @cloudriz Рік тому

      Why can you not have a job like this? I’ve been doing this for 17 years and I can clearly see you know what you’re talking about. You don’t have to wish anymore dude.

    • @DolphinWantsPeace
      @DolphinWantsPeace Рік тому

      @@cloudriz because nobody gives me a chance to prove my skills. Maybe one day I'll also get lucky

  • @penpal222
    @penpal222 Рік тому +2

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

  • @cncshorts1075
    @cncshorts1075 Рік тому +3

    Donnie my favorite guy at titans by far

  • @CncFrezar
    @CncFrezar Рік тому +3

    Very interesting video!👍

  • @brettmccafferty465
    @brettmccafferty465 Рік тому +4

    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.

  • @adamfreeman218
    @adamfreeman218 Рік тому +3

    extremely informative video, Great episode

  • @Tablebreaker77
    @Tablebreaker77 Рік тому

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

  • @raghvendrasingh7941
    @raghvendrasingh7941 Рік тому +2

    Very useful my knowledge of cnc program

  • @zakm0n
    @zakm0n Рік тому +5

    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

    • @rkrbrts7149
      @rkrbrts7149 Рік тому

      helical plunging is a waste of time prefer to plunge point for pocketing dynamic. also subroutine G91 G03 I-. Z-. for counter bores much easier to identify, edit, much faster

  • @josechavez3670
    @josechavez3670 Рік тому +2

    Great video Donnie. Keep ‘em coming

  • @dustinvinci345
    @dustinvinci345 Рік тому +2

    Great video. Next video you should use the machine time to do an auto power off function!

  • @Sara-TOC
    @Sara-TOC Рік тому +3

    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 😆

    • @Orakwan
      @Orakwan Рік тому +1

      For part counter there is M54 on fanuc controllers that does just that. On some machines there will be an alarm when you reach the number you want, some other machines don't care and keep going

  • @fishsticks88
    @fishsticks88 Рік тому +3

    Great for using same program for multiple sized parts.
    Or things like circles or thread mills

    • @donniehinske
      @donniehinske Рік тому +1

      GREAT ideas! Thank you!!!

    • @bdude92
      @bdude92 Рік тому +2

      Exactly this. We use this at my work for varying sized parts. Soo much easier having one program to make 20 sizes than 20 programs!

  • @adammiller4879
    @adammiller4879 Рік тому +3

    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

  • @berntinulkshredder
    @berntinulkshredder Рік тому

    Fan and work, make the production a million times smoother! just cool to be seeing this sessions and love it. Just killing it all the time.

  • @gooblio
    @gooblio Рік тому

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

  • @VanillaGorilla_Machinist
    @VanillaGorilla_Machinist Рік тому +3

    Donnie taught me Threadmilling macros when he was at my shop while as an application engineer for a different project and now I’ve copied that macro to all our mills and we use the crap out of it 🤘🏻🤘🏻🤘🏻

    • @donniehinske
      @donniehinske Рік тому +2

      Thats awesome! What shop are you at?

    • @VanillaGorilla_Machinist
      @VanillaGorilla_Machinist Рік тому +1

      @@donniehinske it’s Steve from RockTech my username won’t come up

    • @donniehinske
      @donniehinske Рік тому +1

      @@VanillaGorilla_Machinist ohhhhh yea! I remember writing that with you guys! It was on an OKK if I recall! Glad it works out for you guys that’s so cool to hear!!!

  • @jimcarriesa1911
    @jimcarriesa1911 Рік тому +2

    Love that book.

  • @tdg911
    @tdg911 Рік тому +3

    Looks like Unix bash shell scripts 😁. Much love and gratitude.

    • @Jack-yl7cc
      @Jack-yl7cc Рік тому +1

      If only G code had the same level of flexibility as BASH but unfortunately it can't even compare to POSIX Shell.

    • @tdg911
      @tdg911 Рік тому +1

      @@Jack-yl7cc exactly. Been using Unix for 32 years now I’m learning g code so at least I have all of the different language structures down. Just need to focus on some manual programming g-code.

  • @senorimotor
    @senorimotor Рік тому +2

    Nice job with this video.

  • @zyndapp800
    @zyndapp800 Рік тому +2

    Excellent video guys, it's so good that you're showing it off on a Fanuc controller! There are just so many of them out there and macro stuff is super useful. It's just such a shame that Fanuc isn't producing anything similar...

  • @nrodondi
    @nrodondi 11 місяців тому

    Yes more videos about macros please

  • @tj9382
    @tj9382 Рік тому

    Great video. I was pleasantly surprised to see that book, the very same one I got my company to buy me many years back. And I still use it today when I need to reference or refresh my knowledge.
    Once I discovered Macro B it was a game changer for many of my had written programs.

  • @boldlyspokennoah307
    @boldlyspokennoah307 Рік тому +7

    I’ve been super curious about macros so this was pretty cool would definitely like to see more. Also Donnie I’ve said this before but you got mega ninja turtle vibes my dude

    • @donniehinske
      @donniehinske Рік тому +3

      Haha well thank you. Usually I get told I have golden retriever energy

    • @boldlyspokennoah307
      @boldlyspokennoah307 Рік тому +2

      @@donniehinske I mean not gonna lie that too lmao but definitely more ninja turtle then golden retriever

    • @travistucker7317
      @travistucker7317 Рік тому +1

      @@boldlyspokennoah307 you trying to say he hangs out with sewer rats?

    • @boldlyspokennoah307
      @boldlyspokennoah307 Рік тому

      @@travistucker7317 cmon don’t rip on yourselves like that!? Jkjk although that would probably make titan master splinter

  • @achpek13
    @achpek13 Рік тому

    Love this guy. Natural vlogger!

  • @CD3DP
    @CD3DP Рік тому

    Thank you for the lesson you’re a great teacher!

  • @gerhardvictor5475
    @gerhardvictor5475 Рік тому

    Great video. I'm looking forward to more on this topic. Thanks a mill

  • @backyardengineer916
    @backyardengineer916 Рік тому

    Donnie is such a vibe

  • @ashokzala2683
    @ashokzala2683 10 місяців тому

    Very nice i like your guidelines

  • @sicstar
    @sicstar Рік тому +2

    Donnie the magician introducing us into the dark arts of macro's in programming. :D Well all in all no black magic if you know what you doing, much appreciated to show a glimps of whats going on inside the blackbox for people not that familiar with it or still learning!
    Also really nice to throw the whole macro code in the comments!

  • @brendonv101
    @brendonv101 Рік тому +1

    I'm not a machinist nor do I intend on becoming one, yet I still found this highly enjoyable. ☺️

  • @davidsum8924
    @davidsum8924 Рік тому

    yes. marco is very useful. as early as the 6M series, i myself have created quite a variety of marco.

  • @shaniegust1225
    @shaniegust1225 Рік тому

    Wow! Great video Donnie! Looking forward to more 👍

  • @mtn_sivliu
    @mtn_sivliu Рік тому

    this was actually very educating. thanks a lot.

  • @suicidesquadie7990
    @suicidesquadie7990 Рік тому

    G code simplified with complex macro's. Still copying and pasting your macro's so many of my programs. Made some of my own too, nothing too advanced. Appreciate the excellent training I received from you.

  • @Dn1sdr
    @Dn1sdr Рік тому

    Love to see more information about using macros to interface with the ERP systems.

  • @adammiller4879
    @adammiller4879 Рік тому +1

    Can we please get a video on how a Swiss machines collet system works so well and clamps well enough to
    Turn ? Pretty please

  • @brianmcbrinn7564
    @brianmcbrinn7564 Рік тому +1

    A video I would like to see: Creating your own g codes and incorporating macro variables(like tornos G800/G900). These variables are used in other G codes or you can even create a torx head.

  • @fernandonegrete425
    @fernandonegrete425 Рік тому

    Awesome! Excellent video. A macro for compensating work offset with touch probe would be very interesting :D

  • @ExplodingPinappleHD
    @ExplodingPinappleHD Рік тому +3

    Can we also see some mill applications for macros? I used them on 4 axis mills in a aerospace shop on tombstone type fixtures

    • @donniehinske
      @donniehinske Рік тому +2

      Good idea thank you! Will be a great way to show system variables

  • @master8laster49
    @master8laster49 Рік тому

    Awesome Donnie, I have one for you that I've wanted for quite some time: A macro that can turn really long parts with seamless transitions, no lift just turning all the way to 35" and lets do it in Titanium, I could really use that!

  • @Sk8rdkr
    @Sk8rdkr Рік тому +2

    I got a 3 axis vertical mill. Fanuc control. With very little memory. I would like to run multiple vises and run more parts without creating longer programs and sometimes you may only be able to setup one or 2 vises. With each vise being assigned G54, G55, G56, etc. Is it possible to write a macro to change the work offset in each tool block to cycle through G54, G55, G56? May make for a informative video? Great job with all your doing! Helping us all means a lot!

    • @travistucker7317
      @travistucker7317 Рік тому +1

      There are a few ways to do this, but sticking with what was in the video, you could do the same format, run your program in g54, hit 601, your 1234 takes you to a g55, since that's modal, your program can run assuming you don't have 100 g54s in the way, then 602 takes you to g56. Or something like that. You can sit down and write it out

    • @vladimirivanov8114
      @vladimirivanov8114 Рік тому +2

      most fanuc controls can switch the work offset just by typing G54, G55 etc. (that's why they actually called G..)
      so the program will be as simple as
      G54;
      M98 P0001;
      G55;
      M98 P0001;
      ...
      M30;

  • @rcandcnc9684
    @rcandcnc9684 Рік тому

    Cool, really well explained.

  • @damiansz4883
    @damiansz4883 Рік тому

    Great!!! More macro examples please!!!

  • @dimsum5567
    @dimsum5567 Рік тому

    You guys produce great content!

  • @yassinesaidi2230
    @yassinesaidi2230 Рік тому +3

    Great video..and in fact we really need more tutorial videos about macro program..when I was working in milling machine I tried to understand macro programming many times but I failed...not because it hard..it because I didn't find any one can explain that in easy way and further more there are really few videos in UA-cam talk about this type of programming.

    • @donniehinske
      @donniehinske Рік тому +5

      That’s why I am really looking forward to bringing you guys this series! I truly hope it helps

    • @donniehinske
      @donniehinske Рік тому +2

      That’s why I am really looking forward to bringing you guys this series! I truly hope it helps

  • @younhap
    @younhap Рік тому

    Thank you for the video!

  • @Chiefs1582
    @Chiefs1582 Рік тому

    We run a ton of macro programs at work it's super convenient

  • @Yamahog
    @Yamahog 7 місяців тому

    Great Vid .... Brings back memories of the 90's when I was punching G-code into my Haas VF 1 and VF 2
    Anywho, Don, a question .... Kenametal or Valenite. And what about Boron Nitride ,( CBN ).
    Stay Safe

  • @falconidaes
    @falconidaes Рік тому

    Never use GOTO statement in any code. Yo can learn that in the first year of University. In the next years you can learn it from experience when other try to use it.
    Anyway, series of programming CNC I found very productive. Keep it rolling.

    • @filippomontevecchi8618
      @filippomontevecchi8618 Рік тому

      If you are programming fanuc cnc it is not easy to avoid GOTO. The IF statements allows the conditional execution of a single macro statement or a conditional GOTO. Therefore if you want to condionally execute a bunch of macro ans cnc lines there are little alternatives. But I agree with you that GOTO should be avoided whenever possible.

  • @jonivanart
    @jonivanart 10 місяців тому

    Can you write a sub-macro where it can calculate the amount of travel a particular tool made while cutting and add that up to calculate actual tool wear? Then add that to any similar tool when programming it so you can change it out when it has reached its limit.
    Very cool stuff though. Similar to robotics programming, which is my field. 🤙

  • @khusco1180
    @khusco1180 Рік тому +3

    Moro macros please 😁

  • @TOXIXIFY
    @TOXIXIFY Рік тому +2

    I'd really like to see a macro that can vary the spindle speed during a cut on a lathe to prevent chatter.

    • @Glenrok
      @Glenrok Рік тому

      You can do it. I’ve written one in the past, it’s usually dependent on an added variable for the distance travelled before the chatter starts then adjusting the speed up or down as required when it reaches that point. I found it a bit awkward to use in practice because it requires trial and error for each different type of part before they can run in production.

    • @xm210c
      @xm210c Рік тому

      ​@@Glenrok I think the top level comment is actually talking about a macro that constantly varies cutting speed based on a randomly generated (or a seed generated / function) pattern along the programmed path (whatever that is) around a base value. This should by itself alleviate some chatter issues by itself because it'd break up resonance from building up.
      What you seem to be implying is a cutting speed gradient along a path which is a trial and error solution but you can guesstimate from experience a bit sometimes. Something like a 50% slowdown over a 4xD distance for example. My own experience is actually more dealing with extremely long endmills, 6xD+, occasionally had to grab a 10xD here and there to mixed success.

    • @Glenrok
      @Glenrok Рік тому

      @@xm210c yes, that’s exactly how my macro worked. Either way it would have to effect some change in rpm based on either time or distance- obviously I chose distance for mine. I like your idea of a randomly generated number within a specified range, unfortunately I neither know or can find a function in Macro B which would produce one, so a macro would have to be written just for that which would then be called by the chatter macro. I doubt the maths to do so is beyond me- but it is beyond what I could be bothered to mess around with to find out…….😏

  • @kevinkc3onohelijeepworld953
    @kevinkc3onohelijeepworld953 Рік тому +1

    Machining & programming all in one vid 😊exciting
    010 power logo up
    020 illumination on
    030 move forward 30 paces
    040 announce hello ☺️we had a robot in elementary school and got to program it to move about the school, now I get to run a automated pick n place machine and watch it build smt pc boards 😉

  • @smokeymadden44fan
    @smokeymadden44fan Рік тому +1

    How does that work without having end1 and do1 statements? Never seen it done this way. Awesome video thanks

    • @donniehinske
      @donniehinske Рік тому +1

      Those statements go into a WHILE statement. This is just IF and GOTO. They work a little differently

  • @coreyb4073
    @coreyb4073 Рік тому +1

    I did a macro program for a tapered stud for a customer, they called me in to do a new version of the stud about 2 years later, I changed 3 variables and the machine was making parts.

  • @moorepower7
    @moorepower7 Рік тому +1

    Can you show a way to write a macro to keep track of time from a cycle start to a cycle start?
    I am wanting an easy way to track time per part including setup for billing purposes. The machine (Haas) tells cycle time but I want to easily track part to part time. Trying to stopwatch is a pain 😆

  • @stevedevney7322
    @stevedevney7322 Рік тому +1

    I would love to see a multi tool change based on Useage. Is parts 1-10 on t1, parts 11-20 on t2, … parts 51-60 on t6.

  • @Yamototamto
    @Yamototamto Рік тому +4

    How about programing making a hole with an endmill with spiral toolpath?

    • @donniehinske
      @donniehinske Рік тому

      Yea that’s a good one! You thinking like a circular pocket macro?

    • @tomislavsvogor3877
      @tomislavsvogor3877 Рік тому +1

      do you mean just the normal helix? you don't need a macro for that. I will write you an example of how I do it (Heidennhein)
      G0 X0 Y0 Z50
      G0 Z10
      G1 Z1 F...
      G43 X=50:2 ( 50 is the diameter of the hole in millimeters )
      G41
      G3 Z-20 I0 J0 K-1 ( K-1 means that when the tool is working, the shift is 1mm downwards for one round. in this case, the tool will make 20 circles downwards )
      G3 I0 J0 ( I only do this to clean the bottom of the hole )
      G40
      G1 X0 Y0
      G0 Z100

    • @Yamototamto
      @Yamototamto Рік тому

      @@donniehinske yes. I work on a 4axis mill on FANUC. Basically I use mostly build in instructions from machine. But i'm curious if it is possible to make a macro for making a circular hole but with spiral toolpath like from cam software. Normally fanuc does it like this. Drop down in pre drilled hole or pocket then it makes a circle then adjust one step into the material and then another circle upsizing hole with each circle by that step u programmed in built in cycle. It would be awesome to do it like from cam where you have constantly increasing diameter in which tooll traverses. With macro i think you can program end diameter you want and then program step of that spiral. It would need to include that incremental instructions but it is hard for me to grasp yet. Sorry for bad english. Thanks for reply love your content ppl and all of it. Best wishes from Poland! BOOM!

    • @donniehinske
      @donniehinske Рік тому

      @@Yamototamto I see what you are saying. Let me start jumbling that around in my mind and I’ll think of something. I’ve written circular interpolation macros before like you are saying I’ve never had it increase diameter as it does the circular movement (spiral) like you are saying.
      It CAN be done though. Nothing is impossible! Stay tuned for a video

    • @donniehinske
      @donniehinske Рік тому

      @@Yamototamto also… thank you! I am glad you enjoy our videos!!! 😀

  • @richhuntsd12
    @richhuntsd12 Рік тому +1

    Awesome video, thank You, but I just can’t hear that fast! Whew

  • @mikhaildavydenko6841
    @mikhaildavydenko6841 Рік тому

    You miss to tell about #3901's variables which is about workpieces counter. In many cases, when we have a looped workflow we need to deal with that thing

  • @johnl5177
    @johnl5177 Рік тому +1

    Next idea. Do how to engrave counting serial numbers for parts that will update and store quantity

    • @zyndapp800
      @zyndapp800 Рік тому

      Yes, please start with G1025 engraving cycle that is using macro variables for serial number. This would be super useful!

  • @cloudriz
    @cloudriz Рік тому

    I would enjoy and make great use of a video that could probe a bore populate a work offset. I have some parts in my shop that need reworked. The swimgarms for Polaris slingshots lol.

  • @kingbullol3314
    @kingbullol3314 Рік тому +3

    I had no idea macros were even a thing before your thread macro video, so any video on any macro will be interesting for me. Also, are macros mostly used in swiss machines and production of big quantities of parts?

    • @donniehinske
      @donniehinske Рік тому +3

      Macros can be used on almost any CNC machine. Some just may be formatted differently. Any Fanuc control with Macro B will work like this. You just may only have #500-#549 to play with

    • @havokwest4359
      @havokwest4359 Рік тому +3

      Macros can be used in a wide variety of lathes and mills. I've created mill macro program to quick write center/drill/tap programs that kick out proper speeds and feeds for simple plates, a single program for making multiple simple bushings per push off our Haas Lathe w/ barfeeder just by entering the desired OD and length, and controlling stock breaks on Swiss machines when for when you find yourself swapping bar sizes every time you run a job. They definitely take a lot of upfront programming and knowledge of what your using them for, but can save a lot of time in the end for shops that find themselves making a lot of simple parts that change sizes with the wind.

    • @tomislavsvogor3877
      @tomislavsvogor3877 Рік тому +2

      @@havokwest4359 when you learn to use a macro, programming becomes easier and the program is clearer and neater when written by hand on a machin. and the advantage is that you seem like God to operators who cannot learn and understand how macro works 😄

    • @Hi_Doctor_Nick
      @Hi_Doctor_Nick Рік тому +3

      I ran a EDM wire 95% of the time using macros. Had it from setting up a pallet of parts, calling programs to set each position, then each program per part. Even had it changing power settings and spark gap for the same program depending on material thickness. All from changing a few numbers. Macros are brilliant and simple for operators to use. I love programming them, the harder the better. Really gets the old brain working lol.

  • @heyjeeery7587
    @heyjeeery7587 Рік тому

    cute video, you can also use GOTO to skip over a tool or tools in a program, just in case you have to change the order without bugging your programmer.

  • @williamlind2843
    @williamlind2843 Рік тому +2

    Dude!! I have guys with me that can barely write G-code. They are so afraid of it and make it harder than it is. My 1st supervisor left me to go to the mill dept after 2 years operating experience. He said you're the new lathe supervisor, G1 is feed, G0 is rapid and walked away forever!! 35 years later I'm running a CNC division at a large manufacturer, and I can't get these guys to get it!!! I'm literally here watching TITAN'S of CNC on my own time!! They won't do it!!!

    • @DannyWallsPratt
      @DannyWallsPratt 10 місяців тому

      You're so fuckin awesome. You're a great expert. Bet your company would fold without you....punk

  • @dakotareid1566
    @dakotareid1566 Рік тому

    Can y’all do more videos like this for mills and lathes?

  • @moosedeuce2307
    @moosedeuce2307 Рік тому

    I’d love to get some videos on macros for setting machine offsets

  • @ttools_professional5173
    @ttools_professional5173 Рік тому

    Please do a course for the swiss type lathe

  • @jasonbohacek1130
    @jasonbohacek1130 Рік тому +1

    Fancy BASIC

  • @supremecommander2398
    @supremecommander2398 Рік тому +1

    i am still waiting for the internal hexagon on the swiss cnc 😆

  • @rkrbrts7149
    @rkrbrts7149 Рік тому

    good vid, would prefer less cartooning during the training (off track) other than that good macro

  • @cncmilljunkie
    @cncmilljunkie Рік тому

    The only way to know if a macro is not being used is to do a deep dive to every program on the machine and check for macros that are being used. Reading the documentation that comes with the machine is a good start, but I ran machines where the machine tool builder book was wrong. On top of that, you don’t know if anyone had dip there fingers in the programs on the machine. I myself will program Marcos that will return the values to null when finished as a safety check to make sure those values can’t be used somewhere else.
    With that being said, can you go over the basic concepts to writing programs for probing?
    Like how to check for low battery State
    Calibration procedures
    How to find the safest max feed rate during a non contact move and the fastest feed rate that can be use for a measuring move.

    • @Glenrok
      @Glenrok Рік тому

      That’s a good idea, but a better idea would be to read and store any value already in the variable, then return it to that value after your macro finishes. That way, if the machine is depending on an already stored variable, it’s not jeopardised from having been returned to null…..

  • @flyingjeep911
    @flyingjeep911 Рік тому +1

    Can y’all do a vidjeo on DO Loops

  • @nonamenoface8828
    @nonamenoface8828 Рік тому +1

    WHILE [YOU WORKING] , [ WE ] GOTO [ DRINK A COFFEE ] !

  • @nathanthomas8184
    @nathanthomas8184 Рік тому +2

    RAY Charles can do it Right, do it Right, twistn G50's loop de loop
    Titan academy,,,BOOM,,,

  • @theoDSP
    @theoDSP Рік тому

    I'm a software engineer. and looking at the Macro programming guide I can see very chaotic style of programming ther. Global variables, goto statements, implicit semantics. AKA a nightmare...

  • @jonnywalker3610
    @jonnywalker3610 Рік тому +3

    Where can i buy that book?😊

    • @Jack-yl7cc
      @Jack-yl7cc Рік тому +1

      The book is written by Peter Smid, called FANUC CNC custom macros. It's nearly 20 years old, so you can find some used copies floating around somewhere online. It's also still in print if you want to buy it brand new.

    • @Hi_Doctor_Nick
      @Hi_Doctor_Nick Рік тому

      Could download the pdf

  • @stuartgaylor2420
    @stuartgaylor2420 10 місяців тому

    Is it possible to do MACRO using live axial Endmilling to make different sized hexagons or squares.
    Like, type in 12 so it will do a 12mm hexagon

  • @ronvonbargen8411
    @ronvonbargen8411 10 місяців тому

    I don't understand the GE line wouldn't you want that to be a LT so that the machine keeps running while it's LT ten and then when it counts up to ten have it go to m30 or m00 etc
    Would this work?
    #601=10
    #600=0
    N1234
    Main program
    #600=#600+1
    If[#600 LT #601]N1234
    M2

  • @arturobetancourth3988
    @arturobetancourth3988 Рік тому

    Macro for auto-comp please!

  • @stevesye9114
    @stevesye9114 Рік тому

    I would love to see a macro that can cut 100 grooves around 360 degrees. Thanks

  • @keithkeller1025
    @keithkeller1025 Рік тому

    What’s the repeatability of that specific tool holder? In the past on various Swiss machines, like a Star, you’d have to pull the whole holder out, touch off, etc m, then make an offset. Just curious

  • @rahimzettili9354
    @rahimzettili9354 3 місяці тому

    Is 3006=1 work for all the machines or I need to look on manual which one it allows the message not alarm.

  • @sondreheggnes8321
    @sondreheggnes8321 Рік тому

    i'd love to see a macro for siemens, i have a siemens 840d sl controller, and the machine is automated with a robotic arm from ABB, however the camera that sends the coordinates for the part to pick to the robot is not that good. when i use marposs probe i want to be able to limit the probe if i have a part sticking out on the one side for milling it so i don't have to machine my jaws over and over again

  • @Rooster121384
    @Rooster121384 Рік тому

    Can you show how you would input the same macro "tool life" for multiple tools that have various tool life. Say od turn rough has 20pcs tool life. Od finish 40pcs. Cutoff 40pcs etc. I feel like your greater to or equal to main count say od turn rough of 20 would have to be in a different area. Or do you just create those macros in tandem with start at say 400 finish 401. But with all tool life? Thanks in advance

  • @SirW-m1g
    @SirW-m1g Рік тому

    Is it possible to have the screen automatically go back to the program screen when cycle start is pressed after user defined message appears?

  • @michaelpawluk6791
    @michaelpawluk6791 Рік тому

    We're you an application engineer for Tornos?

  • @manfredlafs8472
    @manfredlafs8472 Рік тому +2

    Really nice and informatic video im currently on a DMG Morie NLX3000, with a Mapps II OS, is it Possible to do it in a Maschine like this with the same macro code or do i have to search for the macro code for my machine?

    • @donniehinske
      @donniehinske Рік тому +1

      Your machine will have #500s and up. Just find them in your offset page and make sure they aren’t being used before typing away. I know on older Mori machines the macro menu is harder to find. It’s annoying but it’s there

    • @manfredlafs8472
      @manfredlafs8472 Рік тому +1

      @@donniehinske Thank you for youre reply, i found the macro page but i never used it cause im just a trainee and for our Programm wen dont really use them

    • @donniehinske
      @donniehinske Рік тому

      @@manfredlafs8472 Just be careful and take your time! Learning them is one of the most powerful tools in the industry!

    • @manfredlafs8472
      @manfredlafs8472 Рік тому

      @@donniehinske I first need to ask for permission to make something like this cause it takes time, and if the machines not running the company losing money

    • @tomislavsvogor3877
      @tomislavsvogor3877 Рік тому +1

      @@donniehinske when we use the macro, we use it so that there is no problem even if the macro is used. for example: if I use #500 to define the offset at the beginning of the tool and another operator overwrites that macro with another variable, it's not a problem because when I start my program, macro #500 is set again to the value I defined. you mentioned that you have a macro of that thread stored next to it. if you defined those macro values in that program, you can later delete or change them without any problem, because the next time you start that threading program, your values will be written again in the macro you use.