Fusion Manufacture
Talk shop with the Fusion (formerly Fusion 360) Manufacture Community. Share tool strategies, tips, get advice and solve problems together with the best minds in the industry.
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Fusion lathe bar puller *tutorial*

Message 1 of 6
1862 Views, 5 Replies

Fusion lathe bar puller *tutorial*

so a lot of people have asked me how I got Fusion to post out a bar puller program with no manual editing (actually nobody has asked me)


the problem is that fusion isn't setup with a good system for us poor single spindle sans bar feeder people when it comes to production lathe stuffs, but with a little work and lots of cussing, you too can become a productive member of society!


Introducing the Dr.Phil Brand Bar Puller Tutorial!!! (hold for applause) 



this involves modifying your post processor so if you don't know how then I suggest you learn before starting on this adventure.

I am no expert at posts, so I might have made this more complicated than it needed to be.




The goal of this is to be able to use an existing toolpath that us single spindlers wouldn't use normally, and change the post processor so that toolpath actually controls our bar puller. we will also write a simple loop program with the "pass through" function, that you can save as a template. 


STEP ONE(1): setup the bar puller


First things first, we need to setup our bar puller. We will be using the "turning secondary spindle chuck" function under turning to control our bar puller, but alas this function does not let us select a tool (what ever shall we do?!) Fear not young padawan, for we can set this up in our user defined properties.


Open what ever you use to edit your post (I prefer Notepad ++) and add this line to your user defined properties:

Note* the "50" will be the actual tool number you use for your bar puller. so change this number to whatever tool number you are using.

barPullerTool: 50,



*Pro Tip* add // followed by your initials after you add or change something so you can easily find it later.


STEP TWO(2):  Grab the stock size


Now, because none of us are lazy...right...we don't want to have the bar puller start from X home and feed all the way to our stock, and because we actually are lazy, we don't want to manually input our stock size with another user property. So, lets make the post processor do the work for us!


If you post a program with the "dumper.cps" post, you will become very confused very quickly, but soon you will notice a wealth of information that is essential to making sweet post edits. If you do a little digging you will happen upon some "onParameter" with some stock information, thats the good stuff. We are going to use that Parameter in our post so we can actually rapid our bar puller down to our stock.

To do that we are going to need to add a few lines to the post, I wasn't sure where the best place to put those lines are, so I added them after the "write WCS" section.


/** Write stock dia for bar puller */
function writeStockDia(section) {
	if (hasParameter("stock-upper-x")) {
		var stockDia = getParameter("stock-upper-x");
	writeBlock(gMotionModal.format(0), xOutput.format(stockDia *2), formatComment("CLEARENCE HIGHT"));


STEP THREE(3) erase all of the fusion teams hard work


Now for the fun part. we are going to basically erase all of the code for the "turning secondary spindle chuck" feature and replace it with our own code, because we all watch a 5 minute video on youtube about writing java script so we are pretty much experts now. 


Find the "secondary-spindle-grab" section in your post, you will find it under onCycle()

and replace that whole thing with this;


 switch (cycleType) {
    case "secondary-spindle-grab":
	writeRetract(currentSection, currentSection); // no retract in Z
	  if ((typeof isSubSpindleCycle == "function") && isSubSpindleCycle(cycleType)) {
    if (hasParameter("operation-comment")) {
      var comment = getParameter("operation-comment");
      if (comment) {
	writeBlock("T" + toolFormat.format(properties.barPullerTool *100 + properties.barPullerTool));
	   // wcs required here
    currentWorkOffset = undefined;
	//writeBlock(mFormat.format(19), "S" + abcFormat.format(cycle.spindleOrientation));

	writeBlock(gMotionModal.format(0), zOutput.format(cycle.chuckPosition), formatComment("PART OFF FACE"));
	writeBlock(gMotionModal.format(1), xOutput.format(-.4), getFeed(cycle.feedrate));
	writeBlock(zOutput.format(cycle.feedPosition), formatComment("PULL OUT"));


there might be a few things you notice, first the toolFormat.format line, thats how you get the tool call to post out like this T5050

if your machine takes something different, well...figure it out...


second, all of the codes. Those are also taken from the Dumper.cps file and they directly relate to the "turning secondary spindle chuck" in fusion.


the rest is all things you can work through, "getCode" are all things that you might have to change.


STEP FOUR(4)  sweet sweet fusion


Now its time to head back into fusion and have fun with our brand new cycle!


your "turning secondary spindle check" will look something like this:



Things you should know:

Feed - is the feedrate that the bar puller will move onto the part and pull it out at

stop spinde - no longer works

spindle speed - no longer works

spindle orientation - haven't figured it out on my lathe yet, but if you un-block that line in your post it might work.

parts catcher - that would be a bad idea...

dwell - time to dwell after chuck opens and closes

feed plane - this is where the par puller will pull the part too 

chuck plane - this is where the bar puller will clamp onto the piece. I have a stop on my bar puller that is where I have my z offset from, so I set the chuck plane to the model back minus the width of my part off tool, plus a little clearance. 


Obviously you are going to put this right after you part off...


STEP FIVE(5): fruit loops


Now that everything is finally sorted out and hopefully I haven't lost you, its time to write a simple loop so that all of this is actually useful.


This is probably the easiest part, we are going to write 4, count them, 4 separate "pass through lines in fusion, and arrange them so our program will look something like this:




Write the 4 separate lines like this;

1. Number of loops (replace 15 with how ever many times you want to loop the program


2. Start counter ( start the counter at 0)


3. Counter (where we actually start counting)


4. If statement ( loop the program) (GOTOxx is the line number to re start from)

IF [#20 LT #10] GOTO16

the GOTO statement is crucial, I don't post my lathe programs with any notes or tool call outs at the beginning of the program, that way i know that no matter what program I post, my GOTO line (the line i want to repeat the program from) is always N16

if you post out with tools calls or comments, you will have to manually edit the GOTOxx line.




Save the "number of loops" and "start counter" as a template called "start loop"


and save the "counter" and "if statement" as a template called "end loop"


then you can add them to the start and end of any program you want.


STEP SIX(6): bask in your own glory


YOU DID IT! or you failed horribly and probably hate me now. but if you are successful, you should have a program that looks something like this;



I have attached my lathe post for reference, this is a hurco post with some herco specific codes especially for the parts catcher, so use at your own risk!


Message 2 of 6

I don't have a lathe, or plan on having one anytime soon, but I must say, this was an enjoyable read!

Seth Madore
Owner, Liberty Machine, Inc.
Good. Fast. Cheap. Pick two.
Message 3 of 6

Saw this on Instagram, thank you so much for sharing!
Nick Santiago
Message 4 of 6
in reply to: MJK_Performance

Your contribution is exactly what I am looking for but I am using a Dunham Tool bar puller that works on my gang lathe. It looks like your bar puller approaches the stock from the X axis where mine will approach the stock from the Z axis. I was hoping that you could assist me in modifying your code to work with my style bar puller. I am completely new to post processors and want to learn more but I also do not want to destroy tooling in the process.


Thank you,

Message 5 of 6

Great work my friend!


i did a lot of post rework but as a step by step instruction saves me some hours of fiddling around.


Best part :

"because we all watch a 5 minute video on youtube about writing java script"

And with the word's of Mike Patey "Back to work!"


Thank's a lot for your effort of writing it down.

Message 6 of 6
in reply to: MJK_Performance

I can't seem to get past the very first step. The user defined properties appear to have been all redesigned. Any help on what I'm missing in that section would be very appreciated. 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums