585,759 active members*
4,293 visitors online*
Register for free
Login

Thread: Facing Macro

Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2008
    Posts
    69

    Facing Macro

    I use this a lot for quick stuff. Thought it might be useful to someone.

    Code:
    %
    O09010 (FACING) 
    
    (FLAGS) 
    (REVERSE LAST PASS) 
    #110= 1 
    
    (VARIABLES) 
    (FEED RATE) #9= 32. 
    (TOOL DIA) #101= 2. 
    (Y  DIST.)  #102= 8.5 
    (X  DIST.)  #103= 12.5 
    (RADIAL E) #104= #101 * 0.8 
    
    (SETUP VARS)
    #105= #103 * -1 
    #106= ROUND[ #102 / #104 ] 
    #107= [ #106 * #104 ] * -1 
    IF [ [ #102 MOD #104 ] GT 0 ] GOTO300 
    
    (RPM)
    N50 M03 S880 
    
    WHILE [ #106 GE 1 ] DO1 
    M97 P100 
    IF [ [ #106 EQ 3 ] AND [ #110 EQ 1 ] ] GOTO200 
    #106= #106 - 1 
    END1 
    M30 
    
    
    N100 G91 G01 X#105 F#9 
    G00 Z1. 
    X#103 Y#104 
    G01 Z-1. F#9 
    M99 
    
    N200 G91 G01 X#105 F#9 
    G00 Z1. 
    Y#104 
    G01 Z-1. F#9 
    G01 X#103 F#9 
    GOTO400 
    
    N300 #106= #106 + 1 
    GOTO50 
    
    N400 G00 Z3. 
    Y#107 
    G01 Z-3. 
    M30 
    %

  2. #2
    Join Date
    Dec 2008
    Posts
    69
    V1.1

    Been a while since I had to think through a programming problem and I ****ed up the loops so it went to the wrong position without the reverse direction of last pass flag set.

    Probably going to set it up to use SFM and FPT rather than RPM and FR later.

    Code:
    %
    O09010 (G200 - FACING) 
    
    (FLAGS) 
    (REVERSE LAST PASS) 
    #110= 0 
    
    (VARIABLES) 
    (FEED RATE) #9= 32. 
    (TOOL DIA) #101= 2. 
    (Y DIST.) #102= 8.5 
    (X DIST.) #103= 12.5 
    (X RETN.) #104= #103 * -1 
    (AXIAL E.) #105= #101 * 0.8 
    (# PASSES) #106= ROUND[ #102 / #105 ] - 1 
    (RETN. Y.) #107= [ #106 * #105 ] * -1 
    
    (IF Y DISTANCE REMAINDER IS GREATER THAN ZERO) 
    (ADD A PASS) 
    IF [ [ #102 MOD #104 ] GT 0 ] GOTO300 
    
    (START SPINDLE) 
    N50 M03 S880 
    
    (WHILE PASSES IS GREATER THAN OR EQUAL TO ONE) 
    (CLIMB ACROSS SURFACE) 
    WHILE [ #106 GE 1 ] DO1 
    M97 P100 
    #106= #106 - 1 
    END1 
    M30 
    
    (SUB) 
    (CLIMB PASS) 
    N100 G91 G01 X#104 F#9 
    (IF PASSES IS EQUAL TO TWO AND RLP FLAG IS SET) 
    IF [ [ #106 EQ 2 ] AND [ #110 EQ 1 ] ] GOTO200 
    (IF PASSES IS EQUAL TO ONE RETURN TO HOME POSITION)
    IF [ #106 EQ 1 ] GOTO400 
    G00 Z1. 
    X#103 Y#105 
    G01 Z-1. F#9 
    M99 
    
    (SUB) 
    (REVERSE DIRECTION OF LAST PASS) 
    N200 G00 Z1. 
    Y#105 
    G01 Z-1. F#9 
    G01 X#103 F#9 
    GOTO400 
    
    (FUNCTION) 
    (INCREMENT PASSES) 
    N300 #106= #106 + 1 
    GOTO50 
    
    (SUB) 
    (RETURN TO START POS) 
    N400 G00 Z3. 
    IF [ #110 EQ 0 ] THEN X#103 Y#107 
    IF [ #110 EQ 1 ] THEN Y#107 
    G01 Z-3. 
    M30 
    %

  3. #3
    Join Date
    Jun 2009
    Posts
    65
    Nice Job!!! I barely know what I'm doing when it comes to custom Macros, but I really wanna learn more!

    Might try that out next week when I get a chance.

    Thanks for sharing :cheers:

  4. #4
    Join Date
    Dec 2008
    Posts
    69
    If you're using a Haas there is a programming reference in the back of their book.

    The standard that Fanuc based controls are using I think is RS274D but there is also RS274-NGC and ISO 6983.

Similar Threads

  1. Replies: 2
    Last Post: 03-27-2009, 09:15 PM
  2. V22 Facing ?'s
    By bink in forum BobCad-Cam
    Replies: 7
    Last Post: 02-16-2009, 12:22 AM
  3. cylinder facing
    By pp-TG in forum MetalWork Discussion
    Replies: 12
    Last Post: 01-30-2009, 03:53 PM
  4. Convert Fanuc Macro to Fadal Macro
    By bfoster59 in forum Fadal
    Replies: 1
    Last Post: 11-09-2007, 06:41 AM
  5. Facing
    By impact in forum MetalWork Discussion
    Replies: 4
    Last Post: 02-23-2006, 03:24 AM

Posting Permissions

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