g code: if then statement


Results 1 to 2 of 2

Thread: g code: if then statement

  1. #1

    Join Date
    Dec 2020
    Posts
    1
    Downloads
    0
    Uploads
    0

    Post g code: if then statement

    I would like to create (2) if then statements that tells my machine to consider the current x position and then move in the y axis
    I'm not sure if i am calling the current x position correctly because I believe only numbers can be within the "[ ]"

    ;if the current x position (absolute coordinate) is greater than or equal to 40,000 then the Y axis needs an offset of 2 mm
    {if [G0 X] >= 40000} G1 Y2.00

    ;if the current x position (absolute coordinate) is less than to 40,000 then the Y axis needs an offset of -2 mm
    {if [G0 X] < 40000} G1 Y-2.00



  2. #2
    Member
    Join Date
    Feb 2011
    Location
    usa
    Posts
    353
    Downloads
    2
    Uploads
    0

    Default Re: g code: if then statement

    if this is a fanuc try
    IF[#5041GE40000]THEN#100=2.0
    IF[#5041LT40000]THEN#100=-2.0

    #5041 Is current x position in the work co-ordinate system
    #5021 is current x position in the machine co-ordinate system
    Then you can use the #100 like this G1Y#100



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

g code: if then statement

g code: if then statement