3D Surface - Face Selection (New feature) [Merged]

Here's the place for discussion related to CAM/CNC and the development of the Path module.
Post Reply
Russ4262
Posts: 427
Joined: Sat Jun 30, 2018 3:22 pm

3D Surface - Face Selection (New feature) [Merged]

Post by Russ4262 » Sun Dec 29, 2019 1:29 am

Evening fellow PathWB users.
I think I have a stable version for the newly featured 3D Surface. The long-awaited face selection feature should now be a reality. Also, I have addressed the erroneous 'Line' and 'Zigzag' pattern issues. They are now performing as expected.

Please test the PR before approving. Only two files are affected, PathSurface.py and PathSelection.py. I'm attaching the PR version files here.

I think many will find this very useful. Please place feedback here. I will update the PR with any necessary fixes as time permits.
PR 2849 - [Path] 3D-Surface: Add select face(s) feature to Drop Cutter algorithm; Other improvements.

Update 2019-12-30 00:17 CST - Updated attached script to version 4b.
Update 2020-01-08 22:58 CST - Updated script to version 4D
Update 2020-01-10 00:33 CST - Updated attached script to version 4g. Almost fully restored complex optimization.
Update 2020-01-20 20:44 CST - Updated attached PathSurface.py script to version 5d, and attached additional dependent scripts. Fixes, new features, and other improvements in this version!
Update 2020-01-22 20:09 CST - Update to version 5f.
Update 2020-01-23 00:14 CST - Version 6a - face avoidance, on top of face selection.
Another Update 2020-01-25 16:01 CST - Version 7a just pushed to PR. Request by @Freman honored: Circular cut pattern added.
Update anyone? 2020-02-01 22:04 CST - Version 8g just sent to PR. Say hello to G2/G3 gcode commands for the new `Circular` and `CircularZigZag` cut patterns.
Update 2020-02-12 08:07 CST - New version 9c pushed to PR. It has new `ProfileEdges` feature, bug fixes, and code improvements.
Update 2020-02-12 08:07 CST - Version 9d uploaded here with a few more bug fixes, and code improvements. It has been in the PR for a few days.
Update 2020-03-11 16:58 CST (on the crazy DST!) Who thought to call it Daylight Savings Time? The daylight is not saved! As a PathWB dev, I know we are only applying a `.translate()` method and then reversing it. Anyhow, I have updated the PR. There are a number of bug fixes, error handling improvements, and couple of operation improvements to the purposed changes (including some property changes and additions).
Update 2020-03-14 14:53 CST - Very minor fix for last line direction in ZigZag cut pattern with odd line count.
Update 2020-03-15 19:24 CST - Fixed incorrect argument name passed when `HandleMulitipleFeatures` set to `Individually`.
Update 2020-03-18 12:29 CST - Exposed two deflection settings for solid-to-mesh conversion for OCL and fixed `DepthOffset` property application.

MERGED 2020-03-18 - The three attached testing scripts were deleted from post on 2020-03-21. The three scripts were merged into FreeCAD master.


Happy New Year!

Russell

OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.19093 (Git)
Build type: Release
Branch: master
Hash: 9e4710d679d44613a1ae4264b86ef9f6d12f4e5a
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/United States (en_US)
Attachments
3D_Surface-Version 5c - Line.png
Face selection now available, with respect to boundary
3D_Surface-Version 5c - Line.png (264.01 KiB) Viewed 1363 times
Last edited by Russ4262 on Wed Mar 25, 2020 2:53 pm, edited 26 times in total.
chrisb
Posts: 24233
Joined: Tue Mar 17, 2015 9:14 am

Re: 3D Surface - Face Selection (New feature)

Post by chrisb » Sun Dec 29, 2019 2:52 am

Thanks for the christmas present.

This is how 3D surface worked before:
Bildschirmfoto 2019-12-29 um 03.34.40.png
Bildschirmfoto 2019-12-29 um 03.34.40.png (57.93 KiB) Viewed 1984 times
And this is how it worked after I replaced the two python files:
Snip macro screenshot-4318cf.png
Snip macro screenshot-4318cf.png (123.98 KiB) Viewed 1984 times
Observations:
- The selction works, 3D surface is now restricted to the selected faces; works great.
- the new version works on the extrude cylinder
- it works on the rectangular pocket, but not as good as the original version
- it doesn't work on the other spherical or cylindrical faces, it even goes through the extruded spheres

