Ticket #4411 - Can only generate pocket once for this shape, then it fails.

Here's the place for discussion related to CAM/CNC and the development of the Path module.
racemaniac
Posts: 25
Joined: Sat Nov 30, 2019 7:45 am

Ticket #4411 - Can only generate pocket once for this shape, then it fails.

Postby racemaniac » Tue Jul 28, 2020 9:31 am

I was using Path with the attached file, and came across this really annoying bug for the plane highlighted in this screenshot
bug plane.png
bug plane.png (17.71 KiB) Viewed 321 times
I create a pocket operation for it (all default setings), and that works perfectly, it generates the toolpath, everything is fine.

If however i do anything that causes this path to get refreshed (alter any parameter of it, alter the output processor of the job, ...) then it fails to recompute the path with this error in the Report View:
class Standard_NullObject BRep_Tool:: TopoDS_Vertex hasn't gp_Pntclass Standard_NullObject BRep_Tool:: TopoDS_Vertex hasn't gp_PntSomething unexpected happened. Check project and tool config.

I then have to restart from a file that's from before i started adding this job & pocket, because even deleting the entire job & remaking it doesn't allow me to generate the toolpath for that plane anymore.

File to reproduce the issue:
Bug.FCStd
(263.63 KiB) Downloaded 12 times
Steps to reproduce:
Open the file
Start a job (default settings)
Create a pocket operation for the highlighted plane, all default settings
Make any change, for example set step over to 80 -> it fails. From then on you can do whatever you want, it'll no longer create any toolpath for that plane with the pocket operation...

FreeCAD version: OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.22111 (Git)
Build type: Release
Branch: master
Hash: cb2099aa6bb287a8d7843eb70684cce79bdef26b
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: Dutch/Belgium (nl_BE)
Last edited by Kunda1 on Fri Jul 31, 2020 1:07 pm, edited 1 time in total.
Reason: Added ticket number to thread title
Syres
Posts: 720
Joined: Thu Aug 09, 2018 11:14 am

Re: Can only generate pocket once for this shape, then it fails.

Postby Syres » Tue Jul 28, 2020 11:13 am

Confirmed, Report View ouput:

Code: Select all

12:09:49  Path workbench activated
12:10:01  Pocketing Select Mode
12:10:10  Free Select
12:10:10  class Standard_NullObject BRep_Tool:: TopoDS_Vertex hasn't gp_Pntclass Standard_NullObject BRep_Tool:: TopoDS_Vertex hasn't gp_PntSomething unexpected happened. Check project and tool config.

Last working build I have is:

OS: Windows 7 SP 1 (6.1)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.20036 (Git)
Build type: Release
Branch: master
Hash: 953ae1e6e917fa6860564c80fdc1f20950a5c0ac
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/United Kingdom (en_GB)

Error produced using the following and later builds:

OS: Windows 7 SP 1 (6.1)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.20221 (Git)
Build type: Release
Branch: master
Hash: e25cdd2d043f3fbe5f71155a296f322aec6b85b7
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/United Kingdom (en_GB)

Edit: Corrected build information
Last edited by Syres on Wed Jul 29, 2020 8:09 pm, edited 1 time in total.
Syres
Posts: 720
Joined: Thu Aug 09, 2018 11:14 am

Re: Can only generate pocket once for this shape, then it fails.

Postby Syres » Tue Jul 28, 2020 11:55 am

I might well be talking out of my hat here but could this be a mesh analysis issue rather than a Path Wb issue?

I mention this because having looked through the commits between 0.19.22039 and 0.19.22111 and backed out the only Path specific commit git commit 7202749 there was no change to the error being generated.
chrisb
Posts: 25699
Joined: Tue Mar 17, 2015 9:14 am

Re: Can only generate pocket once for this shape, then it fails.

Postby chrisb » Wed Jul 29, 2020 2:43 pm

Please try to recompute the whole model before creating the Path oprration.
racemaniac
Posts: 25
Joined: Sat Nov 30, 2019 7:45 am

Re: Can only generate pocket once for this shape, then it fails.

Postby racemaniac » Wed Jul 29, 2020 7:46 pm

chrisb wrote:
Wed Jul 29, 2020 2:43 pm
Please try to recompute the whole model before creating the Path oprration.
That is indeed a workaround for this bug.

I'm not familiar with the bug reporting here, what's the next step? We've got the bug confirmed, and a workaround established, but it's still an issue of course (you can hardly expect the user to manually recompute objects all the time just in case path would choose to update a pocket). Do i make a ticket on github? Or do you guys handle that?
GeneFC
Posts: 1347
Joined: Sat Mar 19, 2016 3:36 pm
Location: Punta Gorda, FL

