Rotated holes result in different sized Helix tool paths.

Here's the place for discussion related to CAM/CNC and the development of the Path module.
rainharvester
Posts: 23
Joined: Fri Nov 16, 2018 2:00 am

Rotated holes result in different sized Helix tool paths.

Postby rainharvester » Tue Aug 06, 2019 8:16 pm

I created a flat sheet with some 4.5mm holes, and create a clone of it and rotate the clone 90.
Then I select the holes in each object and apply "helix" tool path.
When I click on each of the helix paths, the diameter is different as shown in the base geometry. I measured and they are actually different.

I don't know if this is related, but the holes are poligonalized. When you rotate the hole, the polygon gets wider/shorter in one dimension because the points of the polygon are actually farther/closer apart the horizontal direction. I'm not sure if this causes the helix to get it's diameter from the horizontal width of those poligonalized holes.

I'm dealing with tolerances on the diameter of .05mm so the differences are noticable.

Is there a way to workaround? I tried "edit->preferences->units->NumberOfDecimals" but that didn't help.
Also, I searched this forum but didn't find any mention of this. Is this already known?
Attachments
rotatedHoleSize.png
rotatedHoleSize.png (75.51 KiB) Viewed 852 times
- aka 'TheRainHarvester" on youtube.
chrisb
Posts: 18935
Joined: Tue Mar 17, 2015 9:14 am

Re: Rotated holes result in different sized Helix tool paths.

Postby chrisb » Tue Aug 06, 2019 11:26 pm

Please attach your FreeCAD file.
rainharvester
Posts: 23
Joined: Fri Nov 16, 2018 2:00 am

Re: Rotated holes result in different sized Helix tool paths.

Postby rainharvester » Wed Aug 07, 2019 5:38 pm

Attached.
Attachments
RotateHoleSize.FCStd
(15.89 KiB) Downloaded 15 times
- aka 'TheRainHarvester" on youtube.
chrisb
Posts: 18935
Joined: Tue Mar 17, 2015 9:14 am

Re: Rotated holes result in different sized Helix tool paths.

Postby chrisb » Wed Aug 07, 2019 10:02 pm

I can confirm the issue, although I was a bit disappointed by the uploaded file, as it did not show the issue.
rainharvester wrote:
Tue Aug 06, 2019 8:16 pm
I created a flat sheet with some 4.5mm holes, and create a clone of it and rotate the clone 90.
The holes have a diameter of 4.9mm. I reduced the sketch to one hole and added the clone. The helix contains both holes as BaseGeometry and shows the different diameters. If I measure the holes in a sketch the both show the correct diameter of 4.9.
Bildschirmfoto 2019-08-08 um 00.06.09.png
Bildschirmfoto 2019-08-08 um 00.06.09.png (26.38 KiB) Viewed 783 times
Attachments
RotateHoleSize_cb.FCStd
(15.74 KiB) Downloaded 22 times
rainharvester
Posts: 23
Joined: Fri Nov 16, 2018 2:00 am

Re: Rotated holes result in different sized Helix tool paths.

Postby rainharvester » Thu Aug 08, 2019 1:38 am

Sorry for the mix up of the file.
Is there a workaround that I could use to make the hole the correct size (other than creating 2 different models for different rotations)?
Is this bug being worked on already?

Thanks!
- aka 'TheRainHarvester" on youtube.
chrisb
Posts: 18935
Joined: Tue Mar 17, 2015 9:14 am

Re: Rotated holes result in different sized Helix tool paths.

Postby chrisb » Thu Aug 08, 2019 8:08 am

It seems to be a bug which I haven't seen before. We usually wait here for the experts to comment before creating a ticket.
sliptonic wrote:ping
mlampert wrote:ping
IMback!
Posts: 69
Joined: Sat Jul 13, 2019 9:40 pm

Re: Rotated holes result in different sized Helix tool paths.

Postby IMback! » Thu Aug 08, 2019 8:54 am

rainharvester wrote:
Thu Aug 08, 2019 1:38 am
Is there a workaround that I could use to make the hole the correct size (other than creating 2 different models for different rotations)?
Yes, select the eadge istead of the face of the hole.

See code to determine hole diameter used by the helix operation:

Code: Select all

   
    def holeDiameter(self, obj, base, sub):
        '''holeDiameter(obj, base, sub) ... returns the diameter of the specified hole.'''
        if self.baseIsArchPanel(obj, base):
            edge = self.getArchPanelEdge(obj, base, sub)
            return edge.BoundBox.XLength

        try:
            shape = base.Shape.getElement(sub)
            if shape.ShapeType == 'Vertex':
                return 0

            if shape.ShapeType == 'Edge' and type(shape.Curve) == Part.Circle:
                return shape.Curve.Radius * 2

            # for all other shapes the diameter is just the dimension in X
            return shape.BoundBox.XLength
        except Part.OCCError as e:
            PathLog.error(e)

        return 0
        
Only the first and last case for determining the diameter exhibits this behaviour.

Apparently edge.BoundBox.XLength gets calculated from finite approximated panels. Sadly this is python and i cant figure out what type edge is by looking at the code and therfore and where the BoundBox is being calculated.
IMback!
Posts: 69
Joined: Sat Jul 13, 2019 9:40 pm

Re: Rotated holes result in different sized Helix tool paths.

Postby IMback! » Thu Aug 08, 2019 9:36 am

Looks like the first bit:

Code: Select all

        if self.baseIsArchPanel(obj, base):
            edge = self.getArchPanelEdge(obj, base, sub)
            return edge.BoundBox.XLength
is never used only this is used:

Code: Select all

            # for all other shapes the diameter is just the dimension in X
            return shape.BoundBox.XLength
shape here is of type Part::Face, asserted at run time. Thats all i have time for for now.
chrisb
Posts: 18935
Joined: Tue Mar 17, 2015 9:14 am

Re: Rotated holes result in different sized Helix tool paths.

Postby chrisb » Thu Aug 08, 2019 9:40 am

I get an error using Helix anyway, but I will start a new topic for that.
rainharvester
Posts: 23
Joined: Fri Nov 16, 2018 2:00 am

Re: Rotated holes result in different sized Helix tool paths.

Postby rainharvester » Thu Aug 08, 2019 2:06 pm

heh heh, the bound box seems to mimic what I thought : the poligonal lines that make up the holes are smaller when the hole is rotated 90.

Earlier I tried to workaround this by increasing the number of lines per circle (via all the "edit->preferences" settings), but I could find no attribute that affected this. Maybe I needed to draw the circle AFTER changing the settings?

I'll try your workaround... ... it works (in display AND cutout parts). Thanks for your help!

Now wait for devs to say if we should file a bug? (I'm not even sure if one of you IS a dev.)
- aka 'TheRainHarvester" on youtube.