• TalkBass has been independent since 1998. Add your voice.
    Create a free account to reply to discussions, view embedded media, and browse with fewer display ads.
    Join freeLog in
    Want zero display ads or expanded classifieds tools? Compare plans.

CNC fretboard G-code generator

I see a loop subroutine with 1% depth (computed radiused depth) at 1% of distance, 50% at 50%, 100% depth at 100% distance, and then backtrack to cut the slot full depth back to 0% distance (start) and retract. Or various other possible ways.

That would work OK, given the depth to distance ratio is very small in this application, though it would add several passes.

My current plan is to calculate the tangent angle at the end of the slot and then ramp at the greater of that angle or 20 degrees from wherever that intersects the top (technically Z=0) to the end of the slot. This should be both quick and effective since the ramp will basically match the bottom of the fret slot near the end.
 
  • Like
Reactions: T_Bone_TL and TFM94
I had some more time to work on this and now have the ramp working. Here is an example of a single fret slot, with a very exaggerated 60 mm radius:
single_fret_slot_ramp.png


The ramp angle will be limited to about 10 degrees on flatter boards.

Now to test it on a real piece of wood...
 
  • Like
Reactions: Beej and TFM94
I wonder if you could write the code to have it "peck" at the wood? That is, it feeds the cutter forward 1/4", backs up 1/8" for a second or two to let the vacuum pull out the chips, then goes forward another 1/4", back up 1/8", etc. That may be more effective at clearing the chips than just going slower. You should be able to write G-code to do that?
 
I wonder if you could write the code to have it "peck" at the wood? That is, it feeds the cutter forward 1/4", backs up 1/8" for a second or two to let the vacuum pull out the chips, then goes forward another 1/4", back up 1/8", etc. That may be more effective at clearing the chips than just going slower. You should be able to write G-code to do that?

Yes, I definitely could do a forward/back cut, but on my tests on the through slots, chip clearing really wasn't an issue, even with the "deep" 2 mm cuts (by deep I mean relative to the diameter -- about 4:1 in this case).

I will give it a go with this single ramp and see what happens. If I can get a video of the chip ejection I will. It surprised me how fast those tiny chips were coming out.

It would also be pretty trivial to add multiple passes so I might try that if the ramp doesn't work.
 
Yes, I definitely could do a forward/back cut, but on my tests on the through slots, chip clearing really wasn't an issue, even with the "deep" 2 mm cuts (by deep I mean relative to the diameter -- about 4:1 in this case).

I will give it a go with this single ramp and see what happens. If I can get a video of the chip ejection I will. It surprised me how fast those tiny chips were coming out.

It would also be pretty trivial to add multiple passes so I might try that if the ramp doesn't work.

My understanding, from guys like Rob, is that the chip clearing seems to be going fine, until it reaches the point where it all heats up just enough that the chips lock up filling the flutes of the cutter. A sudden spike in the side load, and the cutter snaps off. I don't remember for sure, but Rob may have been blowing pressurized air right down into the slot, in addition to the vacuum dust collection. It's all about keeping the cutter cool and keeping the chips from jamming up.
 
My understanding, from guys like Rob, is that the chip clearing seems to be going fine, until it reaches the point where it all heats up just enough that the chips lock up filling the flutes of the cutter. A sudden spike in the side load, and the cutter snaps off. I don't remember for sure, but Rob may have been blowing pressurized air right down into the slot, in addition to the vacuum dust collection. It's all about keeping the cutter cool and keeping the chips from jamming up.

That is interesting. LASER cutting typically benefits from air assist, but I had never considered it for CNC work. Might be a good idea to add that if I find that I am breaking mills.
 
yeah, air is generally helpful but the set up doesn't need to be exotic, just a small hose right at the tool with a valve. or use a vacuum ring like you would find on an industrial cnc router. otoh, the chips from oily woods like rosewood for example, have a tendency to stick to the flutes of cutters so in that case, an air line is more effective.

