3D pocket - odd results

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!
steve's bay 3 garage
Posts: 4
Joined: Thu Feb 24, 2022 10:47 pm
Location: Michigan, USA
Contact:

3D pocket - odd results

Post by steve's bay 3 garage »

Trying to learn the 3d pocket. I am getting mixed results depending on the geometry. Being new to path, I might be missing something. I am attaching a snip of a pocket that has spherical corners and pads between. Nine faces. Path generated is good (wireframe sideview). I then did a similar design but the spherical corners have a different radius on one end. Again nine faces and the pads between them slopes. Toolpath seems to stop at the bottom of the smaller sphere/radius. I then did a path using the "deeper" of the 6 faces. Here it goes to the bottom but also throws in some code to go through the bottom on the ends! I also did some bodies that had just angled surfaces and got similar results.
Thoughts?
view of body that works
view of body that works
flatspoon.png (45.57 KiB) Viewed 2182 times
sideview showing tool path to bottom and following radius
sideview showing tool path to bottom and following radius
flatspoontoolpath.png (7.11 KiB) Viewed 2182 times
view of geometry that doesn't work
view of geometry that doesn't work
slopespoon.png (23.8 KiB) Viewed 2182 times
sideview showing tool path stopping at bottom of smaller radius
sideview showing tool path stopping at bottom of smaller radius
slopespoontoolpath.png (6.63 KiB) Viewed 2182 times
repeat but only selecting 6 lower faces. Path goes to bottom but also cuts through model.
repeat but only selecting 6 lower faces. Path goes to bottom but also cuts through model.
partial faces.png (10.1 KiB) Viewed 2182 times

OS: Windows 10 Version 2009
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.24267 +99 (Git)
Build type: Release
Branch: Branch_0.19.3
Hash: 6530e364184ce05ccff39501e175cf2237e6ee4b
Python version: 3.8.6+
Qt version: 5.15.2
Coin version: 4.0.1
OCC version: 7.5.3
Locale: English/United States (en_US)
Russ4262
Posts: 952
Joined: Sat Jun 30, 2018 3:22 pm
Location: Oklahoma
Contact:

Re: 3D pocket - odd results

Post by Russ4262 »

Evening.
This looks like another manifestation of a previously reported bug with similar results. Are you able to provide the source file?

See 3D pocket anomaly for more info. I suggest downloading and trying a recent weekly build.

Thanks,
Russell
steve's bay 3 garage
Posts: 4
Joined: Thu Feb 24, 2022 10:47 pm
Location: Michigan, USA
Contact:

Re: 3D pocket - odd results

Post by steve's bay 3 garage »

Hi, thanks for the reply. One of two issues fixed: I installed the latest test version this morning (0.20.27422) and retried the path. The cutting though the model is now gone (appears to be the same as in the anomaly post referenced) but the failure to path to the bottom still exists. I am attaching the original model. I also made and attached a simple test model with 3 sloped faces. Same result (without the cut through), select 3 faces and it will only generate a path to the bottom of the least shallow face. Select only the 2 faces that go deeper and a path is generated to the bottom. So I can replicate the problem in sort of similar conditions with a different geometry.

Next steps?
Attachments
testwangles.FCStd
simple test model
(26.99 KiB) Downloaded 28 times
selecting 2 deepest faces, tool path goes to deepest point
selecting 2 deepest faces, tool path goes to deepest point
slopes2select.png (3.23 KiB) Viewed 1998 times
Selecting 3 faces, tool path goes only to bottom of shallow face
Selecting 3 faces, tool path goes only to bottom of shallow face
slope3selected.png (4 KiB) Viewed 1998 times
Sample simple model w/ 3 angled faces
Sample simple model w/ 3 angled faces
slopemodel.png (5.32 KiB) Viewed 1998 times
spoon4test.FCStd
Original model
(102.33 KiB) Downloaded 30 times
Russ4262
Posts: 952
Joined: Sat Jun 30, 2018 3:22 pm
Location: Oklahoma
Contact:

Re: 3D pocket - odd results

Post by Russ4262 »

