Self test error on testTaperedHole

Having trouble installing or compiling FreeCAD? Get help here.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
PrzemoF
Veteran
Posts: 3520
Joined: Fri Jul 25, 2014 4:52 pm
Contact:

Self test error on testTaperedHole

Post by PrzemoF »

I get this on my fedora system after FreeCAD -t 0:

Code: Select all

FAIL: testTaperedHole (PartDesignTests.TestHole.TestHole)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib64/freecad/Mod/PartDesign/PartDesignTests/TestHole.py", line 78, in testTaperedHole
    self.assertEqual(len(self.Hole.Shape.Faces), 8)
AssertionError: 7 != 8

----------------------------------------------------------------------
Ran 470 tests in 149.380s

FAILED (failures=1)
System exit
It might be related to recent switch of fedora nightlies from OCE to OCCT, but I'm not sure. Any idea why the hole is supposed to have 8 faces?
travis-ci builds don't have this problem (line 8860): https://travis-ci.org/github/FreeCAD/Fr ... 9611#L8860
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Self test error on testTaperedHole

Post by wmayer »

The test doesn't fail for me.

This is the extracted code

Code: Select all

from math import pi

import FreeCAD
App = FreeCAD
import TestSketcherApp

class TestHole:
    def setUp(self):
        self.Doc = FreeCAD.newDocument("PartDesignTestHole")
        self.Body = self.Doc.addObject('PartDesign::Body','Body')
        self.Box = self.Doc.addObject('PartDesign::AdditiveBox','Box')
        self.Box.Length=10
        self.Box.Width=10
        self.Box.Height=10
        self.Body.addObject(self.Box)
        self.Doc.recompute()
        self.HoleSketch = self.Doc.addObject('Sketcher::SketchObject', 'SketchHole')
        self.HoleSketch.Support = (self.Doc.XY_Plane, [''])
        self.HoleSketch.MapMode = 'FlatFace'
        self.HoleSketch.MapReversed = True
        self.Body.addObject(self.HoleSketch)
        TestSketcherApp.CreateCircleSketch(self.HoleSketch, (-5, 5),  1)
        self.Doc.recompute()
        self.Hole = self.Doc.addObject("PartDesign::Hole", "Hole")
        self.Hole.Profile = self.HoleSketch
        self.Body.addObject(self.Hole)
        self.Doc.recompute()
    
    def testTaperedHole(self):
        self.Hole.Diameter = 6
        self.Hole.Depth = 5
        self.Hole.TaperedAngle = 45
        self.Hole.ThreadType = 0
        self.Hole.HoleCutType = 0
        self.Hole.DepthType = 0
        self.Hole.DrillPoint = 0
        self.Hole.Tapered = 1
        self.Doc.recompute()
        print(len(self.Hole.Shape.Faces), 8)

hole=TestHole()
hole.setUp()
hole.testTaperedHole() # prints 8 and 8
When you go to Draft and downgrade the Hole feature it has 8 faces here. However, there is something strange because one of the faces is a double-cone while a normal cone would be expected.

So, it might be possible that with different versions of OCCT also the results are different.
User avatar
PrzemoF
Veteran
Posts: 3520
Joined: Fri Jul 25, 2014 4:52 pm
Contact:

Re: Self test error on testTaperedHole

Post by PrzemoF »

Thank you for the explanation! Just in case it comes back in the future as a real problem:

OS: Fedora 31 (Workstation Edition) (GNOME/gnome-xorg)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.pre_20550 (Git)
Build type: Unknown
Python version: 3.7.6
Qt version: 5.13.2
Coin version: 3.1.3
OCC version: 7.4.0.beta
Locale: Polish/Poland (pl_PL)
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Self test error on testTaperedHole

Post by wmayer »

Here is my version:
OS: Ubuntu 18.04.4 LTS (XFCE/xubuntu)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.20602 (Git)
Build type: Unknown
Branch: master
Hash: 5e9869aaefe3361aac87a739ca576a160f2811b6
Python version: 3.6.9
Qt version: 5.9.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: German/Germany (de_DE)

Could you execute the above code snippet and save and upload the project, please?
User avatar
PrzemoF
Veteran
Posts: 3520
Joined: Fri Jul 25, 2014 4:52 pm
Contact:

Re: Self test error on testTaperedHole

Post by PrzemoF »

Sorry for the delay - I missed that you want to execute the test code. It consistently shows 7

Code: Select all

>>> hole.testTaperedHole() # prints 8 and 8
7 8
The generated file and screenshot with error attached.
Attachments
Zrzut ekranu z 2020-04-17 12-27-01.png
Zrzut ekranu z 2020-04-17 12-27-01.png (89.85 KiB) Viewed 1698 times
hole_test_fails.FCStd
(16.29 KiB) Downloaded 29 times
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Self test error on testTaperedHole

Post by wmayer »