File is attached for further studies.
Attachments
surface.FCStd
(45.29 KiB) Downloaded 34 times
User avatar
sliptonic
Posts: 1753
Joined: Tue Oct 25, 2011 10:46 pm

Re: 3D Surface - Face Selection (New feature)

Post by sliptonic » Sun Dec 29, 2019 3:13 am

Russ, this looks awesome. I can't wait to play with it!
Russ4262
Posts: 427
Joined: Sat Jun 30, 2018 3:22 pm

Re: 3D Surface - Face Selection (New feature)

Post by Russ4262 » Sun Dec 29, 2019 4:04 am

chrisb wrote:
Sun Dec 29, 2019 2:52 am
Thanks for the christmas present.

This is how 3D surface worked before:Bildschirmfoto 2019-12-29 um 03.34.40.png

And this is how it worked after I replaced the two python files:Snip macro screenshot-4318cf.png

Observations:
- The selction works, 3D surface is now restricted to the selected faces; works great.
- the new version works on the extrude cylinder
- it works on the rectangular pocket, but not as good as the original version
- it doesn't work on the other spherical or cylindrical faces, it even goes through the extruded spheres

File is attached for further studies.
Thanks for the feedback, @ChrisB. I have an alternate method in mind for processing the faces individually, but time ran out and I encountered early errors that I couldn't get to today. So, I went with what we see here.

Current method combines all selected faces into a compound solid, then processes that. The failure to generate correct paths could be there. My alternate method attacked each face individually. I know this alternate method will work. I just need time to work out the proceedural bugs with it.

Second source of path errors could also be due to incorrect tessillation of the compund envelope used in the current method. I know tessillation has been a source of similar issues in the past.

I'll try to take a look this week.

@sliptonic, please do not merge PR until we get this working better - thanks.

Thanks @ChrisB for the model file to work with!

Russell
chrisb
Posts: 24233
Joined: Tue Mar 17, 2015 9:14 am

Re: 3D Surface - Face Selection (New feature)

Post by chrisb » Sun Dec 29, 2019 8:06 am

The spheres need awfully much computing time, so I made only one test very late yesterday. I just thought of a model which I definitely never want to mill in real life :lol: .
When doing some more tests I realize a crash: If I remove a single item from the BaseGeometry list and Apply, FreeCAD crashes with nothing more than on console:

Code: Select all

3940 Segmentation fault: 11
Edit: A log file contains nothing after hitting Apply.

Edit2: leaving only the first, i.e. the half sphere pocket Face16, it works. FreeCAD crashes if I leave only the 2nd entry Face13, i.e. the sphere segment pocket. The half sphere, however, is not milled inside.

Edit3: The Sphere segment does not work even if I recreate the whole 3DPocket anew.

Edit4: 3D-Pocket is anyway an experimental feature, so you can well merge it, even if there are bugs. It is easier to test.

I add the slightly modified file. I removed the protrusion at the bottom. The facenumbers mentioned above still refer to the previously attached model.

OS: macOS High Sierra (10.13)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.19066 (Git)
Build type: Release
Branch: master
Hash: c766d757912ded11d41bc825f82c47a8428396ad
Python version: 3.7.6
Qt version: 5.12.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/Germany (en_DE)
Attachments
surface.FCStd
(39.54 KiB) Downloaded 18 times
User avatar
Kunda1
Posts: 7319
Joined: Thu Jan 05, 2017 9:03 pm

Re: 3D Surface - Face Selection (New feature)

Post by Kunda1 » Sun Dec 29, 2019 12:21 pm

Can someone kindly make a screencast of the feature ? Perhaps it can be included on the 0.19 Release Changelog
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
Russ4262
Posts: 427
Joined: Sat Jun 30, 2018 3:22 pm

Re: 3D Surface - Face Selection (New feature)

Post by Russ4262 » Mon Dec 30, 2019 2:42 am

chrisb wrote:
Sun Dec 29, 2019 2:52 am
... And this is how it worked after I replaced the two python files:
Observations:
- The selction works, 3D surface is now restricted to the selected faces; works great.
- the new version works on the extrude cylinder
- it works on the rectangular pocket, but not as good as the original version
- it doesn't work on the other spherical or cylindrical faces, it even goes through the extruded spheres
...

