586,331 active members*
4,543 visitors online*
Register for free
Login
Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2012
    Posts
    161

    Question Using IF [] statements in PathPilot

    Can you do conditional execution but not in a subroutine in PathPilot? I'm trying to do this:

    IF [#5400 EQ 516] G52 X1.2129 Y-1.0493 Z0.4972 (Position Tool #516)
    IF [#5400 EQ 502] G52 X1.0592 Y-2.4673 Z0.5034 (Position Tool #502)
    IF [#5400 EQ 501] G52 X1.0662 Y-3.8448 Z0.0381 (Position Tool #501)

    But I get an error on the "IF" word. I've never used subroutines or conditional execution in gcode before.
    "You can't teach stuff in a school that you would learn in real life unless the real life people are in charge of the school." - Gene Sherman

  2. #2
    Join Date
    Apr 2017
    Posts
    158

    Re: Using IF [] statements in PathPilot

    Each if needs a matching endif, where oh-numbers are used for the matching. Your code should be something like

    o1 if [#5400 EQ 516]
    G52 X 1.2129 Y -1.0493 Z 0.4972 (Position Tool #516)
    o1 endif
    o2 if [#5400 EQ 502]
    G52 X 1.0592 Y -2.4673 Z 0.5034 (Position Tool #502)
    o2 endif
    o3 if [#5400 EQ 501]
    G52 X 1.0662 Y -3.8448 Z 0.0381 (Position Tool #501)
    o3 endif



    This assumes that o1, o2, o3 are not used elsewhere, even in subroutines, so you'll need to set up and follow some rules for keeping track of these.

  3. #3
    Join Date
    Apr 2012
    Posts
    161

    Re: Using IF [] statements in PathPilot

    Thanks, I'll try that
    "You can't teach stuff in a school that you would learn in real life unless the real life people are in charge of the school." - Gene Sherman

  4. #4
    Join Date
    Apr 2017
    Posts
    158

    Re: Using IF [] statements in PathPilot

    Quote Originally Posted by Fenichel View Post
    Each if needs a matching endif, where oh-numbers are used for the matching. Your code should be something like

    o1 if [#5400 EQ 516]
    G52 X 1.2129 Y -1.0493 Z 0.4972 (Position Tool #516)
    o1 endif
    o2 if [#5400 EQ 502]
    G52 X 1.0592 Y -2.4673 Z 0.5034 (Position Tool #502)
    o2 endif
    o3 if [#5400 EQ 501]
    G52 X 1.0662 Y -3.8448 Z 0.0381 (Position Tool #501)
    o3 endif



    This assumes that o1, o2, o3 are not used elsewhere, even in subroutines, so you'll need to set up and follow some rules for keeping track of these.
    Even better, since the various cases are mutually exclusive, would be
    o1 if [#5400 EQ 516]
    G52 X 1.2129 Y -1.0493 Z 0.4972 (Position Tool #516)
    o1 elseif [#5400 EQ 502]
    G52 X 1.0592 Y -2.4673 Z 0.5034 (Position Tool #502)
    o1 elseif [#5400 EQ 501]
    G52 X 1.0662 Y -3.8448 Z 0.0381 (Position Tool #501)
    o1 endif





Similar Threads

  1. Biessework and statements
    By Puuseppo in forum Biesse
    Replies: 0
    Last Post: 01-28-2024, 08:57 PM
  2. if statements...
    By deadlykitten in forum Okuma
    Replies: 10
    Last Post: 11-07-2015, 01:46 AM
  3. Format Statements
    By Xavior in forum Mastercam
    Replies: 5
    Last Post: 09-08-2011, 12:28 PM
  4. comment statements
    By compfranon in forum ArtCam Pro
    Replies: 0
    Last Post: 09-04-2011, 02:13 AM
  5. If / Then Statements
    By Nanker in forum G-Code Programing
    Replies: 6
    Last Post: 10-23-2004, 06:11 AM

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
  •