steve's bay 3 garage wrote: Mon Apr 18, 2022 7:34 pm ...
Next steps?
Evening,
Please forgive the delay. Busy with prom and other activities this week. There is now a 28730 Win-Conda weekly available at https://github.com/FreeCAD/FreeCAD-Bund ... kly-builds.

Did some more investigating. It looks like the 27422 version might lack the recent fixes for the related depth bug. I just compiled master, see info below. The rectangular planer model works here with the three faces selected (last image). However, the spoon model is failing with the nine inner bowl faces selected.

My investigation suggests that there is a bug upstream. I do not know if it is Part Design, OCC, or other (even within Path). I attached a Part-PartDesign file that has your original spoon4 test model with a similar Part workbench reproduction. The attached model file has a Part simple copy of both your Part Design Body version and the Part version. The file also contains a Draft clone of each of these four models since Path uses clones for models. I have attached a simple script that seems to work in both 0.19 and 0.20 that creates a 3D Pocket operation on the inner nine bowl faces of each model. The script does require a Job object exist with all eight models represented within the Job. Running the script, you should find that the four Part based models will produce paths, whereas the Part-Design models will fail. I inspected the 3D Pocket code that creates the removal shape in 0.19 and 0.20, and the same simple envelope creation and model cut is used. This suggests to me that there is a bug upstream, but I cannot be certain this is an accurate deduction based on my test results.

I also get some interesting results using the attached file and simply creating a default 3D Pocket op with no features selected, as if I want to pocket the entire set of eight models. The 0.19 fails on five, whereas the 0.20 fails on four (all the Part Design based models).

Thanks for your feedback and testing. Thanks for reporting the issues you are having.

I recommend you submit a bug report (issue) on GitHub related to the unresolved issue you have identified in this thread.

Russell

Code: Select all

OS: Windows 10 Version 2009
Word size of FreeCAD: 64-bit
Version: 0.20.28751 (Git)
Build type: Release
Branch: master
Hash: d36cbb522ae91574b8ff41257653a514c1cb4beb
Python 3.8.6+, Qt 5.15.2, Coin 4.0.1, OCC 7.5.0
Locale: English/United States (en_US)
Installed mods: 
  * FC_SU
  * Z_MacroStartup
Attachments
spoon4test - Part-PartDesign.FCStd
Source file with eight models. Four Part Design based on spoon model of author, and four Part based similar reproductions
(220.62 KiB) Downloaded 29 times
_spoon_4_test.FCMacro
Macro to create 3D Pocket op on eight models in test file attached, after user creates Job with all eight source models selected and uses Job defaults.
(1.11 KiB) Downloaded 28 times
Attached source file to compare behavior between Part Design based models and Part based models.  Currently, Part Design has some failures.
Attached source file to compare behavior between Part Design based models and Part based models. Currently, Part Design has some failures.
Snip macro screenshot-f5bc0f.png (279.12 KiB) Viewed 1823 times
three flat faces selected works correctly now with master
three flat faces selected works correctly now with master
Snip macro screenshot-d9e2f4.png (102.26 KiB) Viewed 1823 times
tigermm
Posts: 49
Joined: Thu Jul 15, 2021 3:25 am

Re: 3D pocket - odd results

Post by tigermm »

Have you tried the 3D surface tool? This seems to give me better results.
steve's bay 3 garage
Posts: 4
Joined: Thu Feb 24, 2022 10:47 pm
Location: Michigan, USA
Contact:

Re: 3D pocket - odd results

Post by steve's bay 3 garage »

Thanks Russ4262 for the investigation. Don't apologize for the delay, I'm late in reply also as I understand life gets in the way sometimes. I did submit a bug on github, hope I did it right as it's the first time for me. Will try some other test cases as well. In the meantime, my g-code is a pasted together combo of both which spends a lot of time cutting air.

Tigermm, did you use the model posted or your own model? If so, did you make it in Part or part design?
tigermm
Posts: 49
Joined: Thu Jul 15, 2021 3:25 am

Re: 3D pocket - odd results

Post by tigermm »