also, that ramp move isn't really necessary. in programming we'll generally drop right into a feed point that is easily accessible and use a short lead-in before entering the cut and just repeat for subsequent depth cuts.

another thing to think about is that if that ramp move is not a actual G01 feed move but rather a G00 move, the controller might interpret that by moving the machine to a point where the most logical 45 degree move can be made and then rapid into something.
 
Last edited:
  • Like
Reactions: Jeff Siddall
yeah, air is generally helpful but the set up doesn't need to be exotic, just a small hose right at the tool with a valve. or use a vacuum ring like you would find on an industrial cnc router. otoh, the chips from oily woods like rosewood for example, have a tendency to stick to the flutes of cutters so in that case, an air line is more effective.

also, that ramp move isn't really necessary. in programming we'll generally drop right into a feed point that is easily accessible and use a short lead-in before entering the cut and just repeat for subsequent depth cuts.

another thing to think about is that if that ramp move is not a actual G01 feed move but rather a G00 move, the controller might interpret that by moving the machine to a point where the most logical 45 degree move can be made and then rapid into something.

Yes, I was thinking a small metal tube pointed at the tip of the tool connected to a compressed air supply. All I am missing is the small metal tube!

I am not sure exactly what you mean by "a short lead-in" but essentially that is what I built. In this case I am cutting the full 2 mm depth in one pass, but the same principle would apply with shallower passes.

All the green lines in the simulation above, including the ramp, are G01 moves and the red are G00.
 
Another update: I tested the new ramp code and chip clearing seems to be working well. It was hard to capture, given how tiny everything is, but there is a steady stream of chips being ejected from the slot and flying off to the left (as well as many piling up around the slot) in the video below:

Fret Slot Video

The chips are heading to the left because of air currents caused by the spindle cooling fan.

I cut several short slots at 40 mm/min and nothing is broken yet. So far so good!
 
  • Like
Reactions: T_Bone_TL
Yes, I was thinking a small metal tube pointed at the tip of the tool connected to a compressed air supply. All I am missing is the small metal tube!

I am not sure exactly what you mean by "a short lead-in" but essentially that is what I built. In this case I am cutting the full 2 mm depth in one pass, but the same principle would apply with shallower passes.

All the green lines in the simulation above, including the ramp, are G01 moves and the red are G00.

good to go on G0/G1 moves then.

a lead in line is a short move to allow cutter comp to engage. in your case you are programming to tool center so you don't need it for that, but it also allows you to drop down into an area "in the air" to cut depth, before you engage material.

typical mastercam lead-in/lead-out parameter settings. one just changes to "line" and provides an amount or an angle as needed. putting the tool on center is in the contour parameters.

lead.jpg


another way to do this is to just extend your contour past the material 1x the cutter diameter plus some suitable amount like -say .03" or so.

for airlines, as stated, line-loc is usually the preferred choice for quick set-ups and flexibility. there are other clone brands out there as well. if you get the real line-loc brand i highly suggest the pliers that are used to assemble the stuff. genuine line-loc is plenty hard to put together by hand.
 
Last edited:
good to go on G0/G1 moves then.

a lead in line is a short move to allow cutter comp to engage. in your case you are programming to tool center so you don't need it for that, but it also allows you to drop down into an area "in the air" to cut depth, before you engage material.

typical mastercam lead-in/lead-out parameter settings. one just changes to "line" and provides an amount or an angle as needed. putting the tool on center is in the contour parameters.

View attachment 4567689

another way to do this is to just extend your contour past the material 1x the cutter diameter plus some suitable amount like -say .03" or so.

for airlines, as stated, line-loc is usually the preferred choice for quick set-ups and flexibility. there are other clone brands out there as well. if you get the real line-loc brand i highly suggest the pliers that are used to assemble the stuff. genuine line-loc is plenty hard to put together by hand.

I see your screenshot is for a 2D toolpath dialog, but this is a 3D issue since the slot has a curved bottom.

Regarding the comment on extending the contour, that might work to make chip clearing space, but doesn't solve using a plunge which is also best avoided.

