Results 1 to 6 of 6

Thread: Can I call a subprogram from within a canned cycle?

  1. #1
    Registered TXFred's Avatar
    Join Date
    Aug 2009
    Location
    Austin, TX
    Posts
    959
    Downloads
    0
    Uploads
    0

    Can I call a subprogram from within a canned cycle?

    I'm primarily a MasterCAM programmer, but am teaching myself to understand Gcode. So this may be a very elementary question.

    I have a program that drills and taps a series of holes in a steel plate. We use a product called BoeLube to lubricate our taps.

    I have designed a small cup with a flip-up lid and a magnetic base. This cup sits on the mill table somewhere out of the way, and has its own work offset assigned to it.

    The subprogram I will write should move to the cup, use the tip of the tap to flip open the lid, dip the tap in the cup, and then close the lid again. The subprogram will then return to the main program.

    I would like to call this subprogram from within a tapping canned cycle so that the tap gets BoeLube on it before each hole. Can this be done?

    For reference, I have attached my tapping cycle code as a text file.

    Cheers,
    Fred
    Attached Files Attached Files
    Last edited by TXFred; 12-07-2010 at 03:15 PM.
    [URL="http://www.pure-geometry.com/"]Pure Geometry LLC[/URL]
    Vertical Lathe tool holders and more.


  2. #2
    Registered dcoupar's Avatar
    Join Date
    Mar 2003
    Location
    USA
    Posts
    2,502
    Downloads
    0
    Uploads
    0
    Two problems.

    1. What control?
    2. You didn't attach your tapping cycle code. At least not that I can see.

    I don't believe it can be done on a Fanuc, as it would probably try to tap another hole every time an axis was commanded.


  3. #3
    Registered TXFred's Avatar
    Join Date
    Aug 2009
    Location
    Austin, TX
    Posts
    959
    Downloads
    0
    Uploads
    0
    Quote Originally Posted by dcoupar View Post
    Two problems.

    1. What control?
    2. You didn't attach your tapping cycle code. At least not that I can see.

    I don't believe it can be done on a Fanuc, as it would probably try to tap another hole every time an axis was commanded.
    It's a Haas mill. I don't know if that's Fanuc, LOGO, or Pig Latin. I'm pretty new at this stuff still.

    The attachment is in the original post now.

    Fred
    [URL="http://www.pure-geometry.com/"]Pure Geometry LLC[/URL]
    Vertical Lathe tool holders and more.


  4. #4
    Registered
    Join Date
    May 2007
    Location
    US
    Posts
    779
    Downloads
    0
    Uploads
    0
    Write a sub to lube the tap and tap a hole.
    Instead of calling the sub with a G65 call it with a G66, the sub will be modal until canceled with a G67.
    Parameters to the sub would be X and Y locations Z and R could be hard coded or passed in, etc..

    Code:
    (MAIN PROG)
    .
    .
    .
    G66 P1 X1.0 Y1.0 Z-1.0
    X2.0
    X3.0
    G67
    .
    .
    .
    M30
    
    O1(SUB)
    (LUBE)
    .
    .
    .
    (TAP)
    G84X#24Y#25Z#26R0.2 ...
    G80
    M99
    Last edited by Andre' B; 12-07-2010 at 04:41 PM.


  • #5
    Registered TXFred's Avatar
    Join Date
    Aug 2009
    Location
    Austin, TX
    Posts
    959
    Downloads
    0
    Uploads
    0
    Quote Originally Posted by Andre' B View Post
    Write a sub to lube the tap and tap a hole.
    Instead of calling the sub with a G65 call it with a G66, the sub will be modal until canceled with a G67.
    Neat! This looks like it's exactly what I need.

    The next step will be to find a way to make MasterCAM post the code to call the sub. Ideally, I'd like to specify a tapping cycle in MasterCAM, and when I post, have it replace the tapping command with a call to the lube and tap subroutine, using the feeds, speeds and depths that I specified in MasterCAM.

    Because we're a MasterCAM shop, we have a policy of not manually editing the code. We want the code to always be a reflection of what is in MasterCAM, so that if we change something in MasterCAM and repost, we won't lose any modifications to the program.

    I'm going to have to study up on post processing next. Pass the Advil!

    Thanks for the help on this.

    Sincerely,
    Fred
    [URL="http://www.pure-geometry.com/"]Pure Geometry LLC[/URL]
    Vertical Lathe tool holders and more.


  • #6
    Registered
    Join Date
    May 2007
    Location
    US
    Posts
    779
    Downloads
    0
    Uploads
    0
    I did not think of it before but you can setup a sub to be called by a G code or and M code.

    Usually program numbers 9010 thru 9019 are reserved for this.
    Each of those program numbers has a parameter associated with it, you just set that parameter to the code number you want to use to call the 901x program. There are some limitations etc. and I have only used Fanuc and Mit controls so Haas may be different.

    Dig out the books. ;-)


  • Similar Threads

    1. canned cycle?
      By Cartel, LLC in forum Haas Mills
      Replies: 2
      Last Post: 09-27-2010, 11:06 AM
    2. Canned Cycle Help
      By vanbry in forum Okuma
      Replies: 14
      Last Post: 12-14-2009, 06:48 PM
    3. Problem- Canned cycle
      By tsaladyga in forum Post Processors for MC
      Replies: 1
      Last Post: 08-29-2009, 07:31 PM
    4. Need Help!- OKUMA Mill Poste Edit for " NCYL " subprogram call
      By QAZEWQ in forum Mastercam
      Replies: 7
      Last Post: 06-14-2009, 09:56 AM
    5. Replies: 1
      Last Post: 10-23-2008, 04:12 PM

    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.