Drilling Bug

Here's the place for discussion related to CAM/CNC and the development of the Path module.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
GeneFC
Veteran
Posts: 5373
Joined: Sat Mar 19, 2016 3:36 pm
Location: Punta Gorda, FL

Drilling Bug

Post by GeneFC »

I have been struggling with the new drilling function for a couple of days, and I think I have uncovered a small bug.

I have a simple block with 42 identical holes to be drilled into the top surface. No matter how I changed the hole size or the tool, 4 of the 42 holes simply refused to be selected. I tried deleting some of holes and various other changes, but in no case would any of the holes at those 4 locations behave properly.

I finally tracked the problem down to the following comparison in the new PathUtils.py module

Under the "isDrillable" routine there is a comparison

if obj.isInside(lsp, 0, False) or obj.isInside(lep, 0, False)

This apparently checks to see if the seam of the cylinder to be drilled is vertical. I found the test was failing for the 4 bad candidates.

I changed the comparison to

if obj.isInside(lsp, PathGeom.Tolerance, False) or obj.isInside(lep, PathGeom.Tolerance, False)

I also added to the header section

from PathScripts.PathGeom import PathGeom

Now everything works as should. I would guess that the seams are not *exactly* vertical due to FC internal numerical precision.

I can file a bug report if desired.

Gene
User avatar
sliptonic
Veteran
Posts: 3457
Joined: Tue Oct 25, 2011 10:46 pm
Location: Columbia, Missouri
Contact:

Re: Drilling Bug

Post by sliptonic »

Looks like a good fix to me. Do you want to do a PR or would you like me to implement it?
GeneFC
Veteran
Posts: 5373
Joined: Sat Mar 19, 2016 3:36 pm
Location: Punta Gorda, FL

Re: Drilling Bug

Post by GeneFC »

sliptonic wrote:Looks like a good fix to me. Do you want to do a PR or would you like me to implement it?
I would prefer that you either do the PR or simply include the fix as part of the ongoing improvements you are making. I suspect it is quite a rare problem, since nobody else seems to have reported it. I would probably be seriously challenged at this time to try a PR.

My python-fu is essentially non-existent. I found the solution by studying the holding tag procedure made by mlampert a couple of months back.

Gene
Post Reply