585,722 active members*
4,040 visitors online*
Register for free
Login
IndustryArena Forum > MetalWorking Machines > Fadal > macro code inside of a subroutine
Results 1 to 8 of 8
  1. #1
    Join Date
    Nov 2008
    Posts
    7

    macro code inside of a subroutine

    any ideas why this code will run in graphics but chokes on the first calculation at runtime?

    Thanks so much!!!!

    bp

    %
    O9999
    L100
    # R8 = COS(V8)*V9
    # R9 = SIN(V8)*V9
    M99
    M30
    G80G90G17G40
    M6T1
    E1X0Y0S2200M3
    # V8 = 90
    # V9 = 1
    GOH1Z1.M8
    L101
    G82G98R0+.1Z-.5F5.X+R8Y+R9
    # V8 = 180
    L101
    X+R8Y+R9
    L101
    X+R8Y+R9
    G80
    G0Z1.M5M9
    G9G49Z0
    G0E0X0Y0
    M30
    %

  2. #2
    Join Date
    Mar 2003
    Posts
    900
    Brockmo--
    On the line "G0H1Z1.M8" you entered the letter O for the G0 instead of the number zero.

    Neal

  3. #3
    Join Date
    Nov 2008
    Posts
    7

    typo's

    thanks for such thorough error checking but I'm afraid that this was a typo that I made only on this example. The "real" program executed perfectly when the subs were taken out.

    P.S. I did use { #set deb } to check variable values and all looked well.

    Thanks again!

  4. #4
    Join Date
    Nov 2008
    Posts
    7

    bolt circle macro works now!!!

    the following code works! I changed the last line to an M2 instead M30 and removed the modal safety line.

    Thanks again Neal!

    BTW, are there any fadal macro gurus lurking on cnczone?

    %
    O9999
    L100
    # R8 = COS(V8)*V9 'X coordinate
    # R9 = SIN(V8)*V9 'Y coordinate
    M99
    M30
    M6T1
    # V8 = 90 'angle of hole
    # V9 = 1 'bolt circle radius
    L101
    E1X+R8Y+R9S2200M3
    G0H1Z1.M8
    G82G98R0+.1Z-.5F5.
    # V8 = 180
    L101
    X+R8Y+R9
    # V8 = 270
    # V9 = 1.5
    L101
    X+R8Y+R9
    # V8 = 0
    L101
    X+R8Y+R9
    # V8 = 30
    L101
    X+R8Y+R9
    G80
    G0Z1.M5M9
    G90G49Z0
    G0E0X0Y0
    M2
    %

  5. #5
    Join Date
    Mar 2003
    Posts
    900
    Brockmo--
    I teach the macro programming classes. Let me know if I can be of help.

    Neal

  6. #6
    Join Date
    Nov 2008
    Posts
    7

    deep holes and hex's

    the shop I work for produces a lot of parts with similar shapes such as bolts with hex shaped tops and drilling radial holes through tubes. None of the parts share dimensions but they are so similar that some setups require only changing fixture offsets or tools lengths. I would like to prevent some of the time waste and errors made when drawing hex's and simple bolt circles. It is easy to make the control do the math for you and not have to use a calculator or leave the machine to use the one installation of surfCAM.

    Situation 1: hex head on a bolt; print gives flat-to-flat or inscribed circle. - worked this one out today....but not terribly elegant yet.

    2: drill through a tube(radial); drilling through second wall requires cutting air or using a negative R0 value which makes it difficult to clear chips. - I have written this out on paper but have yet to try it.

    3: drill simple bolt circles using only given circle radius or dia and angle of hole. usually on the head or face of a bolt or nut. - could get away with using a G68 but that would be cheating

  7. #7
    Join Date
    Mar 2009
    Posts
    100
    The L100 subprogram should have last line M17 not M99. Or does M99 also work???

  8. #8
    Join Date
    Nov 2008
    Posts
    7

    M17 or M99

    well....I've always used M99 for the end of subroutines and subprograms. I suppose that this is poor form, however, it was the way I was initially taught to code a subroutine. This method seems to work fine!

Similar Threads

  1. AutoCAD 2 G-Code macro
    By ger21 in forum Autodesk
    Replies: 224
    Last Post: 11-06-2011, 07:02 PM
  2. AVR G Code Interpreter/ Step-Dir Macro Recorder
    By bitmannz in forum CNC Machine Related Electronics
    Replies: 5
    Last Post: 02-01-2007, 07:07 AM
  3. G-code viewer (subroutine)
    By hao in forum G-Code Programing
    Replies: 1
    Last Post: 11-15-2006, 01:10 PM
  4. Fanuc Macro and G-Code Programming
    By kilogulf59 in forum Fanuc
    Replies: 3
    Last Post: 11-01-2006, 06:02 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •