Programming CNC Macros - Part 1

แชร์
ฝัง
  • เผยแพร่เมื่อ 26 ส.ค. 2024
  • Having a look at Fanuc Macro B Programming. We'll go through a very basic program to provide an introduction into what you can do with macro programming. I'm going to focus on the Fanuc Macro B language since it happens to be very common control and the Haas macro language is pretty much exactly the same. In the accompanying video, the software being used is Cimco Edit 8. Another popular software for simulating your macro programs is NCplot. Here are links to both of those softwares...
    www.cimco.com/...
    www.ncplot.com/
    In the example, I start with a very basic gcode program that profiles a rectangle that is 6"x4". From there input those length and width values into variables.
    #1=6.0
    #2=4.0
    Now instead of calling X6.0 in the program, you can call X#1. Same goes for the Y location, instead of Y4.0 we're calling Y#2. So why would you want to do this? Typing X6.0 is pretty much the same as typing X#1. The reason is flexibility.
    You can now simply edit the variable values and the program will automatically update to the new sizes. In the example, there is only one callout for variables 1 and 2 so this is not a great example just yet but we can increase the complexity a bit and then maybe show some of the power of fanuc macro b programming.
    In the example, I add in a radius at one of the corners and a new variable to hold the size of that radius. In the program, to cut this radius correctly the original command of X#1 needs to be updated to stop short of the end of the part. It needs to stop short by the size of the defined radius. We can use macro math functions for this. When doing math, otherwise referred to as an equation, we need to encase it in square brackets [ ]. Our equation will look like this...
    X[#1-#3]
    This will set the value for X to whatever #1 - #3 is. Using math inside of your programs will unleash some amazing capabilities for you. Even if you do not completely use macro programming, these equations are still valuable.
    Trying to figure out the feedrate for a tap? Lets pretend a mill is used, so inches per minute are needed, using a 1/2-13 tap running at 200 rpm....for the G84 canned cycles F values you can type in F[1/13*200] no need for a calculator!
    Keep an eye out for video 2 on Fanuc Macro B Programming!
    blog.caminstru...
    See other blog posts
    blog.caminstru...
    Check out our website
    caminstructor.com
    #Mastercam #LearnCNC

ความคิดเห็น • 68

  • @theberrymanmanman
    @theberrymanmanman 2 ปีที่แล้ว +1

    For anyone who wants to dive deeper, Peter smid has probably the best book for fanuc group B macro programming. You can go as deep as you want to go with macro and it is an incredible tool that most shops don’t even utilize. Nice intro vid!!!!

    • @CamInstructor
      @CamInstructor  2 ปีที่แล้ว

      I've used the book by S.K. Sinha, its great! He's also active on several CNC forums in threads with macros being discussed.

    • @GatAtTube
      @GatAtTube ปีที่แล้ว

      i don't understand it well, mostly bcs english is my 2nd language.....plus I dont have any program/simulator to practise

  • @davidliskey3553
    @davidliskey3553 หลายเดือนก่อน

    I wrote a a program using this technique that will corner round or full dish a round puck on a mill. Variables for EM size, speed, stepover, Diameter, Radius, and feed. You can get the machine to do all the trigonometry for you

  • @jwalexander1980
    @jwalexander1980 3 ปีที่แล้ว +1

    Yes please add more videos on macro programming. Extremely interested in learning more so I can utilize. Thank you!

    • @CamInstructor
      @CamInstructor  3 ปีที่แล้ว +1

      We are working on more now, thanks for the feedback!

  • @Sports_publish
    @Sports_publish 3 ปีที่แล้ว +2

    Very well done sir, hopefully great to look forward too.

  • @aaronauclair
    @aaronauclair 2 ปีที่แล้ว

    Yes please I am an instructor and veteran CNC machinist and I’m always looking for ways to add more control and use ability out of old equipment. Macros are helpful in making smaller code to run complex parts.

  • @stefankrimbacher7917
    @stefankrimbacher7917 ปีที่แล้ว

    Very helpful video. Many greetings from Austria.

  • @sbeprecisionproducts6729
    @sbeprecisionproducts6729 5 ปีที่แล้ว +1

    This looks like it would be very useful when combined with canned cycles, or subprograms.

  • @bikefarmtaiwan1800
    @bikefarmtaiwan1800 3 ปีที่แล้ว +1

    That was a really informative video! Thanks .

  • @davidhall3802
    @davidhall3802 3 ปีที่แล้ว +1

    Very good video, thanks for making it..

  • @flr169
    @flr169 5 ปีที่แล้ว

    Yes very interesting...Would be great to learn more of this type of programming and when its best to be used

  • @Wackjacko1992
    @Wackjacko1992 2 ปีที่แล้ว +1

    Great videos very informative do you have an engraving macro tutorial or would you make one in the near future? Thanks again keep the vids coming

  • @agfisher007
    @agfisher007 5 ปีที่แล้ว +2

    Thanx for this great video really help full ...Can you include some milling pockets [ macro for z level ] [ drilling and tapping ]..

    • @CamInstructor
      @CamInstructor  4 ปีที่แล้ว

      Will add those to the list! :)

  • @---MarcosVanzuita---
    @---MarcosVanzuita--- 10 หลายเดือนก่อน

    Muito bom exemplo parabéns!

  • @TommiHonkonen
    @TommiHonkonen 4 ปีที่แล้ว +1

    Macros or for me r parameters on siemens is nice way to make some things.

  • @MrChainvapor
    @MrChainvapor 5 ปีที่แล้ว

    Excellent Video. Thank you.

  • @cobraframebuilding
    @cobraframebuilding 4 ปีที่แล้ว

    I love it. More macro videos please!

    • @CamInstructor
      @CamInstructor  4 ปีที่แล้ว

      Will try and get another up soon!

  • @pierrepierrot2325
    @pierrepierrot2325 หลายเดือนก่อน

    Just ,R#3 !!!

  • @cncmanufacturingptyltd5189
    @cncmanufacturingptyltd5189 ปีที่แล้ว

    Is that Cimco as installed with Mastercam?

  • @albertodelgadohernandez2135
    @albertodelgadohernandez2135 5 ปีที่แล้ว

    Very interesting

  • @vital3d806
    @vital3d806 5 ปีที่แล้ว

    great topic!

  • @haroldjoubert7816
    @haroldjoubert7816 ปีที่แล้ว

    Good day sir as always excellent video. Is their a handbook you would recommend for me to get which covers macro programming in detail.

    • @CamInstructor
      @CamInstructor  ปีที่แล้ว

      Macro Programming Fundamentals by SK Sinha

  • @user-cq7li2fq9w
    @user-cq7li2fq9w ปีที่แล้ว

    Is it possible to create a macroprogram for archimedian spiral or a 3d surface based on curves?

    • @davidliskey3553
      @davidliskey3553 หลายเดือนก่อน

      You have to do it in half circles, so you have a macro that runs your positive to negative and one that runs your negative to positive and loops between them, you have to run it through an if then statement or similar for it's stopping point

  • @willgonzales2000
    @willgonzales2000 4 ปีที่แล้ว

    I saw some examples of macros for. Circular hole paterns. For a 3 axes milling. Help me with this please how can i modified that program for circular pockets around one center thanks. Y meam instead of holes circular pockets thanks in advance..

    • @CamInstructor
      @CamInstructor  4 ปีที่แล้ว

      Can you post the example macro.

  • @claynorris3559
    @claynorris3559 2 ปีที่แล้ว

    I used this to create a face mill program, works great....thank you. But I need help with the step over amount when you give it a wider value for #2(width)......I cant figure out how to get it to add half the cutter for the step over amount(using a 1.6 diameter face mill so .8 step over would be great). Can you help? Thanks so much

    • @CamInstructor
      @CamInstructor  2 ปีที่แล้ว +1

      Did you watch this livestream where I created a facing macro? Hopefully what's covered in there helps you out.
      th-cam.com/video/jXE4ZCv6yiM/w-d-xo.html

    • @claynorris3559
      @claynorris3559 2 ปีที่แล้ว +1

      @@CamInstructor Thanks so much.....got it working now

  • @jerojr7542
    @jerojr7542 2 ปีที่แล้ว

    Please do some CNC lathe program macros.

    • @CamInstructor
      @CamInstructor  2 ปีที่แล้ว

      Anything specific?

    • @jerojr7542
      @jerojr7542 2 ปีที่แล้ว

      @@CamInstructor anything cool I’m barely getting involved on lathe macros and need some cool ideas to do

    • @Hi_Doctor_Nick
      @Hi_Doctor_Nick ปีที่แล้ว

      @@jerojr7542 have you got anywhere with your macros? Regarding a lathe, a really useful one is a macro program for boring jaws.

    • @jerojr7542
      @jerojr7542 ปีที่แล้ว

      @@Hi_Doctor_Nick no I haven’t I would love to have a macro to bore jaws do you have a sample that you can share?

    • @Hi_Doctor_Nick
      @Hi_Doctor_Nick ปีที่แล้ว +1

      @@jerojr7542
      This is a quick program I put together as a demonstration to show our apprentice the basics of a macro. It's also got a bit of programming using incremental movements in the undercut. Rip it apart and make it your own but its a good starting place for you.
      ‐-‐------------------------------------
      Notes about the program,
      1, "Depth of jaws" refers to how much you want to hold on.
      2, "Depth of cut" If you put a large enough number it'll do the full profile in 1 cut (finish pass)
      3, "Stock for finish" how much you want to leave for a finish pass.
      4, "undercut" Rough without, but finish with one.
      -----------------------------------------
      %;
      O1234(BORE STANDARD JAWS *MACRO*);
      #600=30.(START DIA);
      #601=50.(FINISH DIA);
      #602=10.(DEPTH OF JAWS);
      #603=1(UNDERCUT 1=NO 0=YES);
      #604=1.5(DEPTH OF CUT);
      #605=0.15(STOCK FOR FINISH);
      ;
      G50S3000;
      G28U0W0;
      M1;
      ;
      T0101(B/BAR 0.4 RAD);
      G96S130M3;
      G0X#600Z2.M8;
      G71U#604R.5;
      G71P100Q150U-[#605*2]W#605F0.15;
      N100G0X[#601+1.3];
      G1Z0.;
      G2X#601Z-0.65R0.65;
      G1Z-#602;
      N150G1X#600;
      ;
      IF[#603EQ1]GOTO20;
      ;
      (UNDERCUT)S100;
      G0X#601Z2.;
      U-1.;
      Z-[#602-1.];
      G1W-0.99F0.06;
      U1.25;
      W-.16;
      U-.45;
      W.2;
      G0U-.8W.5;
      N20;
      G0Z2.;
      G28U0W0M9;
      M5;
      M30;
      %;

  • @joesmith2465
    @joesmith2465 3 ปีที่แล้ว

    could you help me with some fadal probing macros?

    • @CamInstructor
      @CamInstructor  3 ปีที่แล้ว

      I don't have much experience directly using fadals. I think their macro language is close to macro b?

    • @joesmith2465
      @joesmith2465 3 ปีที่แล้ว

      @@CamInstructor I think it's very similar but I don't think it uses the square brackets

  • @patelram9615
    @patelram9615 5 ปีที่แล้ว

    Can u give cimco crack version download link??

  • @priyeshjadhav6709
    @priyeshjadhav6709 2 ปีที่แล้ว

    Plz micro pocket rouch program

    • @CamInstructor
      @CamInstructor  2 ปีที่แล้ว

      Not sure I follow what you're after

  • @sandeepyadav1194
    @sandeepyadav1194 2 ปีที่แล้ว

    Hi

  • @mentesaemcorposaomentesaem9473
    @mentesaemcorposaomentesaem9473 4 ปีที่แล้ว

    Can you explain, please "BRANCHES AND LOOPS"
    OBJECTIVE:
    Enable participants to plan, execute and simulate CNC programs in 3 axes (milling machines and machining centers) with ISO / DIN structured language and programming.
    TARGET AUDIENCE:
    Professionals with basic CNC knowledge related to the machining area (CNC operators and programmers).
    . PRE REQUIREMENTS:
    Take a CNC Basic Milling course
    PROGRAM:
    Trigonometry Review
    Defining the variables
    Types of arithmetic functions
    Replacement
    Addition, Subtraction, Division, Multiplication
    Sine function, cosine function, tangent function
    Using conditional functions
    IF, GO TO, DO, WHILE
    EQ = equal
    NE = Different
    GT = Greater than
    LT = Less than
    GE = Greater than or equal
    LE = Less than or equal
    Simulation and practice exercises in a machining center (conical grooves, half spheres, corners of radius parts, ellipses, etc.)
    Can you explain, please "BRANCHES AND LOOPS"
    IF [ CONDITION IS TRUE ] GOTOn
    IF [condition is true] GOTOn
    for example,
    IF [#7 LT 0] GOTO65 If the value of variable #7 is less than 0, branch to block N65
    ...
    ... If the above condition is true, bypass this section up to N65
    ...
    N65 ... Target block of the IF conditional statement
    IF [ condition is true ] THEN [ argument ]
    Example 2 - Macro control with the IF-THEN structure
    #100 = #4006 Check current units (English G20 or Metric G21)
    IF[#100 EQ 20.0] THEN #100 = 0.1 Clearance above work is 0.1 inch for G20
    IF[#100 EQ 21.0] THEN #100 = 2.0 Clearance above work is 2 mm for G21
    ...
    < ... Macro program continues normally … >
    Using the IF-THEN method makes the pro gram shorter by one half and is eas ier to in ter pret.
    WHILE Loop Structure
    WHILE [condition] DOn
    WHILE [... Condition 1 is true ...] DO1
    ...
    ...
    END1
    Start of WHILE loop 1
    End of WHILE loop 1
    Double Level Loop
    WHILE [... Condition 1 is true ...] DO1
    ...
    WHILE [... Condition 2 is true ...] DO2
    ...
    ...
    END2
    ...
    ...
    END1
    ...
    Start of WHILE loop 1
    Start of WHILE loop 2
    End of WHILE loop 2
    End of WHILE loop 1
    Trible Level Loop
    WHILE [... Condition 1 is true ...] DO1
    ...
    ...
    WHILE [... Condition 2 is true ...] DO2
    ...
    WHILE [... Condition 3 is true ...] DO3
    ...
    ...
    END3
    ...
    ...
    END2
    ...
    ...
    END1
    ...
    Start of WHILE loop 1
    Start of WHILE loop 2
    Start of WHILE loop 3
    End of WHILE loop 3
    End of WHILE loop 2
    End of WHILE loop 3
    O8009 (SINE CURVE MACRO)
    #25 = 0 Set initial counter for degrees increment
    WHILE [#25 LE 360.0] Loop for each linear segment until 360 degrees are machined
    #26 = #1 * SIN[#25] Calculate current Y-location
    G90 G01 X#25 Y#26 F#9 Make a linear motion to the calculated XY location
    #25 = #25+#4 Increase the counter by specified increment
    END1 End of loop
    M99 End of macro
    O8011 (CLEAR 500+ VARIABLES - BY A MACRO LOOP)
    #33 = 500 Initialize counter to the first variable (no # symbol !!!)
    WHILE[#33 LE 999] DO1 Loop through variables - shown range is #500-#999
    #[#33] = #0 Set the current variable number to null (clear current variable)
    #33 = #33+1 Update variable number count by one
    END1 End of loop - return to the WHILE block and evaluate again
    M99 End of macro
    and other.

  • @iwannaapple7190
    @iwannaapple7190 2 ปีที่แล้ว

    This video should really be covering syntax of gcode. If this was a book, you have skipped a couple of chapters so I am virtually lost and don't have a clue. Funny thing is I have programmed in Java, Javascript, c++ and others including websites with a couple thousand lines of code using databases and without you covering syntax the only thing I gather from this is g-code has variables to store info and you can use brackets to explain your variables.
    Go to the basics please. You might as well be talking French here cause thats about what this is.

    • @CamInstructor
      @CamInstructor  2 ปีที่แล้ว +1

      This video is not meant to teach you everything possible about the MacroB Language. It was just a practical example of something simple that could be done, in an attempt to peek the interest of those who know machining/programming to look deeper into macros.

    • @iwannaapple7190
      @iwannaapple7190 2 ปีที่แล้ว

      @@CamInstructor
      Thats like me teaching how to pass a variable inside a function and then naming it part 1.
      It would have only taken 3 extra minutes tops for people to catch up with you to follow along! You dont have to teach the whole thing. Every body needs a little background info and you know you didnt do it. Do better. I know you have it in you and youve got a subscriber.

  • @splacl6102
    @splacl6102 3 ปีที่แล้ว

    Ngl, the simple math is kinda killing me

    • @CamInstructor
      @CamInstructor  3 ปีที่แล้ว

      Which part. Maybe I can help clarify a bit.