Bar Pulling Post
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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");
}1
2
3
4
5