[Solved] Error in Helix operation

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
chrisb
Veteran
Posts: 54168
Joined: Tue Mar 17, 2015 9:14 am

[Solved] Error in Helix operation

Post by chrisb »

Edit: This issue occurs only if the tool diameter is bigger than the hole diameter.

If I create a Helix operation for a circular hole like uploaded in this topic I get the following error:

Code: Select all

Traceback (most recent call last):
  File "/Users/cb/Desktop/FreeCAD.app/Contents/Resources/Mod/Path/PathScripts/PathUtils.py", line 64, in new_function
    res = function(*args, **kwargs)
  File "/Users/cb/Desktop/FreeCAD.app/Contents/Resources/Mod/Path/PathScripts/PathOp.py", line 503, in execute
    result = self.opExecute(obj) # pylint: disable=assignment-from-no-return
  File "/Users/cb/Desktop/FreeCAD.app/Contents/Resources/Mod/Path/PathScripts/PathCircularHoleBase.py", line 356, in opExecute
    self.circularHoleExecute(obj, holes)  # circularHoleExecute() located in PathDrilling.py
  File "/Users/cb/Desktop/FreeCAD.app/Contents/Resources/Mod/Path/PathScripts/PathHelix.py", line 91, in circularHoleExecute
    output += self.helix_cut(obj, hole['x'], hole['y'], hole['r'] / 2, float(obj.StartRadius.Value), (float(obj.StepOver.Value) / 50.0) * self.radius)
  File "/Users/cb/Desktop/FreeCAD.app/Contents/Resources/Mod/Path/PathScripts/PathHelix.py", line 192, in helix_cut
    assert(radii[0] > 0)
<class 'AssertionError'>: 
OS: macOS High Sierra (10.13)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.17512 (Git)
Build type: Release
Branch: master
Hash: 7b315d3a15f6c0a3e796b2bf000cb791092de079
Python version: 3.7.3
Qt version: 5.9.7
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/Germany (en_DE)
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
chrisb
Veteran
Posts: 54168
Joined: Tue Mar 17, 2015 9:14 am

Re: Error in Helix operation

Post by chrisb »

According to https://forum.freecadweb.org/viewtopic. ... 59#p325659 the tesselation is the reason for OP's problem. If I change the tesselation in the view attributes to angular deflection=2° and Deviation=0,01 the I get for both holes the same diameter of 0.9.

You can play with the values of these attributes - I don't even know which of them fixes the issue - and report back.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
IMback!
Posts: 72
Joined: Sat Jul 13, 2019 9:40 pm

Re: Error in Helix operation

Post by IMback! »

Looks like using the Bounding box will never get completely accurate results for all cases. Should be pretty easy to just avoid useing the bounding box in most cases. The code detects the corresponding edge for arch pannels ... and then uses the Bounding box anyways. (Somewhat fragile) Logic could be added to get the corresponding edge to a hole surface. Then It could just check if the detected edge is a Part.Circle and use the radius and fall back to bounding box if this dose not work.
IMback!
Posts: 72
Joined: Sat Jul 13, 2019 9:40 pm

Re: Error in Helix operation

Post by IMback! »

I cant reproduce the bug in OP with my setup.

OS: Arch Linux
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.17512
Build type: Release
Branch: master
Hash: 8806e4490606d7a1be52c831049b17d8c8d9c320
Python version: 3.7.3
Qt version: 5.13.0
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/United States (en_US)
chrisb
Veteran
Posts: 54168
Joined: Tue Mar 17, 2015 9:14 am

Re: Error in Helix operation

Post by chrisb »

I can reproduce with
Angular deflection = 28.5° and
Deviation = 0.5
Which values do you have as preferences?
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
mlampert
Veteran
Posts: 1772
Joined: Fri Sep 16, 2016 9:28 pm

Re: Error in Helix operation

Post by mlampert »

The Helix op has not been maintained in a while, the original author isn't active anymore. I'll have a look tonight, those asserts are just wrong.
chrisb
Veteran
Posts: 54168
Joined: Tue Mar 17, 2015 9:14 am

Re: Error in Helix operation

Post by chrisb »

mlampert wrote: Thu Aug 08, 2019 7:25 pm The Helix op has not been maintained in a while, the original author isn't active anymore. I'll have a look tonight, those asserts are just wrong.
The issue mentioned in the OP is solved. It was my fault to use a tool bigger than the hole diameter. Sorry for the noise.

(The issue in the linked topic with wrong hole diameters caused by using the bound box is still present).
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
mlampert
Veteran
Posts: 1772
Joined: Fri Sep 16, 2016 9:28 pm

Re: Error in Helix operation

Post by mlampert »

chrisb wrote: Thu Aug 08, 2019 10:21 pmThe issue mentioned in the OP is solved. It was my fault to use a tool bigger than the hole diameter. Sorry for the noise.
i don't consider this to be noise. Input data sanitation should happen and an assert is not the way to go about it. No input values should result in an exception.
(The issue in the linked topic with wrong hole diameters caused by using the bound box is still present).
will have a look.
chrisb
Veteran
Posts: 54168
Joined: Tue Mar 17, 2015 9:14 am

Re: Error in Helix operation

Post by chrisb »

mlampert wrote: Fri Aug 09, 2019 12:16 am will have a look.
Thank you!
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Post Reply