I searched Amazon for a Loc-line but didn't find anything that wasn't too expensive, too big etc. However, I stumbled on a cooling mist setup which included some [presumably knock-off] loc-line, plus a metal manifold with adjustments for air and oil, fittings, a pickup hose etc. More than I needed for sure but then I saw the price: $9.19 CAD (about $7.25 USD) including free shipping:
516MQL20HlL._SL1001_.jpg


Ummm... yes please!
 
  • Like
Reactions: dwizum
in mastercam and most other industrial cam systems at least, lead in/lead out applies to both 2d and 3d contours.

lead-in and lead-out have nothing to do with "chip clearing space"?, only cutter compensation, and entry/exit of a cut.

"....but doesn't solve using a plunge which is also best avoided" -i don't know what you mean by this? :)
 
Last edited:
in mastercam and most other industrial cam systems at least, lead in/lead out applies to both 2d and 3d contours.

lead-in and lead-out have nothing to do with "chip clearing space"?, only cutter compensation, and entry/exit of a cut.

"....but doesn't solve using a plunge which is also best avoided" -i don't know what you mean by this? :)

Ah, OK I misread your comment. But now re-reading it, by going "...past the material..." I guess you mean a through-slot, rather than a blind slot. Yes, that would solve the problem.

I am kind of curious how mastercam would make a lead-in on a curved bottom slot. It's not a trivial problem.
 
Ah, OK I misread your comment. But now re-reading it, by going "...past the material..." I guess you mean a through-slot, rather than a blind slot. Yes, that would solve the problem.

I am kind of curious how mastercam would make a lead-in on a curved bottom slot. It's not a trivial problem.

ok, no worries.

Not sure what's behind the scenes of the software, but in practice the lead in and out is executed as a linear move to the arc start point and then again at the end of the arc. Code wise it'll state G17 (XY plane) then the arc ex: (G19 YZ plane) then back to G17 at the end. With a true arc it's easy to do this via MDI, but if it were a spline, the work becomes much more complex.
 
  • Like
Reactions: Jeff Siddall
ok, no worries.

Not sure what's behind the scenes of the software, but in practice the lead in and out is executed as a linear move to the arc start point and then again at the end of the arc. Code wise it'll state G17 (XY plane) then the arc ex: (G19 YZ plane) then back to G17 at the end. With a true arc it's easy to do this via MDI, but if it were a spline, the work becomes much more complex.

OK, that makes sense. One of the complex use cases is if the move to the arc start point exceeds the specified percentage. I wonder what happens in that case.

My application is a spline because the radius will change along the slot for multiscale compound radius boards.
 
Re: An air jet to help blow chips off the cutter

The simple rig I've often seen on milling machines is an 8" long piece of 1/4" OD copper tubing. It goes to a small needle valve which is clamped to the side of the spindle casting, usually with a hose clamp. On the top of the needle valve is a fitting for plugging on a flexible air hose. Bend the copper tube so it's pointing right at the cutter. Dial in the air flow with the needle valve. Sometimes the air has oil or coolant mist in it; other times it's just dry air right from the compressor. Often used when milling deep slots in brass and aluminum, where you don't want to have to clean up the mess of coolant all over everything.
 
OK, that makes sense. One of the complex use cases is if the move to the arc start point exceeds the specified percentage. I wonder what happens in that case.

My application is a spline because the radius will change along the slot for multiscale compound radius boards.

another way to handle it is to just draw small line at the start point and end point of the spline. basically the whole concept of this is to not dive into material at the start of the cut, and to exit the cut in the clear -however that gets accomplished.
 
I added one more function to the script to engrave a perimeter line to mark the edges, which is useful when aligning the board on the neck and cutting it down to size. I tested that, along with the two toolchanges required: one from the ball nose bit used for surfacing to the tiny end mill used for the fret slots, and another to an engraving bit used to mark the perimeter, on a small piece of scrap hard maple and it all worked great. Final test is to cut a couple of real fretboards. Assuming that it works I will post the code for anyone interested.
 
  • Like
Reactions: T_Bone_TL