Re: Can only generate pocket once for this shape, then it fails.

Postby GeneFC » Wed Jul 29, 2020 7:57 pm

racemaniac wrote:
Wed Jul 29, 2020 7:46 pm
Do i make a ticket on github? Or do you guys handle that?
This is FreeCAD. That means "you guys" includes YOU! :o

It is easy to get access to the bug tracker, and learning how to write bug tickets is straightforward.

See: https://wiki.freecadweb.org/Tracker

Gene
Syres
Posts: 720
Joined: Thu Aug 09, 2018 11:14 am

Re: Can only generate pocket once for this shape, then it fails.

Postby Syres » Wed Jul 29, 2020 8:16 pm

I've tracked down the commit that introduced the regression by replacing the PathPocketShape.py from build 0.19.20036 into 0.19.20221, git commit 022c14d. It was a lot earlier in the year than I thought, hence I've updated my build info above.

I'll attempt to fix it tomorrow but no promises.
Syres
Posts: 720
Joined: Thu Aug 09, 2018 11:14 am

Re: Can only generate pocket once for this shape, then it fails.

Postby Syres » Thu Jul 30, 2020 6:37 am

The regression is caused by the section https://github.com/FreeCAD/FreeCAD/blob ... pe.py#L651 down to line 681 with particular reference to line 666 which I just can't get my head around what @Russ4262 was trying to achieve. I'm guessing it's the negative number in Z which is causing the TopoDS error. If I back out that section to be as before the 4th Axis change then all is fine again:

Code: Select all

                extent = FreeCAD.Vector(0, 0, sD - fD)
                for face in self.horizontal:
                    self.removalshapes.append((face.removeSplitter().extrude(extent),
                                                False, 'pathPocketShape', angle, axis, sD, fD))
                    PathLog.debug("Extent depths are str: {}, and fin: {}".format(sD, fD))
Russ4262 wrote: You're input on this one would be appreciated, TIA
racemaniac
Posts: 25
Joined: Sat Nov 30, 2019 7:45 am

Re: Can only generate pocket once for this shape, then it fails.

Postby racemaniac » Thu Jul 30, 2020 7:53 am

Create a ticket on the bugtracker: https://tracker.freecadweb.org/view.php?id=4411
Syres
Posts: 720
Joined: Thu Aug 09, 2018 11:14 am

Re: Can only generate pocket once for this shape, then it fails.

Postby Syres » Thu Jul 30, 2020 8:24 am

With my Linux compiled version it fails earlier in the same section and recomputing doesn't have any effect:

Code: Select all

09:17:56  Free Select
09:17:56  PathPocketShape.DEBUG: ----- areaOpShapes() in PathPocketShape.py
09:17:56  PathPocketShape.DEBUG: Processing... obj.Base
09:17:56  PathPocketShape.DEBUG: type() == Part.Plane
09:17:56  PathPocketShape.DEBUG:   -isVertical()
09:17:56  PathPocketShape.DEBUG: PathGeom.combineConnectedShapes shape.BoundBox.ZMin: -3.5
09:17:56  PathPocketShape.DEBUG: self.horizontal shpZMin: -3.5
09:17:56  Traceback (most recent call last):
  File "/home/john/freecad-daily-build/Mod/Path/PathScripts/PathUtils.py", line 62, in new_function
    res = function(*args, **kwargs)
  File "/home/john/freecad-daily-build/Mod/Path/PathScripts/PathOp.py", line 515, in execute
    result = self.opExecute(obj)  # pylint: disable=assignment-from-no-return
  File "/home/john/freecad-daily-build/Mod/Path/PathScripts/PathAreaOp.py", line 401, in opExecute
    aOS = self.areaOpShapes(obj) # pylint: disable=assignment-from-no-return
  File "/home/john/freecad-daily-build/Mod/Path/PathScripts/PathPocketShape.py", line 660, in areaOpShapes
    if self.isFaceUp(subBase, face) is False:
  File "/home/john/freecad-daily-build/Mod/Path/PathScripts/PathAreaOp.py", line 994, in isFaceUp
    if upCmn.Volume == 0.0:
<class 'RuntimeError'>: shape is invalid
09:17:56  5.5e-08 <App> Document.cpp(3768): Failed to recompute RabbitBugSyres#Pocket_Shape: shape is invalid
09:17:56  Recompute failed! Please check report view.
OS: Linux Mint 19.3 (X-Cinnamon/cinnamon)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.22175 (Git)
Build type: Unknown
Branch: master
Hash: 10e697f5b4015052ffac9927c4b4ef72cbb124be
Python version: 3.6.9
Qt version: 5.9.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedKingdom (en_GB)