Drillbit tip compensation

Here's the place for discussion related to CAM/CNC and the development of the Path module.
Konstantin
Posts: 261
Joined: Wed Jul 23, 2014 10:10 am

Drillbit tip compensation

Postby Konstantin » Sun Aug 13, 2017 4:56 pm

Don't know how, but after some forking/deleting of freecad git I finaly made a tiny pull request, which must be fixed.
https://github.com/FreeCAD/FreeCAD/pull/926
roivai
Posts: 117
Joined: Thu Feb 02, 2017 5:29 pm
Location: Oulu, Finland

Re: Drillbit tip compensation

Postby roivai » Sun Aug 13, 2017 5:32 pm

How is the tip compensation supposed to work? For simplicity let's assume that we have a 10mm twist drill with 45deg angle (typically it is 59deg I think, but math is easy with 45..) That means that the conical shape or the tip of the drill is 5mm long. Now you want to drill a hole from starting depth of 20mm to finish depth of 0mm, i.e a 20mm deep hole. What is the expected outcome? That the actual, full 10mm hole is 20mm deep? If yes then I think we should move the drill from z=20 to z=-5. And that is FinishDepth MINUS tiplength. Is that correct? In that commit, you changed the sign from minus to plus, which is a bit strange to me if my previous assumptions are correct? Or do I get the whole compensation wrong?
mlampert
Posts: 1345
Joined: Fri Sep 16, 2016 9:28 pm

Re: Drillbit tip compensation

Postby mlampert » Sun Aug 13, 2017 6:05 pm

I'm with roivai, in my understanding the previous logic was correct - Konstantin could you explain why "tip compensation" means making the hole shorter?
Konstantin
Posts: 261
Joined: Wed Jul 23, 2014 10:10 am

Re: Drillbit tip compensation

Postby Konstantin » Sun Aug 13, 2017 7:33 pm

roivai wrote:
Sun Aug 13, 2017 5:32 pm
How is the tip compensation supposed to work? For simplicity let's assume that we have a 10mm twist drill with 45deg angle (typically it is 59deg I think, but math is easy with 45..) That means that the conical shape or the tip of the drill is 5mm long. Now you want to drill a hole from starting depth of 20mm to finish depth of 0mm, i.e a 20mm deep hole. What is the expected outcome? That the actual, full 10mm hole is 20mm deep? If yes then I think we should move the drill from z=20 to z=-5. And that is FinishDepth MINUS tiplength. Is that correct? In that commit, you changed the sign from minus to plus, which is a bit strange to me if my previous assumptions are correct? Or do I get the whole compensation wrong?
Tip angle is always calculated on both sides, so it is 118°, not 59. Now if I create 10mm tool with 118° angle, add a tip lenght compensation, export it, And I get Z2.66, so it is higher then should be. I checked and rechecked again, it always goes higher. With new way I get Z-2.66. So, where am I wrong?
just calculate

Code: Select all

obj.FinalDepth.Value + tiplength
vs

Code: Select all

obj.FinalDepth.Value - tiplength
Attachments
drill_example.FCStd
(12.98 KiB) Downloaded 15 times
Last edited by Konstantin on Sun Aug 13, 2017 7:40 pm, edited 1 time in total.
mlampert
Posts: 1345
Joined: Fri Sep 16, 2016 9:28 pm

Re: Drillbit tip compensation

Postby mlampert » Sun Aug 13, 2017 7:39 pm

Konstantin wrote:
Sun Aug 13, 2017 7:33 pm
Tip angle is always calculated on both sides, so it is 118°, not 59. Now if I create 10mm tool with 118° angle, add a tip lenght compensation, export it, And I get Z2.66, so it is higher then should be. I checked and rechecked again, it always goes higher.
just calculate

Code: Select all

obj.FinalDepth.Value + tiplength
vs

Code: Select all

obj.FinalDepth.Value - tiplength
But you want it to lower so you get the full width of the hole all the way through - right?
Konstantin
Posts: 261
Joined: Wed Jul 23, 2014 10:10 am

Re: Drillbit tip compensation

Postby Konstantin » Sun Aug 13, 2017 7:41 pm

mlampert wrote:
Sun Aug 13, 2017 7:39 pm
Konstantin wrote:
Sun Aug 13, 2017 7:33 pm
Tip angle is always calculated on both sides, so it is 118°, not 59. Now if I create 10mm tool with 118° angle, add a tip lenght compensation, export it, And I get Z2.66, so it is higher then should be. I checked and rechecked again, it always goes higher.
just calculate