steve's bay 3 garage wrote: Sat Apr 30, 2022 8:29 pm Tigermm, did you use the model posted or your own model? If so, did you make it in Part or part design?
Hi Steve, I hadn't looked at your model at that stage ..... I just meant in general with my own stuff which is made whichever way possible :lol:

But a quick play with your "testwangles" (sounds dodgy) with 3D surface gave me this.

You'll have to play with stepover to get the correct cut width (see my other thread) but the basis is there.
Attachments
testwangles.FCStd
(46.08 KiB) Downloaded 21 times
Last edited by tigermm on Sun May 01, 2022 5:58 am, edited 1 time in total.
tigermm
Posts: 49
Joined: Thu Jul 15, 2021 3:25 am

Re: 3D pocket - odd results

Post by tigermm »

Now that I've had some more time I tried with your spoon4test model and it seems like it'll work for that too.
This is with a 6mm ball end bit.
Attachments
spoon4test.FCStd
(131 KiB) Downloaded 22 times
steve's bay 3 garage
Posts: 4
Joined: Thu Feb 24, 2022 10:47 pm
Location: Michigan, USA
Contact:

Re: 3D pocket - odd results, Workaround?

Post by steve's bay 3 garage »

tigermm, thanks. I tried it with surface and the results look good. Odd that surface creates a good pocket but 3d pocket does not. Now it's off to the mill to finish proving it out.
Leads me to believe that the bug is in 3d pocket. But then it begs the question, if 3d surface works, why do we need pocket? Likely will be some cases where pocket is needed but this maybe a work-around.
Russ4262
Posts: 952
Joined: Sat Jun 30, 2018 3:22 pm
Location: Oklahoma
Contact:

Re: 3D pocket - odd results

Post by Russ4262 »

Evening,
I want to follow-up on this issue, having recently discovered more information about the error reported in the OP. While testing a side project for which the spoon4test file is a great target file, I have identified more information that is likely relevant to the problem. It appears that the removal shape problem identified earlier in this thread is likely caused due to a problem with one or more problematic edges in the Revolution001 sub-item of the Body object.

Here is a simple script to run to demonstrate the error.
Open the spoon4test file provided by author of OP.
Run the simple script by pasting the code in the Python console and pressing Enter to execute it.

Code: Select all

print("Checking each edge of Revolution001 for Curve.TypeId")
obj = FreeCAD.ActiveDocument.Revolution001
for i in range(len(obj.Shape.Edges)):
    try:
        print(f"Edge{i+1}.Curve.TypeId: {obj.Shape.Edges[i].Curve.TypeId}")
    except Exception as ee:
        print(f"Edge{i+1}  ERROR: {ee}")
In my tests with the script, it throws an error on Edge 5, and others, stating "undefined curve type" as the specific error text. Whereas, it should output something like Part::GeomBSpline, Part::GeomLine, Part::GeomCircle, etc... as seen in the output for other edges. Refer to the Report View and Python Console in the attached screenshot.

This missing TypeId is likely related to the issue seen here in Path, manifest as incorrect or failed paths for selected faces on this particular sample model. Perhaps this problem needs reported in the Part Design forum? Running a Geometry Check from the Part workbench on the Body object in the file yields no errors in geometry. However, this script demonstrates there is an internal error in the geometric data of the Revolution001 edges.

In the bigger picture, this same edge.Curve.TypeId issue (or simply the erroneous edge data) found in Part Design Body objects could be the source of other issues related to path failures for users if their Path models are based on Part Design objects.

Thanks,
Russell

Code: Select all

OS: Windows 10 Version 2009
Word size of FreeCAD: 64-bit
Version: 0.20.29077 +12 (Git)
Build type: Release
Branch: master_prs
Hash: 1a44ffa4963971757a53a626748a94908d25930e
Python 3.8.6+, Qt 5.15.2, Coin 4.0.1, Vtk 8.2.0, OCC 7.5.0
Locale: English/United States (en_US)
Installed mods: 
  * FC_SU
  * Z_MacroStartup
Attachments
Snip macro screenshot-f822ec.png
Snip macro screenshot-f822ec.png (160.08 KiB) Viewed 1011 times
Post Reply