Facing Macro


Results 1 to 4 of 4

Thread: Facing Macro

  1. #1
    Registered
    Join Date
    Dec 2008
    Location
    United States of America
    Posts
    69
    Downloads
    0
    Uploads
    0

    Default 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 
    %


    Similar Threads:


  2. #2
    Registered
    Join Date
    Dec 2008
    Location
    United States of America
    Posts
    69
    Downloads
    0
    Uploads
    0

    Default

    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
    Registered
    Join Date
    Jun 2009
    Location
    United States
    Posts
    65
    Downloads
    0
    Uploads
    0

    Default

    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



  4. #4
    Registered
    Join Date
    Dec 2008
    Location
    United States of America
    Posts
    69
    Downloads
    0
    Uploads
    0

    Default

    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.



Tags for this Thread

Posting Permissions

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


About CNCzone.com

    We are the largest and most active discussion forum for manufacturing industry. The site is 100% free to join and use, so join today!

Follow us on


Our Brands

Facing Macro

Facing Macro