Code: Select all

obj.FinalDepth.Value + tiplength
vs

Code: Select all

obj.FinalDepth.Value - tiplength
But you want it to lower so you get the full width of the hole all the way through - right?
Yes, I just fixed my previous post.
mlampert
Posts: 1345
Joined: Fri Sep 16, 2016 9:28 pm

Re: Drillbit tip compensation

Postby mlampert » Sun Aug 13, 2017 11:02 pm

Konstantin wrote:
Sun Aug 13, 2017 7:41 pm
Yes, I just fixed my previous post.
Ah, the problem is actually your tool definition. The cutting edge angle is to be expected as the angle specified in the datasheet, and `PathUtils.drillTipLength()` automatically doubles that angle. But because you have manually doubled it to 118° the resulting tooltip calculation returns a negative value - hence the reverted tooltip compensation.

We should probably put a safeguard in there, issuing an error if the resulting tool tip length ends up being negative. Or maybe put a value restriction on the cutting edge angle input field, having an angle >=90° (or <0° which is currently also possible) doesn't make any sense.

Good catch, I created an issue for the value restriction (issue #3158). I'll also create a PR for dealing with the compensation and adding an error message into PathUtils.

I forgot one thing which I should have mentioned right at the start: Konstantin, congrats on your first PR! That's quite an accomplishment. 8-)
chrisb
Posts: 18991
Joined: Tue Mar 17, 2015 9:14 am

Re: Drillbit tip compensation

Postby chrisb » Sun Aug 13, 2017 11:29 pm

See attached image for the calculation of the tip length. Using 59° seems to be correct if using the cotangens. And sorry for the handwriting, it was so much faster then creating a pdf.
Attachments
20170814_012255.jpg
20170814_012255.jpg (40.52 KiB) Viewed 826 times
mlampert
Posts: 1345
Joined: Fri Sep 16, 2016 9:28 pm

Re: Drillbit tip compensation

Postby mlampert » Mon Aug 14, 2017 12:15 am

mlampert wrote:
Sun Aug 13, 2017 11:02 pm
Ah, the problem is actually your tool definition. The cutting edge angle is to be expected as the angle specified in the datasheet, and `PathUtils.drillTipLength()` automatically doubles that angle. But because you have manually doubled it to 118° the resulting tooltip calculation returns a negative value - hence the reverted tooltip compensation.

We should probably put a safeguard in there, issuing an error if the resulting tool tip length ends up being negative. Or maybe put a value restriction on the cutting edge angle input field, having an angle >=90° (or <0° which is currently also possible) doesn't make any sense.
I did a little searching, and it turns out that most manufacturer actually specify the full point angle, at least for drill, counter sink and v-bits. So maybe we should change how we calculate the tip length and let the users specify the point angle instead of the cut edge angle.

Opinions?
User avatar
sliptonic
Posts: 1562
Joined: Tue Oct 25, 2011 10:46 pm

Re: Drillbit tip compensation

Postby sliptonic » Mon Aug 14, 2017 1:27 am

mlampert wrote:
Mon Aug 14, 2017 12:15 am
mlampert wrote:
Sun Aug 13, 2017 11:02 pm
Ah, the problem is actually your tool definition. The cutting edge angle is to be expected as the angle specified in the datasheet, and `PathUtils.drillTipLength()` automatically doubles that angle. But because you have manually doubled it to 118° the resulting tooltip calculation returns a negative value - hence the reverted tooltip compensation.

We should probably put a safeguard in there, issuing an error if the resulting tool tip length ends up being negative. Or maybe put a value restriction on the cutting edge angle input field, having an angle >=90° (or <0° which is currently also possible) doesn't make any sense.
I did a little searching, and it turns out that most manufacturer actually specify the full point angle, at least for drill, counter sink and v-bits. So maybe we should change how we calculate the tip length and let the users specify the point angle instead of the cut edge angle.

Opinions?
We need to make sure we're consistent with other cutter types. We're re-using the cutting edge angle and I I'm not sure how that attribute should be interpreted for end-mills, face-mills, etc. I assumed it was 1/2 the tip angle and doubled it for the drillTipLenght() because that's how heekscnc did it.