With OCC7.4 it apparently fails to revolve the sketch. I get this error when loading the project but as soon as a recompute the document the error disappears and the hole becomes conical. Here is the file how it looks after recompute:
hole_test_fails_occ73.FCStd
(16.3 KiB) Downloaded 32 times
So I am not sure what's best how to handle the issue as it seems to be another regression of OCC7.4.
User avatar
PrzemoF
Veteran
Posts: 3520
Joined: Fri Jul 25, 2014 4:52 pm
Contact:

Re: Self test error on testTaperedHole

Post by PrzemoF »

Do we have someone from OCCT here? I just sent them a message pointing to this topic, but I've no idea if they normally check things like this.
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Self test error on testTaperedHole

Post by Kunda1 »

PrzemoF wrote: Sat Apr 18, 2020 9:58 am Do we have someone from OCCT here? I just sent them a message pointing to this topic, but I've no idea if they normally check things like this.
Quaoar wrote::bell:
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
gkv311
Posts: 6
Joined: Mon Oct 24, 2016 8:02 am

Re: Self test error on testTaperedHole

Post by gkv311 »

PrzemoF wrote: Sat Apr 18, 2020 9:58 am Do we have someone from OCCT here? I just sent them a message pointing to this topic, but I've no idea if they normally check things like this.
The normal way to report some bug in OCCT is reporting it on Bugtracker:
https://tracker.dev.opencascade.org/
https://dev.opencascade.org/index.php?q ... t_involved

The main problem here is providing steps to reproduce applicable to OpenCASCADE developers. These couldn't be instructions in FreeCAD, as they could be reproduced only by FreeCAD developers. Building and debugging FreeCAD is not fun for external developer due to tremendous list of dependencies, at least on Windows platform.

Bug in FreeCAD occurred on switching to another version of OCCT does not necessarily indicate OCCT being the root cause of the problem. It might be a bug in FreeCAD itself or in a script, like (ab)using OCCT algorithms in wrong way or relying on undocumented behavior of used algorithms, which has been changed.

Normally, steps should be:
  • Tcl script for Draw Harness. Draw Harness is a Tcl interpreter with plugins coming with OCCT itself, used for testing, learning OCCT, development and prototyping. This is the perfect scenario, as Draw Harness available with every version of OCCT, known to every OCCT developer, and easily reproducible - it is also easily possible to traverse script within different OCCT releases (and bisect where regression occurred, for example).
  • Self-sustained C++ code using OCCT algorithms. It will require more time to OCCT developer for reproducing problem, as it requires development environment, C++ code might contain its own bugs, and it is often not self-sufficient when quoted some lines from another application source code.
  • Patches for OCCT fixing the problem. Steps to reproduce are normally required to integrate a bugfix, but if problem fixed by patch is more or less clear from patch itself, it could be also integrated (of course, this scenario considers that FreeCAD user or developer will debug the problem inside OCCT). Most bugs are difficult to fix, but there also numerous trivial issues that might be found and easy to fix.
  • Steps within applications developed by Open Cascade like CAD Processor, CAD Assistant, DMU Reviewer, SALOME platform and others. This is indirect reporting, but if issue is reproducible in other OCCT-based applications, their developers will be able reporting it to OCCT developers properly. This is not much useful for FreeCAD, but still, some functionality can be easily reproduced (like importing STEP / IGES files). SALOME comes with Geometry module and Shaper allowing to create new geometry using OCCT algorithms and parametric sketcher.
There were some enthusiasts on FreeCAD forum worked on reporting OCCT bugs on OCCT Bugtracker, so they might help you in this quest. It should be noted, though, that reporting issue is only first step. OCCT developers are interested in improving quality of framework, but without commercial contract (Open Cascade provides Support Contracts specifically for helping with OCCT), the bugs are classified and processed in the order, which may take too long for specific bug.

As in any active project, OCCT has continuous backlog of reported bugs, with no chance to reach 0 level (you may easily collect some statistics from publicly available logs on Bugtracker). Some projects receive so many new bugs, so that they use even bots to automatically close bugs with no activity within some time (like 1 year), this is not currently used by OCCT. The point is, however, is that quality of reported bug directly affects how soon bug could be actually processed. For instance, performing analysis and checking if bug is a regression, and in which OCCT release it has been introduced increases priority of the bug. Bugs with poor description, and steps difficult to reproduce have high chance to be closed as not-reproducible or to vanish in backlog indefinitely due low interest from developers spending much time on such bug.

OCCT is an open source, and with some efforts and reasonable background, everybody may contribute to the project - and this is actually the best way to ensure the bug being fixed soon. Of course, some algorithms might be difficult to understand and debug, but OCCT developers may help external contributor to go into proper direction when see that user really tries to solve the problem.
User avatar
PrzemoF
Veteran
Posts: 3520
Joined: Fri Jul 25, 2014 4:52 pm
Contact:

Re: Self test error on testTaperedHole

Post by PrzemoF »

gkv311, thank you very much for detailed info! I just completed my "Hello World" in Draw/TCL (show a box). It might take me a while to convert our test case into the Draw harness test case - I'll be asking on OpenCASCADE forum for help if I get stuck.
Post Reply