Results 1 to 9 of 9

Thread: Check Program Exists

  1. #1
    Registered
    Join Date
    May 2004
    Location
    United Kingdom
    Posts
    80
    Downloads
    0
    Uploads
    0

    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
    Registered
    Join Date
    Sep 2006
    Location
    uk
    Posts
    136
    Downloads
    0
    Uploads
    0

    .

    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
    Registered
    Join Date
    Jan 2007
    Location
    USA
    Posts
    61
    Downloads
    0
    Uploads
    0
    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
    Registered
    Join Date
    May 2007
    Location
    USA
    Posts
    8
    Downloads
    0
    Uploads
    0
    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
    Registered
    Join Date
    Sep 2006
    Location
    uk
    Posts
    136
    Downloads
    0
    Uploads
    0
    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
    Registered
    Join Date
    May 2004
    Location
    United Kingdom
    Posts
    80
    Downloads
    0
    Uploads
    0
    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
    Registered Mitsui Seiki's Avatar
    Join Date
    Feb 2007
    Location
    USA
    Posts
    464
    Downloads
    0
    Uploads
    0
    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
    Registered
    Join Date
    Jan 2007
    Location
    USA
    Posts
    61
    Downloads
    0
    Uploads
    0
    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
    Registered
    Join Date
    Mar 2005
    Location
    Silicon Valley, CA
    Posts
    988
    Downloads
    0
    Uploads
    0
    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, 01:39 PM
    2. program stop to check size
      By jone in forum Mastercam
      Replies: 2
      Last Post: 05-23-2007, 10:19 PM
    3. Replies: 3
      Last Post: 01-19-2007, 08:59 AM
    4. Replies: 2
      Last Post: 06-15-2006, 09:40 AM
    5. Hello there, glad to see a place like this exists.
      By SagaciousKJB in forum CNCzone Club House
      Replies: 2
      Last Post: 10-15-2005, 07:46 AM

    Posting Permissions


     


    About CNCzone.com

      We are the largest and most active discussion forum from DIY CNC Machines to the Cad/Cam software to run them. The site is 100% free to join and use, so join today!

    Follow us on

    Facebook Dribbble RSS Feed


    Search Engine Friendly URLs by vBSEO ©2011, Crawlability, Inc.