Evening Sir,
I loaded your file and did a recompute (literally) with no change to the output. I noticed the only tool in the 'Job' is the 'Default Tool'. I have had issues with this in the past. I opened the 'Job' settings by double clicking on 'Job' in the object tree. I navigated to the 'Tools' tab and attempted to add a new tool. This locked up FreeCAD multiple times after repeated identical attempts. Leaving this particular bug behind for another Path topic, I decided to delete your existing Surface op and then attempt to add a new tool. This worked. I then added a 1/8 inch (3.175mm) end mill tool and a 1/4 inch (6.35mm) successfully. I recreated your Surface op with the same faces selected and left all other op settings as defaults, using the new 1/8" end mill tool. The attached image and file are the expected, better, result. Using the 'Defualt Tool' doesn't work well for some ops. I do not know why, but I have my theories (which have neither merit nor benefit here).

Looks a lot better, right?

Regardless, I loaded up the alternate method of processing each face individually. I worked out the initial bugs with this alternate method that I encountered in the beginning. I need to run some tests to see which method works faster, and which might have a better quality.

I really do appreciate the feedback mate! Thanks a million, Sir.

Russell

OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.19093 (Git)
Build type: Release
Branch: master
Hash: 9e4710d679d44613a1ae4264b86ef9f6d12f4e5a
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/United States (en_US)
Attachments
surface-non-default-tool.FCStd
@ChrisB's model with NON-DefaultTool used (3.175 mm)
(80 KiB) Downloaded 22 times
3D_Surface-modified-updated-chrisb.png
@ChrisB's model with NON-DefaultTool used (3.175 mm)
3D_Surface-modified-updated-chrisb.png (225.81 KiB) Viewed 1766 times
Russ4262
Posts: 427
Joined: Sat Jun 30, 2018 3:22 pm

Re: 3D Surface - Face Selection (New feature)

Post by Russ4262 » Mon Dec 30, 2019 2:52 am

Kunda1 wrote:
Sun Dec 29, 2019 12:21 pm
Can someone kindly make a screencast of the feature ? Perhaps it can be included on the 0.19 Release Changelog
The image in the OP might work, otherwise I am attaching a screenshot of the 3D Surface op settings with the new 'Base Geometry' section available. Not sure if this is what you are looking for.

Russell
Attachments
3D_Surface-new-feature-select-faces.png
3D_Surface-new-feature-select-faces.png (219.48 KiB) Viewed 1763 times
Russ4262
Posts: 427
Joined: Sat Jun 30, 2018 3:22 pm

Re: 3D Surface - Face Selection (New feature)

Post by Russ4262 » Mon Dec 30, 2019 6:33 am

Evening FC users.
I added the "HandleMultipleFeatures" property to allow users the choice to process multiple faces collectively(cut a single layer from all faces before dropping to next layer) or individually(cut each face to depth before processing next face selected). When set to "Individually," computational time is longer, FYI; however, it might be what you want on your CNC job. This new property is in version 4b, available in the OP of this topic at the time of this post.

I am attaching more sample pics using @ChrisB's model file provided earlier in this topic.

Me thinks this is looking pretty smooth. :-)

PS: I have some robust, across-the-board rotation improvements in alpha or beta testing. These improvements will allow rotational access to all existing ops, even future ops, and should grant eventual access (As I vision it...) to all six axes. Fun stuff !

Russ
Attachments
3D_Surface-process-selected-faces-individually-singlepass.png
3D_Surface-process-selected-faces-individually-singlepass.png (228.78 KiB) Viewed 1745 times
3D_Surface-process-selected-faces-individually-multipass.png
3D_Surface-process-selected-faces-individually-multipass.png (220.56 KiB) Viewed 1745 times
3D_Surface-process-selected-faces-collectively-singlepass.png
3D_Surface-process-selected-faces-collectively-singlepass.png (225.99 KiB) Viewed 1745 times
3D_Surface-process-selected-faces-collectively-multipass.png
3D_Surface-process-selected-faces-collectively-multipass.png (220.95 KiB) Viewed 1745 times
chrisb
Posts: 24233
Joined: Tue Mar 17, 2015 9:14 am

Re: 3D Surface - Face Selection (New feature)

Post by chrisb » Tue Dec 31, 2019 12:07 am

Sorry for being slower with testing than you with developing.

I have investigated the differences between your non-default tool and my default tool - which I had already changed to a diameter of 3mm.
The mistake was completely on my side: I had left all values at their defaults - including the tesselation. Now I have set it to 1.0 and it works great!
Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests