586,000 active members*
4,953 visitors online*
Register for free
Login
Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2020
    Posts
    1

    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
    Join Date
    Feb 2011
    Posts
    353

    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
  •