586,043 active members*
3,604 visitors online*
Register for free
Login
Results 1 to 9 of 9
  1. #1
    Join Date
    May 2004
    Posts
    97

    Check Program Exists

    Is it possible to do a statement such as an "IF THEN ELSE" in a main CNC Program to see if a subprogram already exists in the memory prior to doing a G65Pxxxx or M98 call. I want to skip past the subroutine program call if the subprogram doesn't exist - that then ensures the main program doesn't alarm out?

  2. #2
    Join Date
    Sep 2006
    Posts
    136

    .

    Some controls let you do an IF THEN, but I don't think you can do ELSE.

    I get around it with a load of goto statements. Not elegant but it works.

  3. #3
    Join Date
    Jan 2007
    Posts
    64
    G-Code is a rote (no intelligence) language. It has no decision making capability on it's own. It seems the only way this could be accomplished would be to build an interface to the specific controller that somehow would "receive" the neccesary feedback to trigger the software "exception" that it would need to handle. The major object to get past in this problem is the entity that is the "if" that you are concerned about testing. In another words, if you had a way of providing 2 way communications with applicable test
    conditions, you could theoretically, do it by writing the code to issue the G-Code subroutines necessary to drive the CNC controller.

  4. #4
    Join Date
    May 2007
    Posts
    8
    Assuming your control will allow you to do IF THEN statements, all you need to do is find which variables are assigned to the program numbers (they do exist, you have to consult your machine's manuals to find out which variable is which).

  5. #5
    Join Date
    Sep 2006
    Posts
    136
    Interested to know if you find a way to make this work - The variable the current program number is stored in is #4115, but I can't find any variables that tell you which program numbers are stored in the control (i.e. subprogs)

    BTW, not all controls support IF THEN, but they might just support IF.
    Fanuc 10/11/15 does, but Fanuc 0/16/18 doesn't.

    Weird, but if not it means you'll need to do an IF THEN like this:
    IF [#1NE2] GOTO 3
    N2 (whatever you want to happen if #1 is 3)
    N3 CARRY ON

  6. #6
    Join Date
    May 2004
    Posts
    97
    Quote Originally Posted by inflateable View Post
    The variable the current program number is stored in is #4115, but I can't find any variables that tell you which program numbers are stored in the control (i.e. subprogs)
    The Holy Grail in this quest is the variables for programs stored in the control!

    Quote Originally Posted by inflateable View Post
    IF [#1NE2] GOTO 3
    N2 (whatever you want to happen if #1 is 3)
    N3 CARRY ON
    That's exactly what I will do.

  7. #7
    Join Date
    Feb 2007
    Posts
    464
    Quote Originally Posted by guypb View Post
    Is it possible to do a statement such as an "IF THEN ELSE" in a main CNC Program to see if a subprogram already exists in the memory prior to doing a G65Pxxxx or M98 call. I want to skip past the subroutine program call if the subprogram doesn't exist - that then ensures the main program doesn't alarm out?
    If the subprogram doesn't exist,just remove the G65/M98 from the program.
    Stefan Vendin

  8. #8
    Join Date
    Jan 2007
    Posts
    64
    The "Holy Grail" is the feedback mechanism whether it be a "software" variable or hardware "switch (typically binary {on or off}) that produces the trigger for some event to occur. Those lightbulbs will last a million years if nobody throws the "on" switch. I've seen some controllers that "assume" an event has occurred, and then base the program decision on that. To me, that is a dangerous assumption to make. You need to be absolutely positive in the actual versus expected results. IMHO.

  9. #9
    Join Date
    Mar 2005
    Posts
    988
    Seems to me that you might run into a dangerous situation if you're arbitrarily running programs with or without some of the sub-programs..... But, some machines have parameters to control how sub calls are treated if the the program is not in the directory. Not sure on Mazaks or Mits....
    It's just a part..... cutter still goes round and round....

Similar Threads

  1. Program Check
    By guypb in forum Haas Mills
    Replies: 0
    Last Post: 02-14-2008, 07:39 PM
  2. program stop to check size
    By jone in forum Mastercam
    Replies: 2
    Last Post: 05-24-2007, 03:19 AM
  3. Replies: 3
    Last Post: 01-19-2007, 02:59 PM
  4. Replies: 2
    Last Post: 06-15-2006, 02:40 PM
  5. Hello there, glad to see a place like this exists.
    By SagaciousKJB in forum Community Club House
    Replies: 2
    Last Post: 10-15-2005, 12:46 PM

Posting Permissions

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