Tool Change script

Hello everybody, I have a question about how tool change works . In waiting for the delivery of my 30x30 longmill, Iā€™m doing a little research into how this thing works.

So if Iā€™m writing a program that has a roughing pass, letā€™s just say quarter inch end mill and then it has a finishing pass using as 1/8 ballnose. Iā€™m assuming somewhere in the g-code (Iā€™m using kirimoto plug in for onshape) a tool change command is written. Now I read something about pre-hook which Iā€™m under the understanding that itā€™s a G-Code to move the mill out of the way allowing you to do your tool change and then you would accept something on g sender interface prompting the to run post-hook to go back to where it left off with the new tool.

Iā€™m really sorry if I butchered that explanation, but Iā€™m guess Iā€™m asking if I am correct in all these assumptions made above. Does anybody have any examples of what post hook script and pre-hook script your running? And also if g sender has these two scripts written by default and if so where is the machine going to do a change?

This is a bit minimal, but may be a useful starting point.

before change:
%wait
G0Z50; lift carriage high to facilitate tool change
M05; turn off spindle
G0 X0 Y0; go to convenient location to change tool - change to suit your workspace

after change:
G90
Z30; lower carriage to help with positioning touch plate
M0; pause until touch plate is in place
G10 L20 P1 Z0; changing Z0 definition
G91 G21; movements now are relative to initial positioning
G38.2 Z-40 F75; probe slowly downwards
G91
G0 Z4; lift up a bit
G38.2 Z-30 F20; probe again extra slowly
G4 P0.3; wait 0.3 seconds
G10 L20 P1 Z15; redefine Z0
G91
G0 Z4 ; lift up a bit
G90; movements are now again absolute
M03; reenable spindle
M0; Pause

1 Like

Oh wowā€¦ Iā€™m a little rusty on my g code lol.

Your first line when it tells you to lift z50. Iā€™m assuming thatā€™s 50 mm from current z-0? What if I have a 4-in stock in and I donā€™t have the 50 mm clearance for it to raise that much Will it crash?

Well, yeah. Whatā€™s a little crash among friends? :smiley:

@CMFaub Craig: I donā€™t know what the plug in that you are using does, but you may want to look at it to see where the Z axis ends up after the roughing pass. I use VCarvePro and run individual tool paths for roughing and finishing. (This is the default in VCPā€™s post processor for grbl inch.) Iā€™m in no screaming rush and without a tool changer, I believe that I can change bits, reset Z0, and get back to my finishing pass pretty much as quickly as running scripts to do the same thing. That said, if you prefer to run scripts, I would suggest your starting point should be knowing where your bit is at the end of the roughing pass. In my case, the bit is not at Z0 at the end of the roughing pass. So, if your plug in leaves the Z axis at a safe height above the work piece (as VCP does), and if your script moves Z relative to that location, you need to make sure you have enough height to complete the Z+ move that @saskia is suggesting. Otherwise, as you and @CrookedWoodTex point out, you crash Z at the top. If that happens, gSender no longer ā€œknowsā€ where your Z axis is, and all movements after that can be a crap shoot.
You and Tex have already commented on the Z50 move in line 2 of the script. I would suggest that you look at the Z30 move in line 6. The comment says that it is a lowering move. But, the command is a positive command, so the bit will rise, not lower. Between the Z50 and the Z30, you will have raised the bit 80mm. It is very likely that you wonā€™t have that much height available and will crash - again.

Be careful, there is a G90 command before. So it is going to absolute Z30, which is to lower the z-axis from Z50 to Z30.

2 Likes

@JHahn Tks, Jannik. I missed that. It is supposed to lower it, so the command is correct. I still believe that the preceding Z50 may cause an issue, though. Or, am I missing something there, too? :thinking:

No I think you, @CMFaub and @CrookedWoodTex are right. If Z50 is higher than you current z-clearance, you run into the mechanical z+ limit and you cant reproduce the z0ā€¦ but as you are changing the tool, z0 will get lost anywayā€¦ so from this point of view, this should not be an issue.

Hey everybody, thanks for the response. I think this is a little bit more higher level than what I was asking about.

Iā€™m not looking to do a auto tool change. I realize I still have to manually change the tool, but donā€™t we run programs that are already programmed with a rough and a finish pass?

Or am I mistaken and that we are supposed to be running a roughing program and then restarting the program with a roughing pass so two separate programs have to be loaded or sent to the longmill?

Hereā€™s my understanding as of right now.

Load wood

1 pick up project XYZ (I ordered the touch probe)

2 run roughing pass

3 When roughing passes complete Longmill calls for tool change ( M something or other. Written into the G-Code by whatever software youā€™re using for tool path ie aspire)

4 Longmill runs pre hook. (moves out of the way so you can do a manual tool change)

5 somehow repick up Z using touch probe (it should already know x and y)

6 Somehow tell Longmill tool change is complete and new z hight is accepted ( Iā€™m assuming this happens in g sender)

7 continue to running the finishing pass

So my question is how does 3,4 and 5 happen? How does the longmill nowhere to go to do a manual tool change and then give you access to setting Z height again. I thought these pre and post moves were the pre hook and the post hook. Iā€™m sorry Iā€™m a newbie. I might have all this wrong

@CMFaub Craig: Without knowing how your CAM application works, itā€™s impossible to say if your list is correct.

For example, in VCarvePro, here is the order of things for a carve like the one you are talking about:

  1. I create two tool paths, one for roughing and one for finishing. It is not a separate ā€œroughing programā€ and ā€œfinishing programā€. It is one program - VCP - creating two tool paths. (You and I may simply be calling the same process by two separate names.) The post processor that I used in VCP does not permit tool changes, so it will always be two tool paths.

  2. I set XYZ0 and run the roughing tool path in gSender. (I do not use pre-hook and post-hook since I have two separate tool paths. Pre-hook and post-hook are only used if you have one tool path for both operations and you need gSender to pause between them while you change tools and reset Z0.)

  3. After running the roughing pass, the tool path is finished. gSender returns the router back to its starting position. It has finished the job.

  4. I change the bit, and reset Z0. X0Y0 does not change.

  5. I load the finishing tool path into gSender and run it. At the end, gSender returns the router to its starting point.

Now, if the CAM software you are using and the post processor that you have chosen permit you to have tool changes in one file, your process will be different. If your application is like mine, your process will be the same as mine.

1 Like

My workflow is exactly like Grant posted.

Just want to add one point: As often as possible I use the same bit for all roughing and finishing toolpathsā€¦ saving as many toolchanges as possible. Sure this is not always possible, but for most of my projects it possible.

1 Like

Thank you very much for the explanation.

I guess Iā€™m getting a little confused. Iā€™m watching OnShape videos using Kiri Moto the path generator. Within kirimoto, youā€™re able to complete your whole program ( using multiple tools) all your tool paths and link them all together. With that said there is different tools that have to be changed in processā€¦

Wait does kirimoto save each toolpath individually thus running a roughing than an outline than a contour toolpath?

:flushed:

I am not sure about this tool chain, but think you can also link only all paths using the same bit. And then run these with manual tool changes in between.

Yea that looks to be whatā€™s going onā€¦ There is alot to learn. At this point I received my tracking number so now it back to build videos

Thanks everybody Iā€™m sure I will understand more with the mill in front of me!

1 Like