Modifying Post to Move Machine at end of Cycle

Has anyone had luck modifying the post code to move the machine to another position (i.e. up front for tool changes) rather than the X0,Y0, Z0 position? Attempted to make some changes with the help of ChatGPT, but wasn’t successful.

Ive been looking into this with no luck, ideally it would move forward and turn off the spindle before it starts moving but after it hits the z endstop

We don’t know what software you’re using. I assume Fusion360?

Yes, Fusion 360, but can’t imagine the machine cares what software generates the G code.

You are correct, the machine doesn’t care. But with the MR-1 and the way the control works, the Post processor is what’s going to handle the movement you’d like to change.

Look in the post code for the line that outputs the ‘M30’ command.
https://linuxcnc.org/docs/html/gcode/m-code.html#mcode:m2-m30

Then add line to move in machine coordinates, G53, before the M30 command.
https://linuxcnc.org/docs/html/gcode/g-code.html#gcode:g0

G53 G0 Z0  
G53 G0 X0 Y0
or
G53 G1 F50 Z0
G53 G1 F50 X0 Y0 

I don’t know anything the MR1 but the above ‘0’ zeros moves to the machine’s home position. Change the zeros to the location you want to move to.Remember moves in G53 are in the machine coordinates not your work offsets. Always move the Z up first to avoid whacking your end mills into something. Watch out for rapid moves G0, might want to start with G1, with a low F value and your hand on the e-stop. Try all this in the MDI first before hacking the post code.

1 Like

I have edit fusion post processors for most of my machines. Mostly for the reasons you offered. This is how I attack it…

1.) I design a very simple “part”. Part is in quotes because I never cut the part. Then I create a 2D contour tool path.

Here is an example of simple part with the tool path generated.

2.) Then I post process it for my machine.

3.) Then I make a copy of the post process and print it out.

4.) I look at the post processor sections and match them up to sections in the post processor gcode. This is the .nc file that the post processor produces. There are sections like onOpen (for setup of the machine when starting) and onSection (for the 2d contour) etc. It is more obvious than you think…

5.) I then begin changing the copied post processor sections step by step to understand how things are working. I do that by editing the COPIED post processor then checking the results by post processing again and again. Ohh and you need to use your edited post processor to do all this not the one you haven’t edited.

It sounds a little complicated but if you have any programing skills it is very easy. The language is javascript. And surprisingly the post processor - process in fusion is excellent. It will even flag errors for you. And FWIW I can program but I cannot in javascript, I just google the syntax or the issue as I roll.

It is actually kinda fun.

The only caution is you are controlling the machine so for example think about moving the tool all the way up before you move in the X-Y so you don’t run into your part or holder by moving all three directions at once. Seems obvious until it isn’t :crazy_face: and just cause it works on the current part or fixture doesn’t mean it will work on the next one.

2 Likes

Thats a pretty good way to self-teach.