Bar Pulling Post

Bar Pulling Post

GalenYMW8K
Enthusiast Enthusiast
1,092 Views
2 Replies
Message 1 of 3

Bar Pulling Post

GalenYMW8K
Enthusiast
Enthusiast

Hello all. I have been working on a bar pulling post. It is still rough, but works well. This works for my old Fanuc 3T. All you should need are macros and this will work for you. It makes it fairly autonomous, all you need to do is enter a couple properties in the post window- bar pull enable, bar stock length, and bar puller tool number. From there it automatically calculates how many parts to pull, Z location to pull from, pull length, etc. Saves a lot of time.

There are many odd things you may see in my post, especially the macros, my machine is odd to say the least, but with some small tweaking this should work for any machine.

First, add this code under the //user-defined properties. These are the items that show under the menu in the post window, and the values you enter here are the defaults. See image 1


  barPullerEnable: false,
  barPullerToolNumber: 06,
  barPullerToolOffset: 06,
  barPullerStockLength: 48,

 

Next, enter these under //user-defined property definitions. Description is the tooltip that pops up when you hover over the menu item, the type is if its a number (integer), string , etc. See image 2

barPullerEnable: {title:"Bar Puller Enable", description:"Adds Barpulling subprogram", group:0, type:"boolean"},
  barPullerToolNumber: {title:"Bar Puller Tool#", description:"Tool Number (and offset) to use for Bar Pulling tool", type:"integer", range:[0, 100]},
  barPullerToolOffset: {title:"Bar Puller Tool Offset#", description:"Offset Number to use for Bar Pulling tool", type:"integer", range:[0, 100]},
  barPullerStockLength: {title:"Bar Puller Stock Length", description:"Length of bar stock length in inches", type:"integer", range:[0, 10000]},

 

Next up we will add our macro code in the program heading. Here I used #501 as the part quantity, how many parts we will make each press of cycle start, and #502 is how many parts the machine has made or looped. You want to add this before we write N01, so that your part count doesn't get set to 0 every loop and run until the power goes out.... search for any code your post puts before it writes the code for the first tool... perhaps search " writeln("O" " , and add someplace shortly after. See image 3

 if (properties.barPullerEnable) {
    var lastSection = getSection(getNumberOfSections() - 1);
    var stockLength = properties.barPullerStockLength;
    var pullAmount = lastSection.getParameter("operation:backHeight_value") + lastSection.getParameter("operation:backHeight_offset");
    var pullFromLocation = pullAmount - 0.4;
    var minStock = properties.minimumStockLength;
    var partQuantity = Math.floor(stockLength / (-1 * pullAmount));
    var stockDiameter = getWorkpiece().upper.x;
    writeBlock("G65 H01 P#501 Q" + partQuantity); // part qty
    writeBlock("G65 H01 P#502 Q0"); // internal var for part count
}

Next we need to write line N01, this is where the program will return to. I can't use decimal values in macros on my machine, so I couldn't run the pull program as a subprogram. You can tweak the post code to do that if you want. Also, I like to write M1 on my first tool change, if you want that as well, you can do this same code in the screen shot.. Anyways, to find where to add this, try searching isFisrtSection, add shortly thereafter. See image 4

   if (properties.barPullerEnable && isFirstSection()) {
      writeBlock("N01M1");
    } 

Okay, now the actual pull code. Search for " onClose" and add shortly after. This code will only work if your last tool operation was a part off. It uses that code to calculate where to pull from and how long the part is in Z. Be sure your parting tool is offset in the same way that this code uses. Otherwise, I think this is pretty self explanatory. See image 5


  if (properties.barPullerEnable) {
    var lastSection = getSection(getNumberOfSections() - 1);
    var pullAmount = lastSection.getParameter("operation:backHeight_value") + lastSection.getParameter("operation:backHeight_offset");
    var pullFromLocation = pullAmount - 0.4;
    var stockDiameter = getWorkpiece().upper.x;
    var rapidToX = stockDiameter + 0.5;
    writeBlock("(Bar Pull)");
    writeBlock("G65H02P#502Q#502R1"); // add one to part count
    writeBlock("G65H85P02Q#502R#501"); // if completed skip pull and go to line 2
    writeBlock("M05");
    writeBlock("M01");
    writeBlock("G04P0250");
    writeBlock("T" + ("0" + properties.barPullerToolNumber).slice(-2) + ("0" + properties.barPullerToolOffset).slice(-2));
    writeBlock("G98");
    writeBlock("G0Z" + pullFromLocation.toFixed(4));
    writeBlock("X" + rapidToX.toFixed(4));
    writeBlock("G1X0.F50.");
    writeBlock("M11");
    writeBlock("G4P1500");
    writeBlock("G1W" + pullAmount.toFixed(4) + "F50.");
    writeBlock("M10");
    writeBlock("G4P1500");
    writeBlock("G0X" + rapidToX.toFixed(4));
    writeBlock("Z" + home?);
    writeBlock("G28U0.");
    writeBlock("G65H80P01");
    writeBlock("N02");
  }1122334455

1,093 Views
2 Replies
Replies (2)
Message 2 of 3

randyT9V9C
Collaborator
Collaborator

@GalenYMW8K Thank you. I implemented this for my 0T-A and with a few minor tweaks. It works very well. I really like the simplicity.

 

I'm using an EZ-Puller https://www.ezpullerusa.com/ so I added a user variable called barPullerEngagement which allows me to define how much of the gripper will grab the bar in Z axis. I also created a table to round my stock diameter  to the nearest 1/8th inch and the pull the published X axis offset.

 

 

    switch (Math.round(stockDiameter*800)/800) {
        case 0.125:
          var PullerOffset = -0.01;
          break;
        case 0.25:
          var PullerOffset = -0.03;
          break;
        case 0.375:
          var PullerOffset = -0.057;
          break;
        case 0.5:
          var PullerOffset = -0.09;
          break;
        case 0.625:
          var PullerOffset = -0.13;
          break;
        case 0.75:
          var PullerOffset = -0.178;
          break;
        case 0.875:
          var PullerOffset = -0.234;
          break;
        case 1.0:
          var PullerOffset = -0.311;
          break;
        case 1.125:
          var PullerOffset = -0.398;
          break;
        case 1.25:
          var PullerOffset = -0.445;
          break;
        case 1.375:
          var PullerOffset = -0.551;
          break;
        case 1.5:
          var PullerOffset = -0.659;
          break;
        case 1.625:
          var PullerOffset = -0.784;
          break;
        case 1.75:
          var PullerOffset = -0.928;
          break;
    }

 

 

0 Likes
Message 3 of 3

Protohawk
Enthusiast
Enthusiast

I just wanted to thank the OP for this - I got setup with my "new" 1985 gang lathe and Fanuc 0T-A and a bar puller without too much issue.  I do eventually want to try to change it so I can put it after any operation because on my parts I actually want to  do the facing and OD/ID chamfer, then pull the part out, then cut off.  This works fine for the shorter parts but I've got a family of differing lengths and it would be nice to only have one move where I have to watch the dogleg Z/X approach.

 

THANKS!

0 Likes